Change default directory for the .rnd file on Windows and VMS
authorRichard Levitte <levitte@openssl.org>
Mon, 20 Jun 2016 05:56:32 +0000 (07:56 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 20 Jun 2016 09:06:40 +0000 (11:06 +0200)
The previous change for Windows wasn't quite right.  Corrected to use
%HOME%, %USERPROFILE% and %SYSTEMPROFILE%, in that order.

Also adding the default home for VMS, SYS$LOGIN:

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
CHANGES
crypto/rand/randfile.c
e_os.h

diff --git a/CHANGES b/CHANGES
index 8fa6f44e0f19dda472fcdd6848fc5b18016678c7..e182b6072fe22fb4b68165eb3c8a2a66806939e9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,8 +6,8 @@
 
   *) The method for finding the storage location for the Windows RAND seed file
      has changed. First we check %RANDFILE%. If that is not set then we check
-     the directories %TMP%, %TEMP%, %USERPROFILE%, %SYSTEMROOT% and %HOME% in
-     that order. If all else fails we fall back to "C:".
+     the directories %HOME%, %USERPROFILE% and %SYSTEMROOT% in that order. If
+     all else fails we fall back to C:\.
      [Matt Caswell]
 
   *) The EVP_EncryptUpdate() function has had its return type changed from void
index 19cce2c7a83674732d874486ba7bdd9ffdb3fed1..87cb6c013b40c4f168a693dd30c2a2fcade86d68 100644 (file)
@@ -292,11 +292,9 @@ const char *RAND_file_name(char *buf, size_t size)
          * uses TCHARs, but getenv() gives us chars so its easier to do it this
          * way
          */
-        if ((s = getenv("TMP")) == NULL
-            && (s = getenv("TEMP")) == NULL
-            && (s = getenv("USERPROFILE")) == NULL
-            && (s = getenv("SYSTEMROOT")) == NULL) {
-            s = getenv("HOME");
+        if ((s = getenv("HOME")) == NULL
+            && (s = getenv("USERPROFILE")) == NULL) {
+            s = getenv("SYSTEMROOT");
         }
 #else
         if (OPENSSL_issetugid() == 0)
diff --git a/e_os.h b/e_os.h
index 4951335635866dfd5849c1ca9991db6492b8baa1..eafa8623aabe4ca009c254353636e0310d2add36 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -325,6 +325,8 @@ extern FILE *_imp___iob;
 #   define NO_SYS_PARAM_H
 #   define NO_SYS_UN_H
 
+#   define DEFAULT_HOME "SYS$LOGIN:"
+
 #  else
      /* !defined VMS */
 #   ifdef OPENSSL_UNISTD