aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <ianw@vmware.com>2010-12-20 11:33:38 -0800
committerDenys Vlasenko <vda.linux@googlemail.com>2010-12-27 02:13:06 +0100
commit260fb551ff4ba0cb8a5fdff848bce10588611231 (patch)
tree268ba74ab461484ee8123ef262ebf21976a01af9
parent1f937d64686d9a71c9325f2e9b23eba235a9255e (diff)
downloadbusybox-260fb551ff4ba0cb8a5fdff848bce10588611231.tar.gz
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>
-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)