Use roken_get_*() instead of getpwuuid()
Using non-reentrant getpwuid() (or getpwnam(), or getspnam()) can be dangerous. We had a report of a login application / PAM that calls those, and Heimdal, by calling them too, clobbered the cached struct passwd used by the login app / PAM.
This commit is contained in:

committed by
Nico Williams

parent
95eb83c424
commit
620862049e
@@ -569,6 +569,7 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
if (ISTILDE(fname[0]) && ISPATHSEP(fname[1])) {
|
||||
#ifndef KRB5_USE_PATH_TOKENS
|
||||
const char *home = NULL;
|
||||
char homebuf[MAX_PATH];
|
||||
|
||||
if (!_krb5_homedir_access(context)) {
|
||||
context->config_include_depth--;
|
||||
@@ -577,12 +578,7 @@ krb5_config_parse_file_multi (krb5_context context,
|
||||
return EPERM;
|
||||
}
|
||||
|
||||
home = secure_getenv("HOME");
|
||||
if (home == NULL) {
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
if(pw != NULL)
|
||||
home = pw->pw_dir;
|
||||
}
|
||||
home = roken_get_appdatadir(homebuf, sizeof(homebuf));
|
||||
if (home) {
|
||||
int aret;
|
||||
|
||||
|
Reference in New Issue
Block a user