Page MenuHomeFreeBSD

ssh: Pass setusercontext environment variables to child
Needs ReviewPublic

Authored by emaste on Apr 25 2021, 7:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 9:05 AM
Unknown Object (File)
Oct 4 2024, 12:15 AM
Unknown Object (File)
Sep 21 2024, 4:42 PM
Unknown Object (File)
Sep 21 2024, 3:11 PM
Unknown Object (File)
Sep 20 2024, 9:31 PM
Unknown Object (File)
Sep 18 2024, 7:09 PM
Unknown Object (File)
Sep 12 2024, 9:22 PM
Unknown Object (File)
Sep 9 2024, 2:09 AM
Subscribers
None

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste created this revision.

Attempting to merge 8.6p1 to main left me with this diff, need to double-check:

diff -purw --exclude autom4te.cache --exclude config.log --exclude config.status --exclude *.orig --exclude Makefile ./session.c /home/emaste/src/freebsd-git/openssh/crypto/openssh/session.c
--- ./session.c 2021-04-25 15:47:04.170020000 -0400
+++ /home/emaste/src/freebsd-git/openssh/crypto/openssh/session.c       2021-04-23 23:03:42.207136000 -0400
@@ -34,6 +34,7 @@
  */

 #include "includes.h"
+__RCSID("$FreeBSD$");

 #include <sys/types.h>
 #include <sys/param.h>
@@ -1034,11 +1035,8 @@ do_setup_env(struct ssh *ssh, Session *s, const char *
        child_set_env(&env, &envsize, "LOGIN", pw->pw_name);
 #endif
        child_set_env(&env, &envsize, "HOME", pw->pw_dir);
-       if (!options.use_pam) {
-               snprintf(buf, sizeof buf, "%.200s/%.50s",
-                   _PATH_MAILDIR, pw->pw_name);
+       snprintf(buf, sizeof buf, "%.200s/%.50s", _PATH_MAILDIR, pw->pw_name);
                child_set_env(&env, &envsize, "MAIL", buf);
-       }
 #ifdef HAVE_LOGIN_CAP
        child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
        child_set_env(&env, &envsize, "TERM", "su");
@@ -1080,6 +1078,11 @@ do_setup_env(struct ssh *ssh, Session *s, const char *
 # endif /* HAVE_CYGWIN */
 #endif /* HAVE_LOGIN_CAP */

+       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);