summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-07-28 19:53:10 +0000
committermarkm <markm@FreeBSD.org>2001-07-28 19:53:10 +0000
commit3d58155b67c8fd75436d63fdedc5d6220be0e563 (patch)
treef771032ba86ac017c294c6d894e9eaf61a31347d /usr.bin
parent41a519a63dcfea005276c26f61073113b4732293 (diff)
downloadFreeBSD-src-3d58155b67c8fd75436d63fdedc5d6220be0e563.zip
FreeBSD-src-3d58155b67c8fd75436d63fdedc5d6220be0e563.tar.gz
Fix the environment handling:
However, there's still a bug in login.c because you copy the environment *before* the call to pam_open_session, which won't set the necessary variables set by /usr/ports/security/pam_ssh. Submitted by: Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/login/login.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 7d0f24a..3c9f5a1 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -575,18 +575,6 @@ main(argc, argv)
if (!pflag)
environ = envinit;
-#ifdef USE_PAM
- /*
- * Add any environmental variables that the
- * PAM modules may have set.
- */
- if (pamh) {
- environ_pam = pam_getenvlist(pamh);
- if (environ_pam)
- export_pam_environment();
- }
-#endif /* USE_PAM */
-
/*
* PAM modules might add supplementary groups during pam_setcred().
*/
@@ -606,6 +594,17 @@ main(argc, argv)
pam_strerror(pamh, e));
}
+ /*
+ * Add any environmental variables that the
+ * PAM modules may have set.
+ * Call *after* opening session!
+ */
+ if (pamh) {
+ environ_pam = pam_getenvlist(pamh);
+ if (environ_pam)
+ export_pam_environment();
+ }
+
/*
* We must fork() before setuid() because we need to call
* pam_close_session() as root.
OpenPOWER on IntegriCloud