[openssl-dev] [openssl.org #4217] Fixing DJGPP port of openssl master branch.

Richard Levitte via RT rt at openssl.org
Mon Jan 4 20:22:15 UTC 2016


Hi Juan, and thanks.

I'm looking at your fix, and have a couple of questions:

In message <rt-4.0.19-11137-1451936568-1413.4217-21-0 at openssl.org> on Mon, 04 Jan 2016 19:42:48 +0000, Juan Manuel Guerrero via RT <rt at openssl.org> said:

rt> --- a/crypto/conf/conf_def.c
rt> +++ b/crypto/conf/conf_def.c
rt> @@ -87,6 +87,9 @@ static int def_load_bio(CONF *conf, BIO *bp, long *eline);
rt>   static int def_dump(const CONF *conf, BIO *bp);
rt>   static int def_is_number(const CONF *conf, char c);
rt>   static int def_to_int(const CONF *conf, char c);
rt> +#ifdef OPENSSL_SYS_MSDOS
rt> +static void dosify_filename(char *filename);
rt> +#endif
rt> 
rt>   static CONF_METHOD default_method = {
rt>       "OpenSSL default",
rt> @@ -370,6 +373,10 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
rt>               if (!str_copy(conf, psection, &(v->value), start))
rt>                   goto err;
rt> 
rt> +#ifdef OPENSSL_SYS_MSDOS
rt> +            if (IS_RANDFILE(v->name) || IS_CERT_DIR(v->name))
rt> +                dosify_filename(v->value);
rt> +#endif

Why only a specific file and directory?  Don't *all* file names have
to be "dosified"?

rt> +
rt> +#ifdef OPENSSL_SYS_MSDOS
rt> +static void dosify_filename(char *filename)
rt> +{
rt> +  if (filename && *filename && !HAS_LFN_SUPPORT(filename))
rt> +  {
rt> +    char *slash;
rt> +    int length;
rt> +    for (length = 0; filename[length]; length++)
rt> +      ;
rt> +    for (slash = filename + length - 1; slash > filename && *slash != '/'; slash--)
rt> +      ;
rt> +
rt> +    /* Leading dot not allowed on plain DOS.  */
rt> +    if (slash[0] == '.')
rt> +      slash[0] = '_';
rt> +    else if (slash[1] == '.')
rt> +      slash[1] = '_';
rt> +  }
rt> +}
rt> +#endif

I don't know DJGPP at all, but I'd be surprised if there isn't a
strrchr(), so what would you say about this:

    #ifdef OPENSSL_SYS_MSDOS
    static void dosify_filename(char *filename)
    {
        if (filename && *filename && !HAS_LFN_SUPPORT(filename)) {
            char *filenamestart = strrchr(filename, '/');
    
            if (filenamestart)
                filenamestart++;
            else
                filenamestart = filename;
    
            /* Leading dot not allowed on plain DOS.  */
            if (filenamestart[0] == '.')
                slash[0] = '_';
        }
    }
    #endif

Cheers,
Richard

-- 
Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/




More information about the openssl-dev mailing list