aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/login.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index 9a624df9a..c285b45a1 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -217,6 +217,7 @@ int login_main(int argc UNUSED_PARAM, char **argv)
const char *failed_msg;
struct passwd pwdstruct;
char pwdbuf[256];
+ char **pamenv;
#endif
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,
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();
if (pw->pw_uid == 0)