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

@@ -90,12 +90,9 @@ get_user_file(const ntlm_name target_name,
*domainp = NULL;
if (issuid())
return ENOENT;
domain = target_name != NULL ? target_name->domain : NULL;
fn = getenv("NTLM_USER_FILE");
fn = secure_getenv("NTLM_USER_FILE");
if (fn == NULL)
return ENOENT;
if (from_file(fn, domain, domainp, usernamep, key) == 0)

View File

@@ -64,19 +64,15 @@ get_ccache(krb5_context context, int *destroy, krb5_ccache *id)
krb5_principal principal = NULL;
krb5_error_code ret;
krb5_keytab kt = NULL;
const char *cache = secure_getenv("NTLM_ACCEPTOR_CCACHE");
*id = NULL;
if (!issuid()) {
const char *cache;
cache = getenv("NTLM_ACCEPTOR_CCACHE");
if (cache) {
ret = krb5_cc_resolve(context, cache, id);
if (ret)
goto out;
return 0;
}
if (cache) {
ret = krb5_cc_resolve(context, cache, id);
if (ret)
goto out;
return 0;
}
ret = krb5_sname_to_principal(context, NULL, "host",

View File

@@ -368,8 +368,8 @@ select_mech(OM_uint32 *minor_status, MechType *mechType, int verify_p,
gss_buffer_desc namebuf;
char *str = NULL, *host, hostname[MAXHOSTNAMELEN];
host = getenv("GSSAPI_SPNEGO_NAME");
if (host == NULL || issuid()) {
host = secure_getenv("GSSAPI_SPNEGO_NAME");
if (host == NULL) {
int rv;
if (gethostname(hostname, sizeof(hostname)) != 0) {
*minor_status = errno;