[Bug 453] New: [PATCH] The SHELL env variable is set incorrectly, when shell is overridden from login.conf.

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sat Dec 7 13:27:56 EST 2002


http://bugzilla.mindrot.org/show_bug.cgi?id=453

           Summary: [PATCH] The SHELL env variable is set incorrectly, when
                    shell is overridden from login.conf.
           Product: Portable OpenSSH
           Version: 3.5p1
          Platform: All
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sshd
        AssignedTo: openssh-unix-dev at mindrot.org
        ReportedBy: semen at online.sinor.ru


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)



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the openssh-unix-dev mailing list