summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-04-20 05:44:36 +0000
committerache <ache@FreeBSD.org>2002-04-20 05:44:36 +0000
commit4c135df5a2fa28715ba1c65b9499d9ab8d2f808d (patch)
tree24ae0d3b86a6cee790483850fcd71b9fde36364f /crypto
parent27118745cb8bb9225fc099a76a3a37c236678dde (diff)
downloadFreeBSD-src-4c135df5a2fa28715ba1c65b9499d9ab8d2f808d.zip
FreeBSD-src-4c135df5a2fa28715ba1c65b9499d9ab8d2f808d.tar.gz
1) Fix overlook in my prev. commit - forget HAVE_ prefix in one place in old
code merge. 2) In addition honor "timezone" and "term" capabilities from login.conf, not overwrite them once they set (they are TZ and TERM variables).
Diffstat (limited to 'crypto')
-rw-r--r--crypto/openssh/session.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/crypto/openssh/session.c b/crypto/openssh/session.c
index 8e6f300..26612d4 100644
--- a/crypto/openssh/session.c
+++ b/crypto/openssh/session.c
@@ -967,19 +967,21 @@ do_setup_env(char **env, Session *s, const char *shell)
child_set_env(&env, &envsize, "USER", pw->pw_name);
child_set_env(&env, &envsize, "LOGNAME", pw->pw_name);
child_set_env(&env, &envsize, "HOME", pw->pw_dir);
-#ifndef LOGIN_CAP
+#ifndef HAVE_LOGIN_CAP
child_set_env(&env, &envsize, "PATH", _PATH_STDPATH);
snprintf(buf, sizeof buf, "%.200s/%.50s",
_PATH_MAILDIR, pw->pw_name);
child_set_env(&env, &envsize, "MAIL", buf);
-#endif /* !LOGIN_CAP */
+#endif /* !HAVE_LOGIN_CAP */
/* Normal systems set SHELL by default. */
child_set_env(&env, &envsize, "SHELL", shell);
}
+#ifndef HAVE_LOGIN_CAP
if (getenv("TZ"))
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#endif /* !HAVE_LOGIN_CAP */
/* Set custom environment options from RSA authentication. */
if (!options.use_login) {
@@ -1005,8 +1007,10 @@ do_setup_env(char **env, Session *s, const char *shell)
if (s->ttyfd != -1)
child_set_env(&env, &envsize, "SSH_TTY", s->tty);
+#ifndef HAVE_LOGIN_CAP
if (s->term)
child_set_env(&env, &envsize, "TERM", s->term);
+#endif /* !HAVE_LOGIN_CAP */
if (s->display)
child_set_env(&env, &envsize, "DISPLAY", s->display);
if (original_command)
@@ -1139,7 +1143,7 @@ do_nologin(struct passwd *pw)
/* Set login name, uid, gid, and groups. */
static char **
-do_setusercontext(struct passwd *pw)
+do_setusercontext(struct passwd *pw, Session *s)
{
char **env = NULL;
#ifdef HAVE_LOGIN_CAP
@@ -1164,6 +1168,9 @@ do_setusercontext(struct passwd *pw)
if (getenv("TZ"))
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+ if (s->term)
+ child_set_env(&env, &envsize, "TERM", s->term);
+
/* Save parent environment */
tmpenv = environ;
/* Switch to env */
@@ -1229,7 +1236,7 @@ do_child(Session *s, const char *command)
*/
if (!options.use_login) {
do_nologin(pw);
- env = do_setusercontext(pw);
+ env = do_setusercontext(pw, s);
}
/*
OpenPOWER on IntegriCloud