From nobody@FreeBSD.org  Wed Oct  2 07:26:51 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C9E1137B401
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Oct 2002 07:26:51 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 78CA843E6E
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Oct 2002 07:26:51 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g92EQo7R033785
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 2 Oct 2002 07:26:50 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g92EQo5q033784;
	Wed, 2 Oct 2002 07:26:50 -0700 (PDT)
Message-Id: <200210021426.g92EQo5q033784@www.freebsd.org>
Date: Wed, 2 Oct 2002 07:26:50 -0700 (PDT)
From: Dan Pelleg <daniel+gnats@pelleg.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: passwd(1) fails on nonexistent users
X-Send-Pr-Version: www-1.0

>Number:         43582
>Category:       bin
>Synopsis:       [patch] passwd(1) fails on nonexistent users
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 02 07:30:02 PDT 2002
>Closed-Date:    
>Last-Modified:  Sat Jun 16 00:01:37 GMT 2007
>Originator:     Dan Pelleg
>Release:        4.6
>Organization:
>Environment:
FreeBSD l 4.6.1-RELEASE-p10 FreeBSD 4.6.1-RELEASE-p10 #2: Tue Aug  6 11:24:27 EDT 2002 i386
>Description:
when passwd(1) is called with an argument that's not a valid user, it seg faults.
>How-To-Repeat:
passwd -u root

note: -u is not a valid flag in the manpage. It is mentioned in the usage line back from "passwd -u". In any case, root is not a "full name".
>Fix:
      
>Release-Note:
>Audit-Trail:

From: Ceri Davies <ceri@FreeBSD.org>
To: Dan Pelleg <daniel+gnats@pelleg.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/43582: passwd(1) fails on nonexistent users
Date: Wed, 2 Oct 2002 17:02:21 +0100

 On Wed, Oct 02, 2002 at 07:26:50AM -0700, Dan Pelleg wrote:
 
 This doesn't seem to be a problem with the current release:
 
 {setantae@rhadamanth}-{~} $ uname -sr
 FreeBSD 4.7-RC
 {setantae@rhadamanth}-{~} $ passwd -u root
 passwd: illegal option -- u
 usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]
 {setantae@rhadamanth}-{~} $ su
 Password:
 {root@rhadamanth}-{/home/setantae} # passwd -u root
 passwd: illegal option -- u
 usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]
 
 Could you try updating and see if this fixes the problem ?
 
 Ceri
 
 -- 
 you can't see when light's so strong
 you can't see when light is gone
State-Changed-From-To: open->feedback 
State-Changed-By: ceri 
State-Changed-When: Wed Oct 2 10:04:58 PDT 2002 
State-Changed-Why:  
Problem doesn't seem to exist in -stable. 
Have asked submitter to try updating. 

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

From: Peter Pentchev <roam@ringlet.net>
To: Ceri Davies <ceri@FreeBSD.org>
Cc: Dan Pelleg <daniel+gnats@pelleg.org>, bug-followup@FreeBSD.org
Subject: Re: bin/43582: passwd(1) fails on nonexistent users
Date: Wed, 2 Oct 2002 20:57:03 +0300

 On Wed, Oct 02, 2002 at 09:30:05AM -0700, Ceri Davies wrote:
 > The following reply was made to PR bin/43582; it has been noted by GNATS.
 >=20
 > From: Ceri Davies <ceri@FreeBSD.org>
 > To: Dan Pelleg <daniel+gnats@pelleg.org>
 > Cc: freebsd-gnats-submit@FreeBSD.org
 > Subject: Re: bin/43582: passwd(1) fails on nonexistent users
 > Date: Wed, 2 Oct 2002 17:02:21 +0100
 >=20
 >  On Wed, Oct 02, 2002 at 07:26:50AM -0700, Dan Pelleg wrote:
 > =20
 >  This doesn't seem to be a problem with the current release:
 > =20
 >  {setantae@rhadamanth}-{~} $ uname -sr
 >  FreeBSD 4.7-RC
 >  {setantae@rhadamanth}-{~} $ passwd -u root
 >  passwd: illegal option -- u
 
 A quick look at src/usr.bin/passwd/passwd.c seems to show that the -u
 option is only valid for a YP && KERBEROS build of passwd(1).  If you
 have customized your /etc/make.conf to *not* include MAKE_KERBEROS4=3Dyes,
 your passwd(1) will not recognize -u.
 
 Apparently, releases are built with support for both krb4 and krb5, thus
 the passwd(1) binary in the official release will recognize -u.
 
 G'luck,
 Peter
 
 --=20
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 If you think this sentence is confusing, then change one pig.
State-Changed-From-To: feedback->open 
State-Changed-By: ceri 
State-Changed-When: Wed Oct 2 11:19:15 PDT 2002 
State-Changed-Why:  
Throw this back open. 
The -u option is dependent on Kerberos support which I don't have. 

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

