Bug 453 - [PATCH] The SHELL env variable is set incorrectly, when shell is overridden from login.conf.
Summary: [PATCH] The SHELL env variable is set incorrectly, when shell is overridden f...
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: -current
Hardware: All FreeBSD
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-07 13:27 AEDT by Semen A. Ustimenko
Modified: 2004-04-14 12:24 AEST (History)
0 users

See Also:


Attachments
The patch got mangled in the original bug report, here is the correct version. (767 bytes, patch)
2002-12-09 22:50 AEDT, Semen A. Ustimenko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Semen A. Ustimenko 2002-12-07 13:27:55 AEDT
According to the login.conf(5), the SHELL variable must contain the value from
passwd file, regardless it may be overridden in the login class. The sshd
currently missbehaves, it sets the SHELL to the program it actually executes.

Fix: 

--- ssh/session.c.orig2	Sat Dec  7 07:48:46 2002
+++ ssh/session.c	Sat Dec  7 07:57:16 2002
@@ -1325,11 +1325,19 @@
 	 * legal, and means /bin/sh.
 	 */
 	shell = (pw->pw_shell[0] == '\0') ? _PATH_BSHELL : pw->pw_shell;
+
+
/* Set up the environment for child */
+
env = do_setup_env(s, shell);
+
+
/*
+
 * The shell specifed in login class overrides the shell in passwd,
+
 * but, according to the login.conf(5), the SHELL env variable must
+
 * contain the value from passwd, so we do this *after* setting up
+
 * child's environment.
+
 */
 #ifdef HAVE_LOGIN_CAP
 	shell = login_getcapstr(lc, "shell", (char *)shell, (char *)shell);
 #endif
-
-
env = do_setup_env(s, shell);
 
 	/* we have to stash the hostname before we close our socket. */
 	if (options.use_login)
Comment 1 Semen A. Ustimenko 2002-12-09 22:50:54 AEDT
Created attachment 184 [details]
The patch got mangled in the original bug report, here is the correct version.
Comment 2 Markus Friedl 2002-12-10 20:01:24 AEDT
thanks, patch applied. 
Comment 3 Damien Miller 2004-04-14 12:24:18 AEST
Mass change of RESOLVED bugs to CLOSED