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>
const char *failed_msg;
struct passwd pwdstruct;
char pwdbuf[256];
+ char **pamenv;
#endif
username[0] = '\0';
(!(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)