diff options
author | Andy Polyakov <appro@openssl.org> | 2016-09-20 16:59:32 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2016-09-21 21:10:07 +0200 |
commit | 098dc9be439e5bc3625e01c4092bedc072498da9 (patch) | |
tree | cc72b73fd66a4937bc14b03111d0c90c10b5aae7 | |
parent | 7b368cd6d964da817cd1de85fc0cae74372e0966 (diff) |
rand/randfile.c: restore fallback to $HOME for non-setuid programs.
Reported in GH#1589, but solution is different from suggested.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 799c1293fcf412db64dcc8a09a6b11cc755914dc)
-rw-r--r-- | crypto/rand/randfile.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 7aeb871743..16cc27aa9b 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -316,12 +316,14 @@ const char *RAND_file_name(char *buf, size_t size) } } #else - if (OPENSSL_issetugid() == 0) { - s = getenv("RANDFILE"); - } else { + if (OPENSSL_issetugid() != 0) { use_randfile = 0; - if (OPENSSL_issetugid() == 0) + } else { + s = getenv("RANDFILE"); + if (s == NULL || *s == '\0') { + use_randfile = 0; s = getenv("HOME"); + } } #endif #ifdef DEFAULT_HOME |