diff options
author | Richard Levitte <levitte@openssl.org> | 2004-01-22 22:35:56 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2004-01-22 22:35:56 +0000 |
commit | 1a4dc04dc4342c02a42afb03dd317f624cfd19dc (patch) | |
tree | 6a693efc2ad7fd2234aeff944e7250ce4fe59c4f | |
parent | f7191d25ada8fa21eb7b8a1f74a7a00931c47452 (diff) |
[Merged from the main trunk]
Adding a slash between the directoryt and the file is a problem with
VMS. The C RTL can handle it well if the "directory" is a logical
name with no colon, therefore ending being 'logname/file'. However,
if the given logical names actually has a colon, or if you use a full
VMS-syntax directory, you end up with 'logname:/file' or
'dev:[dir1.dir2]/file', and that isn't handled in any good way.
So, on VMS, we need to check if the directory string ends with a
separator (one of ':', ']' or '>' (< and > can be used instead [ and
])), and handle that by not inserting anything between the directory
spec and the file name. In all other cases, it's assumed the
directory spec is a logical name, so we need to place a colon between
it and the file.
Notified by Kevin Greaney <kevin.greaney@hp.com>.
-rw-r--r-- | crypto/x509/by_dir.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 448bd7e69c..f09022379f 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -302,8 +302,36 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, k=0; for (;;) { - sprintf(b->data,"%s/%08lx.%s%d",ctx->dirs[i],h, - postfix,k); + char c = '/'; +#ifdef VMS + c = ctx->dirs[i][strlen(ctx->dirs[i])-1]; + if (c != ':' && c != '>' && c != ']') + { + /* If no separator is present, we assume the + directory specifier is a logical name, and + add a colon. We really should use better + VMS routines for merging things like this, + but this will do for now... + -- Richard Levitte */ + c = ':'; + } + else + { + c = '\0'; + } +#endif + if (c == '\0') + { + /* This is special. When c == '\0', no + directory separator should be added. */ + sprintf(b->data,"%s%08lx.%s%d",ctx->dirs[i],h, + postfix,k); + } + else + { + snprintf(b->data,"%s%c%08lx.%s%d", + ctx->dirs[i],c,h,postfix,k); + } k++; if (stat(b->data,&st) < 0) break; |