From: Damien Miller Date: Fri, 8 Feb 2019 03:53:35 +0000 (+1100) Subject: don't set $MAIL if UsePam=yes X-Git-Tag: V_8_0_P1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ff2e19653b8c0798b8b8eff209651bdb1be2761;p=thirdparty%2Fopenssh-portable.git don't set $MAIL if UsePam=yes PAM typically specifies the user environment if it's enabled, so don't second guess. bz#2937; ok dtucker@ --- diff --git a/session.c b/session.c index 4448e6f1f..bced1f65a 100644 --- 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);