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>
This commit is contained in:
Andy Polyakov 2016-09-20 16:59:32 +02:00
parent 776e15f939
commit 799c1293fc

View File

@ -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