diff options
author | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 19:37:21 -0800 |
---|---|---|
committer | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 19:39:33 -0800 |
commit | b70316c593cbc8e5c9155e5c6597497090c6eb88 (patch) | |
tree | 389accb2f8d3f4830933235f54059df6d8f51132 /modules/pam_env/pam_env.c | |
parent | aa0448336a79d85579464f023ac87675be60abfc (diff) | |
parent | 08e55be772e8dabf62dc21010751a80ed905f750 (diff) | |
download | pam-b70316c593cbc8e5c9155e5c6597497090c6eb88.tar.gz pam-b70316c593cbc8e5c9155e5c6597497090c6eb88.tar.bz2 pam-b70316c593cbc8e5c9155e5c6597497090c6eb88.zip |
New upstream version 1.1.2
Diffstat (limited to 'modules/pam_env/pam_env.c')
-rw-r--r-- | modules/pam_env/pam_env.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/pam_env/pam_env.c b/modules/pam_env/pam_env.c index 84953104..4e5f6eb3 100644 --- a/modules/pam_env/pam_env.c +++ b/modules/pam_env/pam_env.c @@ -23,6 +23,7 @@ #include <string.h> #include <syslog.h> #include <sys/stat.h> +#include <sys/fsuid.h> #include <sys/types.h> #include <unistd.h> @@ -772,13 +773,14 @@ handle_env (pam_handle_t *pamh, int argc, const char **argv) if(user_readenv && retval == PAM_SUCCESS) { char *envpath = NULL; - struct passwd *user_entry; + struct passwd *user_entry = NULL; const char *username; struct stat statbuf; username = _pam_get_item_byname(pamh, "PAM_USER"); - user_entry = pam_modutil_getpwnam (pamh, username); + if (username) + user_entry = pam_modutil_getpwnam (pamh, username); if (!user_entry) { pam_syslog(pamh, LOG_ERR, "No such user!?"); } @@ -789,7 +791,10 @@ handle_env (pam_handle_t *pamh, int argc, const char **argv) return PAM_BUF_ERR; } if (stat(envpath, &statbuf) == 0) { + uid_t euid = geteuid(); + setfsuid (user_entry->pw_uid); retval = _parse_config_file(pamh, envpath); + setfsuid (euid); if (retval == PAM_IGNORE) retval = PAM_SUCCESS; } |