certnanny / sscep

SSCEP is a command line client for the SCEP protocol
Other
175 stars 92 forks source link

sscep does not accept an URL without a subpath #110

Closed bjanders closed 4 years ago

bjanders commented 4 years ago

I used the URL: http://localhost:2014/ and sscep gives the error:

sscep: illegal URL http://localhost:2014/

(Hope I'll not be arrested for using an illegal URL.)

The problem is probably because it tries to parse dir_name which will be empty in the above case and then the check on line 466 in sscep.c will fail.

I'm using release 0.7.0.

bjanders commented 4 years ago

I worked around it by replacing:

    if (!dir_name) {
         fprintf(stderr, "%s: illegal URL %s\n", pname, url_char);
         exit (SCEP_PKISTATUS_ERROR);
    }

with:

   if (!dir_name) {
           dir_name = p;
   }

That way dir_name points to the '\0' char of the URL string in case the there is nothing after the ending '/' char. It's probably not the best or right solution, but works for my purposes.

gotthardp commented 4 years ago

Hello. Thanks for the workaround. The URL parsing was reworked for IPv6 and the latest version in the develop branch does not generate this error anymore.