summaryrefslogtreecommitdiffstats
path: root/crypto/openssh
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-06-23 20:22:49 +0000
committerdes <des@FreeBSD.org>2002-06-23 20:22:49 +0000
commit5375a0a2adcec7959d1abc09c1a4d7a539097170 (patch)
treedbfcabee9140edcffc3f4c3888c545566d6c0e10 /crypto/openssh
parent1c007d522a4a60d6c5eaabfec5d8dd7b5b1f2936 (diff)
downloadFreeBSD-src-5375a0a2adcec7959d1abc09c1a4d7a539097170.zip
FreeBSD-src-5375a0a2adcec7959d1abc09c1a4d7a539097170.tar.gz
Correctly export the environment variables set by setusercontext().
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'crypto/openssh')
-rw-r--r--crypto/openssh/session.c12
-rw-r--r--crypto/openssh/session.h3
2 files changed, 7 insertions, 8 deletions
diff --git a/crypto/openssh/session.c b/crypto/openssh/session.c
index 2992794..3cd12d4 100644
--- a/crypto/openssh/session.c
+++ b/crypto/openssh/session.c
@@ -667,10 +667,11 @@ do_login(Session *s, const char *command)
time_t warntime = DEFAULT_WARN;
#endif /* __FreeBSD__ */
-#ifndef USE_PAM
+#ifdef USE_PAM
/*
* Let PAM handle utmp / wtmp.
*/
+#else
/*
* Get IP address of client. If the connection is not a socket, let
* the address be 0.0.0.0.
@@ -1048,9 +1049,6 @@ do_setup_env(char **env, Session *s, const char *shell)
if (s->ttyfd != -1)
child_set_env(&env, &envsize, "SSH_TTY", s->tty);
if (s->term)
-#ifdef HAVE_LOGIN_CAP
- if (options.use_login)
-#endif /* HAVE_LOGIN_CAP */
child_set_env(&env, &envsize, "TERM", s->term);
if (s->display)
child_set_env(&env, &envsize, "DISPLAY", s->display);
@@ -1183,7 +1181,7 @@ do_nologin(struct passwd *pw)
}
/* Set login name, uid, gid, and groups. */
-void
+char **
do_setusercontext(struct passwd *pw)
{
char **env = NULL;
@@ -1243,7 +1241,7 @@ do_setusercontext(struct passwd *pw)
if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid)
fatal("Failed to set uids to %u.", (u_int) pw->pw_uid);
#endif /* HAVE_LOGIN_CAP */
- return;
+ return env;
}
static void
@@ -1292,7 +1290,7 @@ do_child(Session *s, const char *command)
*/
if (!options.use_login) {
do_nologin(pw);
- do_setusercontext(pw);
+ env = do_setusercontext(pw);
}
/*
diff --git a/crypto/openssh/session.h b/crypto/openssh/session.h
index 2a7e4b2..2c8b60e 100644
--- a/crypto/openssh/session.h
+++ b/crypto/openssh/session.h
@@ -1,4 +1,5 @@
/* $OpenBSD: session.h,v 1.17 2002/03/29 18:59:32 markus Exp $ */
+/* $FreeBSD$ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -67,5 +68,5 @@ void session_pty_cleanup2(void *);
Session *session_new(void);
Session *session_by_tty(char *);
void session_close(Session *);
-void do_setusercontext(struct passwd *);
+char **do_setusercontext(struct passwd *);
#endif
OpenPOWER on IntegriCloud