summaryrefslogtreecommitdiffstats
path: root/crypto/conf/conf_def.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-03-11 10:14:11 +0100
committerRichard Levitte <levitte@openssl.org>2018-03-12 23:01:02 +0100
commit4f7c840a4dba37d8465137eae6867968e251c13c (patch)
tree134ef94f358d922a5c3ff72e15cd2c548e008004 /crypto/conf/conf_def.c
parentc130c0fe1d386fcc05d5b7accf062fe72b7272e8 (diff)
CONF: On VMS, treat VMS syntax inclusion paths correctly
non-VMS syntax inclusion paths get the same treatment as on Unix. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5587)
Diffstat (limited to 'crypto/conf/conf_def.c')
-rw-r--r--crypto/conf/conf_def.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index d689502e31..752859d9e7 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -685,6 +685,7 @@ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)
namelen = strlen(filename);
+
if ((namelen > 5 && strcasecmp(filename + namelen - 5, ".conf") == 0)
|| (namelen > 4 && strcasecmp(filename + namelen - 4, ".cnf") == 0)) {
size_t newlen;
@@ -697,10 +698,25 @@ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)
CONFerr(CONF_F_GET_NEXT_FILE, ERR_R_MALLOC_FAILURE);
break;
}
- OPENSSL_strlcat(newpath, path, newlen);
-#ifndef OPENSSL_SYS_VMS
- OPENSSL_strlcat(newpath, "/", newlen);
+#ifdef OPENSSL_SYS_VMS
+ /*
+ * If the given path isn't clear VMS syntax,
+ * we treat it as on Unix.
+ */
+ {
+ size_t pathlen = strlen(path);
+
+ if (path[pathlen - 1] == ']' || path[pathlen - 1] == '>'
+ || path[pathlen - 1] == ':') {
+ /* Clear VMS directory syntax, just copy as is */
+ OPENSSL_strlcpy(newpath, path, newlen);
+ }
+ }
#endif
+ if (newpath[0] == '\0') {
+ OPENSSL_strlcpy(newpath, path, newlen);
+ OPENSSL_strlcat(newpath, "/", newlen);
+ }
OPENSSL_strlcat(newpath, filename, newlen);
bio = BIO_new_file(newpath, "r");