Date: Thu, 20 Apr 2000 06:20:04 -0700 (PDT) From: IKEDA Kenji <noroi@mob.or.jp> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/18109: if pw_shell is empty(/bin/sh is assumed), cannot login via ssh. Message-ID: <200004201320.GAA52589@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/18109; it has been noted by GNATS. From: IKEDA Kenji <noroi@mob.or.jp> To: alex@big.endian.de Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: misc/18109: if pw_shell is empty(/bin/sh is assumed), cannot login via ssh. Date: Thu, 20 Apr 2000 22:13:24 +0900 On Thu, 20 Apr 2000 13:31:07 +0200, Alexander Langer <alex@big.endian.de> wrote: > You should add indentation to make your code more readable. Sorry. > What will happen if it is == 0 now? if pw->pw_shell == 0 then ... segmentation violation will happen. if pw->pw_shell[0] == 0 then ... it means /bin/sh. /bin/sh always valid. --- sshd.c.~1~ Thu Apr 20 21:37:40 2000 +++ sshd.c Thu Apr 20 21:47:58 2000 @@ -1211,11 +1211,13 @@ if (!pw) return 0; - /* deny if shell does not exists or is not executable */ - if (stat(pw->pw_shell, &st) != 0) - return 0; - if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) - return 0; + if (pw->pw_shell && pw->pw_shell[0]) { + /* deny if shell does not exists or is not executable */ + if (stat(pw->pw_shell, &st) != 0) + return 0; + if (!((st.st_mode & S_IFREG) && (st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)))) + return 0; + } /* Return false if user is listed in DenyUsers */ if (options.num_deny_users > 0) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004201320.GAA52589>