From newton@atdot.dotat.org  Tue Mar 14 06:00:30 2000
Return-Path: <newton@atdot.dotat.org>
Received: from atdot.dotat.org (atdot.dotat.org [150.101.89.3])
	by hub.freebsd.org (Postfix) with ESMTP id 7969837B768
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Mar 2000 06:00:27 -0800 (PST)
	(envelope-from newton@atdot.dotat.org)
Received: (from newton@localhost)
	by atdot.dotat.org (8.9.3/8.9.3) id AAA62460;
	Wed, 15 Mar 2000 00:30:43 +1030 (CST)
	(envelope-from newton)
Message-Id: <200003141400.AAA62460@atdot.dotat.org>
Date: Wed, 15 Mar 2000 00:30:43 +1030 (CST)
From: Mark Newton <newton@atdot.dotat.org>
Reply-To: newton@atdot.dotat.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: rmuser bug
X-Send-Pr-Version: 3.2

>Number:         17372
>Category:       bin
>Synopsis:       rmuser(8) incorrectly identifies non-alphanum characters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    newton
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 14 06:10:02 PST 2000
>Closed-Date:    Tue Mar 14 06:30:56 PST 2000
>Last-Modified:  Tue Mar 14 06:33:12 PST 2000
>Originator:     Mark Newton
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
None
>Environment:

	FreeBSD-current

>Description:

	rmuser complains about non-alphanumeric characters if the
	username you attempt to delete contains capital letters.  This
	causes problems for sites which attempt to call PPP users
	"Pfoo" and SLIP users "Sfoo" (such as an ISP run by a friend
	of mine :-)

>How-To-Repeat:

	bsd# rmuser Pfoo

>Fix:

	I'm happy to commit this myself;  just getting it into the PR
	system so that anyone else who searches for it later will see
	that it has been fixed on this date.

	I'll commit it later tonight then close the PR.

*** /usr/sbin/rmuser	Fri Mar  3 08:53:25 2000
--- rmuser.perl	Wed Mar 15 00:25:51 2000
***************
*** 108,114 ****
      # Username was given as a parameter
      $login_name = pop(@ARGV);
      die "Sorry, login name must contain alphanumeric characters only.\n"
! 	if ($login_name !~ /^[a-z0-9_][a-z0-9_\-]*$/);
  } else {
      if ($affirm) {
  	print STDERR "${whoami}: Error: -y option given without username!\n";
--- 108,114 ----
      # Username was given as a parameter
      $login_name = pop(@ARGV);
      die "Sorry, login name must contain alphanumeric characters only.\n"
! 	if ($login_name !~ /^[a-zA-Z0-9_]{1,}$/);
  } else {
      if ($affirm) {
  	print STDERR "${whoami}: Error: -y option given without username!\n";


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->newton 
Responsible-Changed-By: newton 
Responsible-Changed-When: Tue Mar 14 06:15:57 PST 2000 
Responsible-Changed-Why:  
Taking responsibility for my own PR 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: newton@atdot.dotat.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/17372: rmuser bug 
Date: Tue, 14 Mar 2000 16:18:51 +0200

 On Wed, 15 Mar 2000 00:30:43 +1030, Mark Newton wrote:
 
 > 	I'll commit it later tonight then close the PR.
 
 Slow down. :-)
 
 > ! 	if ($login_name !~ /^[a-z0-9_][a-z0-9_\-]*$/);
 > ! 	if ($login_name !~ /^[a-zA-Z0-9_]{1,}$/);
 
 Look at what you're doing.  Before, usernames had to start with a
 non-numeric character.  You've changed more than you meant to. :-)
 
 Try this:
 
 	if ($login_name !~ /^[a-z0-9_]\w*$/);
 
 Ciao,
 Sheldon.
 
State-Changed-From-To: open->closed 
State-Changed-By: newton 
State-Changed-When: Tue Mar 14 06:30:56 PST 2000 
State-Changed-Why:  
Fix committed - rev 1.10 of usr.sbin/adduser/rmuser.perl 
>Unformatted:

 Sheldon's fixup needed a fixup too.  The regex that was eventually
 committed was /^[a-zA-Z0-9_]\w*$/ in rev 1.10 of usr.sbin/adduser/rmuser.perl
