diff options
author | Balint Reczey <balint.reczey@canonical.com> | 2019-06-23 22:06:37 +0200 |
---|---|---|
committer | Balint Reczey <balint.reczey@canonical.com> | 2019-06-23 22:06:37 +0200 |
commit | b28d45d2bd2462414b9dbbe38e6c7f3d5f7b462b (patch) | |
tree | 4b068e3513ef5c60228cddfcda72be0a31d09b14 /src/su.c | |
parent | b0729855e8fb744192a0395ea24673557818172c (diff) | |
download | shadow-b28d45d2bd2462414b9dbbe38e6c7f3d5f7b462b.tar.gz |
New upstream version 4.7upstream/4.7
Diffstat (limited to 'src/su.c')
-rw-r--r-- | src/su.c | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -913,27 +913,7 @@ static void set_environment (struct passwd *pw) addenv ("IFS= \t\n", NULL); /* ... instead, set a safe IFS */ } -#ifdef USE_PAM - /* we need to setup the environment *after* pam_open_session(), - * else the UID is changed before stuff like pam_xauth could - * run, and we cannot access /etc/shadow and co - */ - environ = newenvp; /* make new environment active */ - - if (change_environment) { - /* update environment with all pam set variables */ - char **envcp = pam_getenvlist (pamh); - if (NULL != envcp) { - while (NULL != *envcp) { - addenv (*envcp, NULL); - envcp++; - } - } - } - -#else /* !USE_PAM */ environ = newenvp; /* make new environment active */ -#endif /* !USE_PAM */ if (change_environment) { if (fakelogin) { @@ -948,6 +928,21 @@ static void set_environment (struct passwd *pw) addenv ("LOGNAME", pw->pw_name); addenv ("SHELL", shellstr); } + +#ifdef USE_PAM + /* we need to setup the environment *after* pam_open_session(), + * else the UID is changed before stuff like pam_xauth could + * run, and we cannot access /etc/shadow and co + */ + /* update environment with all pam set variables */ + char **envcp = pam_getenvlist (pamh); + if (NULL != envcp) { + while (NULL != *envcp) { + addenv (*envcp, NULL); + envcp++; + } + } +#endif /* !USE_PAM */ } } |