login: apply PAM environment
login should apply the PAM environment modified by plugins such as pam_env. Other 'login's do a similar thing. I tested this by setting some env variables with pam_env which were correctly applied. Signed-off-by: Ian Wienand <ianw@vmware.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1f937d6468
commit
260fb551ff
@ -217,6 +217,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
const char *failed_msg;
|
const char *failed_msg;
|
||||||
struct passwd pwdstruct;
|
struct passwd pwdstruct;
|
||||||
char pwdbuf[256];
|
char pwdbuf[256];
|
||||||
|
char **pamenv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
username[0] = '\0';
|
username[0] = '\0';
|
||||||
@ -400,6 +401,16 @@ int login_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
(!(opt & LOGIN_OPT_p) * SETUP_ENV_CLEARENV) + SETUP_ENV_CHANGEENV,
|
(!(opt & LOGIN_OPT_p) * SETUP_ENV_CLEARENV) + SETUP_ENV_CHANGEENV,
|
||||||
pw);
|
pw);
|
||||||
|
|
||||||
|
#if ENABLE_PAM
|
||||||
|
/* Modules such as pam_env will setup the PAM environment,
|
||||||
|
* which should be copied into the new environment. */
|
||||||
|
pamenv = pam_getenvlist(pamh);
|
||||||
|
if (pamenv) while (*pamenv) {
|
||||||
|
putenv(*pamenv);
|
||||||
|
pamenv++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
motd();
|
motd();
|
||||||
|
|
||||||
if (pw->pw_uid == 0)
|
if (pw->pw_uid == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user