From nobody@FreeBSD.org  Thu Apr 20 03:59:34 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 7C53337B851
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Apr 2000 03:59:34 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id DAA37471;
	Thu, 20 Apr 2000 03:59:34 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Message-Id: <200004201059.DAA37471@freefall.freebsd.org>
Date: Thu, 20 Apr 2000 03:59:34 -0700 (PDT)
From: noroi@mob.or.jp
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: if pw_shell is empty(/bin/sh is assumed), cannot login via ssh.
X-Send-Pr-Version: www-1.0

>Number:         18109
>Category:       misc
>Synopsis:       if pw_shell is empty(/bin/sh is assumed), cannot login via ssh.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 20 04:00:01 PDT 2000
>Closed-Date:    Tue Aug 19 03:48:07 PDT 2003
>Last-Modified:  Tue Aug 19 03:48:07 PDT 2003
>Originator:     IKEDA Kenji
>Release:        FreeBSD/i386 4.0-RELEASE
>Organization:
>Environment:
FreeBSD butch.sb.is.dnp.co.jp 4.0-RELEASE FreeBSD 4.0-RELEASE #1: Thu Apr 20 16:31:17 JST 2000     bnateam@butch.sb.is.dnp.co.jp:/usr/src/sys/compile/HASH  i386
>Description:
Whatever pw_shell field is empty, sshd check it.
>How-To-Repeat:
ssh login to the account that has empty pw_shell field.
>Fix:
--- /usr/src/crypto/openssh/sshd.c      Thu Mar  9 23:47:12 2000
+++ sshd.c      Thu Apr 20 19:36:28 2000
@@ -1211,11 +1211,13 @@
 	if (!pw)
 		return 0;
 
+	if (pw->pw_shell[0] != '\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) {


>Release-Note:
>Audit-Trail:

From: Alexander Langer <alex@big.endian.de>
To: noroi@mob.or.jp
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 13:31:07 +0200

 Thus spake noroi@mob.or.jp (noroi@mob.or.jp):
 
 > +	if (pw->pw_shell[0] != '\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;
 > +	}
 
 You should add indentation to make your code more readable.
 
 What will happen if it is == 0 now?
 
 Alex
 
 -- 
 I need a new ~/.sig.
 

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) {
 
Responsible-Changed-From-To: freebsd-bugs->green 
Responsible-Changed-By: dd 
Responsible-Changed-When: Thu May 31 20:11:00 PDT 2001 
Responsible-Changed-Why:  
Over to in-tree OpenSSH maintainer to decide what to do with this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=18109 
Responsible-Changed-From-To: green->des 
Responsible-Changed-By: green 
Responsible-Changed-When: Sat Jul 12 21:10:57 PDT 2003 
Responsible-Changed-Why:  
ssh over to DES 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18109 

From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: misc/18109
Date: Mon, 14 Jul 2003 12:53:05 +0200

 Does this still occur with more recent versions of FreeBSD / OpenSSH?
 
 DES
 --=20
 Dag-Erling Sm=F8rgrav - des@des.no
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Tue Aug 19 03:48:06 PDT 2003 
State-Changed-Why:  
Feedback timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18109 
>Unformatted:
