]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
don't set $MAIL if UsePam=yes
authorDamien Miller <djm@mindrot.org>
Fri, 8 Feb 2019 03:53:35 +0000 (14:53 +1100)
committerDamien Miller <djm@mindrot.org>
Fri, 8 Feb 2019 03:53:35 +0000 (14:53 +1100)
PAM typically specifies the user environment if it's enabled, so don't
second guess. bz#2937; ok dtucker@

session.c

index 4448e6f1f2d9301a53e7a056866f8cd471c6efde..bced1f65a6e957aa13ddf6ebf61c99e3f3c12bb6 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1050,8 +1050,11 @@ do_setup_env(struct ssh *ssh, Session *s, const char *shell)
 # endif /* HAVE_CYGWIN */
 #endif /* HAVE_LOGIN_CAP */
 
-       snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
-       child_set_env(&env, &envsize, "MAIL", buf);
+       if (!options.use_pam) {
+               snprintf(buf, sizeof buf, "%.200s/%.50s",
+                   _PATH_MAILDIR, pw->pw_name);
+               child_set_env(&env, &envsize, "MAIL", buf);
+       }
 
        /* Normal systems set SHELL by default. */
        child_set_env(&env, &envsize, "SHELL", shell);