From: Dan Pelleg <daniel+gnats@pelleg.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/43582: passwd(1) fails on nonexistent users
Date: Sat, 19 Oct 2002 11:50:58 -0400

 I'd have loved to post a patch, but my library debugging skills are not up
 to it. 
 
 FWIW, the best I could come up with is that the getpwnam call in line 201
 of src/usr.bin/passwd/local_passwd.c does not seem to fail, but rather
 returns a passwd struct with empty pw_name and zero pw_uid.
 
 I wasn't able to track down any deeper, except for realizing the problem is
 probably "somewhere in _getyppass".
 
 System is compiled with YP and KERBEROS.

From: Dan Pelleg <daniel+gnats@pelleg.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/43582: [PATCH] passwd(1) fails on nonexistent users
Date: Sat, 19 Oct 2002 19:43:28 -0400

 --CUexkwujC7
 Content-Type: text/plain; charset=us-ascii
 Content-Description: message body text
 Content-Transfer-Encoding: 7bit
 
 
 Ok, I figured it out.
 IF you set (just) the -u flag,
 AND have YP and KERBEROS
 AND the user is not in Kerberos,
 then the fallback to local_passwd(uname) is reached
 without use_yp having been called first. This will cause
 local_passwd() to fail.
 
 A patch follows.
 
 
 
 --CUexkwujC7
 Content-Type: application/octet-stream
 Content-Disposition: attachment;
 	filename="passwd.patch"
 Content-Transfer-Encoding: base64
 
 LS0tIHVzci5iaW4vcGFzc3dkL3Bhc3N3ZC5jCVNhdCBPY3QgMTkgMTk6NDI6NDUgMjAwMgor
 KysgdXNyLmJpbi9wYXNzd2QvcGFzc3dkLmMub3JpZwlTYXQgT2N0IDE5IDE5OjAyOjQ5IDIw
 MDIKQEAgLTIyMCwxMyArMjIwLDYgQEAKIAkJCWZwcmludGYoc3RkZXJyLCAicmVhbG0gJXNc
 biIsIHJlYWxtKTsKIAkJCWV4aXQoa3JiX3Bhc3N3ZChhcmd2WzBdLCBpZmxhZywgcmZsYWcs
 IHVmbGFnKSk7CiAJCX0KLSNpZmRlZiBZUAotCQkvKgotCQkgKiBBcyB3ZSBmYWxsIGJhY2sg
 dG8gbG9jYWxfcGFzc3dkLCB3ZSBuZWVkIHRvIG1ha2Ugc3VyZSB0aGF0Ci0JCSAqIHRoZSBs
 b2NhbF9wYXNzd29yZCBzdHJ1Y3QgaXMgaW5pdGlhbGl6ZWQuCi0JCSAqLwotCQl1c2VfeXAo
 dW5hbWUsIDAsIDApOwotI2VuZGlmCiAjZW5kaWYKIAl9CiAJZXhpdChsb2NhbF9wYXNzd2Qo
 dW5hbWUpKTsK
 
 --CUexkwujC7--
State-Changed-From-To: open->feedback 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 23:12:54 PDT 2003 
State-Changed-Why:  
Can you please resubmit that patch in ascii format, not 
in base64 encoding? 

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

From: Dan Pelleg <daniel@pelleg.org>
To: Kris Kennaway <kris@FreeBSD.org>,
	freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/43582: passwd(1) fails on nonexistent users
Date: Tue, 15 Jul 2003 18:25:22 -0400

 [resend, seems the first one was lost]
 
 Here is the base-64 decoding of it. Since submitting this I lost the
 ability to easily trigger the condition or test the patch. It also seems
 the patch is reversed.
 
 --- usr.bin/passwd/passwd.c     Sat Oct 19 19:42:45 2002
 +++ usr.bin/passwd/passwd.c.orig        Sat Oct 19 19:02:49 2002
 @@ -220,13 +220,6 @@
                         fprintf(stderr, "realm %s\n", realm);
                         exit(krb_passwd(argv[0], iflag, rflag, uflag));
                 }
 -#ifdef YP
 -               /*
 -                * As we fall back to local_passwd, we need to make sure that
 -                * the local_password struct is initialized.
 -                */
 -               use_yp(uname, 0, 0);
 -#endif
  #endif
         }
         exit(local_passwd(uname));
 
 
State-Changed-From-To: feedback->open 
State-Changed-By: kris 
State-Changed-When: Fri Aug 15 20:22:25 PDT 2003 
State-Changed-Why:  
Requested feedback received 

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