Use secure_getenv() instead of issuid()

This commit is contained in:
Nicolas Williams
2017-04-17 16:43:32 -05:00
committed by Viktor Dukhovni
parent cf4efe8de6
commit 7dfad1ab0b
13 changed files with 44 additions and 69 deletions

View File

@@ -818,18 +818,16 @@ func_not_supported(void)
static char *
get_config_file_for_user(void)
{
char *fn = NULL;
char *fn;
#ifndef _WIN32
char *home = NULL;
char *home;
int ret;
if (!issuid()) {
fn = getenv("SOFTPKCS11RC");
if (fn)
fn = strdup(fn);
home = getenv("HOME");
}
fn = secure_getenv("SOFTPKCS11RC");
if (fn)
fn = strdup(fn);
home = secure_getenv("HOME");
if (fn == NULL && home == NULL) {
struct passwd *pw = getpwuid(getuid());
if(pw != NULL)