[PATCH] Correction empty shell-field patch

Theo Nolte nolte at post.rwth-aachen.de
Sat Apr 1 09:17:14 EST 2000


Sorry - my previous patch was bad.  Here is the corrected one.

Cheers, Theo
-------------- next part --------------
diff -Naur openssh-1.2.3-dist/sshd.c openssh-1.2.3/sshd.c
--- openssh-1.2.3-dist/sshd.c	Fri Mar 31 23:04:10 2000
+++ openssh-1.2.3/sshd.c	Fri Mar 31 23:24:21 2000
@@ -1121,6 +1121,7 @@
 	struct stat st;
 	struct group *grp;
 	int i;
+	char*shell;
 #ifdef WITH_AIXAUTHENTICATE
 	char *loginmsg;
 #endif /* WITH_AIXAUTHENTICATE */
@@ -1129,8 +1130,9 @@
 	if (!pw)
 		return 0;
 
-	/* deny if shell does not exists or is not executable */
-	if (stat(pw->pw_shell, &st) != 0)
+	/* deny if shell is not executable, empty shell defaults to /bin/sh */
+	shell = pw->pw_shell[0]  ? pw->pw_shell : _PATH_BSHELL;
+	if (stat(shell, &st) != 0)
 		return 0;
 	if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP))))
 		return 0;


More information about the openssh-unix-dev mailing list