From nobody  Thu Jan 14 00:41:03 1999
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id AAA09021;
          Thu, 14 Jan 1999 00:41:03 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199901140841.AAA09021@hub.freebsd.org>
Date: Thu, 14 Jan 1999 00:41:03 -0800 (PST)
From: merlin@ghostwheel.com
To: freebsd-gnats-submit@freebsd.org
Subject: False error while adding a user, whose uid begins with a number, via sysinstall
X-Send-Pr-Version: www-1.0

>Number:         9484
>Category:       bin
>Synopsis:       False error while adding a user, whose uid begins with a number, via sysinstall
>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 Jan 14 00:50:01 PST 1999
>Closed-Date:    Tue Feb 9 07:12:18 PST 1999
>Last-Modified:  Tue Feb  9 07:12:32 PST 1999
>Originator:     Christopher Knight
>Release:        3.0-current (cvsup'd on 01/10/99)
>Organization:
Bohemian Adventurer
>Environment:
FreeBSD shadows.ghostwheel.com 3.0-CURRENT FreeBSD 3.0-CURRENT #9: Sun Jan 10 10:43:20 PST 1999 merlin@shadows.ghostwheel.com:/usr/src/sys/compile/SHADOWS  i386
>Description:
I was trying to add a user named '2grnflcn' to my system via
/stand/sysinstall and was given the error that this user already exists.

Harold Gutch <logix@foobar.franken.de> followed up on my mailing to the 
freebsd-current mailing list with the following information:

> The error is somewhere in pw(8) - from a quick point of view it
> seems as if pw will assume that a user with a loginname starting
> with a digit has that UID, so in your case pw (which is called by
> sysinstall) found that the user you specified already existed and
> had the the UID 2.
> This clearly is a bug, you might file a PR on this topic.
>How-To-Repeat:
Attemt to use /stand/sysinstall to create a user whose username begins 
with the digits of a UID that already exists.  ie '2blowup' '9mine' etc.
>Fix:

>Release-Note:
>Audit-Trail:

From: "Matthew D. Fuller" <fullermd@futuresouth.com>
To: merlin@ghostwheel.com, freebsd-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/9484: False error while adding a user, whose uid begins with a number, via sysinstall
Date: Thu, 14 Jan 1999 04:27:37 -0600

 This patch appears (from the testing I've done on a -CURRENT system here)
 to work.  I think the formatting might not make it past that custom bde
 filter CVS seems to use ;)   but functionally it looks sound to me.
 
 Index: pw_user.c
 ===================================================================
 RCS file: /usr/cvs/src/usr.sbin/pw/pw_user.c,v
 retrieving revision 1.25
 diff -u -r1.25 pw_user.c
 --- pw_user.c	1999/01/04 14:07:53	1.25
 +++ pw_user.c	1999/01/14 10:15:23
 @@ -291,7 +291,9 @@
  		 * really don't really care which we have, but we need to
  		 * know.
  		 */
 -		if (mode != M_ADD && pwd == NULL && isdigit(*a_name->val) && atoi(a_name->val) > 0) {	/* Assume uid */
 +		if (mode != M_ADD && pwd == NULL
 +			&& (strspn(a_name->val, "0123456789") == strlen(a_name->val))
 +			&& atoi(a_name->val) > 0) {	/* Assume uid */
  			(a_uid = a_name)->ch = 'u';
  			a_name = NULL;
  		}
 
 
 ---
 
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
 | Matthew Fuller     http://www.over-yonder.net/~fullermd |
 * fullermd@futuresouth.com       fullermd@over-yonder.net *
 | UNIX Systems Administrator      Specializing in FreeBSD |
 *   FutureSouth Communications   ISPHelp ISP Consulting   *
 |  "The only reason I'm burning my candle at both ends,   |
 *     because I haven't figured out how to light the      *
 |                     middle yet"                         |
 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
State-Changed-From-To: open->feedback 
State-Changed-By: des 
State-Changed-When: Mon Feb 8 13:32:51 PST 1999 
State-Changed-Why:  
Fixed in -current 


Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Mon Feb 8 13:32:51 PST 1999 
Responsible-Changed-Why:  
So I remember to MFC 
State-Changed-From-To: feedback->closed 
State-Changed-By: des 
State-Changed-When: Tue Feb 9 07:12:18 PST 1999 
State-Changed-Why:  
MFC. 
>Unformatted:
