]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/ossl_store_test.c: Adapt the use of datadir for VMS paths
authorRichard Levitte <levitte@openssl.org>
Tue, 22 Jun 2021 05:28:26 +0000 (07:28 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 26 Jun 2021 04:43:08 +0000 (06:43 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15823)

test/ossl_store_test.c

index b9135cfcb39f99f1f4ce56506d53def45be1f9e0..b45d1d548f2302c42c84df7586b1053936abe89a 100644 (file)
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include <string.h>
 #include <limits.h>
 #include <openssl/store.h>
 #include <openssl/ui.h>
@@ -101,6 +102,7 @@ static int get_params(const char *uri, const char *type)
 static int test_store_get_params(int idx)
 {
     const char *type;
+    const char *urifmt;
     char uri[PATH_MAX];
 
     switch(idx) {
@@ -128,8 +130,16 @@ static int test_store_get_params(int idx)
         return 0;
     }
 
-    if (!TEST_true(BIO_snprintf(uri, sizeof(uri), "%s/%s-params.pem",
-                                datadir, type)))
+    urifmt = "%s/%s-params.pem";
+#ifdef __VMS
+    {
+        char datadir_end = datadir[strlen(datadir) - 1];
+
+        if (datadir_end == ':' || datadir_end == ']' || datadir_end == '>')
+            urifmt = "%s%s-params.pem";
+    }
+#endif
+    if (!TEST_true(BIO_snprintf(uri, sizeof(uri), urifmt, datadir, type)))
         return 0;
 
     TEST_info("Testing uri: %s", uri);