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

@@ -443,10 +443,7 @@ environment_changed(krb5_context context)
strncmp(context->default_cc_name, "API:", 4) == 0))
return 1;
if(issuid())
return 0;
e = getenv("KRB5CCNAME");
e = secure_getenv("KRB5CCNAME");
if (e == NULL) {
if (context->default_cc_name_env) {
free(context->default_cc_name_env);
@@ -518,15 +515,13 @@ krb5_cc_set_default_name(krb5_context context, const char *name)
if (name == NULL) {
const char *e = NULL;
if (!issuid()) {
e = getenv("KRB5CCNAME");
if (e) {
p = strdup(e);
if (context->default_cc_name_env)
free(context->default_cc_name_env);
context->default_cc_name_env = strdup(e);
}
}
e = secure_getenv("KRB5CCNAME");
if (e) {
p = strdup(e);
if (context->default_cc_name_env)
free(context->default_cc_name_env);
context->default_cc_name_env = strdup(e);
}
#ifdef _WIN32
if (p == NULL) {

View File

@@ -577,9 +577,7 @@ krb5_config_parse_file_multi (krb5_context context,
return EPERM;
}
if(!issuid())
home = getenv("HOME");
home = secure_getenv("HOME");
if (home == NULL) {
struct passwd *pw = getpwuid(getuid());
if(pw != NULL)

View File

@@ -254,8 +254,8 @@ init_context_from_config_file(krb5_context context)
tmp = krb5_config_get_string(context, NULL, "libdefaults",
"check-rd-req-server", NULL);
if (tmp == NULL && !issuid())
tmp = getenv("KRB5_CHECK_RD_REQ_SERVER");
if (tmp == NULL)
tmp = secure_getenv("KRB5_CHECK_RD_REQ_SERVER");
if(tmp) {
if (strcasecmp(tmp, "ignore") == 0)
context->flags |= KRB5_CTX_F_RD_REQ_IGNORE;
@@ -864,8 +864,7 @@ krb5_get_default_config_files(char ***pfilenames)
if (pfilenames == NULL)
return EINVAL;
if(!issuid())
files = getenv("KRB5_CONFIG");
files = secure_getenv("KRB5_CONFIG");
#ifdef _WIN32
if (files == NULL) {

View File

@@ -279,8 +279,7 @@ _expand_temp_folder(krb5_context context, PTYPE param, const char *postfix, char
{
const char *p = NULL;
if (!issuid())
p = getenv("TEMP");
p = secure_getenv("TEMP");
if (p)
*ret = strdup(p);

View File

@@ -250,8 +250,7 @@ static const char *default_ktname(krb5_context context)
{
const char *tmp = NULL;
if(!issuid())
tmp = getenv("KRB5_KTNAME");
tmp = secure_getenv("KRB5_KTNAME");
if(tmp != NULL)
return tmp;
return context->default_keytab;