Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2001 08:47:23 -0700 (PDT)
From:      dan@freebsddiary.org
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/26674: rmuser xyz reports incorrect error message if xyz does not exist
Message-ID:  <200104181547.f3IFlNx24895@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         26674
>Category:       bin
>Synopsis:       rmuser xyz reports incorrect error message if xyz does not exist
>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 Apr 18 08:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dan Langille
>Release:        4.3-BETA
>Organization:
The FreeBSD Diary / FreshPorts
>Environment:
FreeBSD ns1.unixathome.org 4.3-BETA FreeBSD 4.3-BETA #1: Tue Mar 13 16:03:23 NZD
T 2001     root@xeon.int.nz.freebsd.org:/usr/obj/usr/src/sys/DUCKY  i386
>Description:
if you use rmuser to remove a user which does not exist, the message is:

/usr/sbin/rmuser: Error: I'd rather not remove a user with a uid of 0.

The message should be:

/usr/sbin/rmuser: Error: User xyz not in password database
>How-To-Repeat:
Remove a user which does not exist

# grep xyz /etc/passwd
# rmuser xyz
/usr/sbin/rmuser: Error: I'd rather not remove a user with a uid of 0.
#
>Fix:
The problem appears to be with the return value from getpwnam.  Here's
some code from /usr/sbin/rmuser.  mux is hunting around for more info.

($name, $password, $uid, $gid, $change, $class, $gecos, $home_dir, $shell) =
    (getpwnam("$login_name"));

if ($?) {
    print STDERR "${whoami}: Error: User ${login_name} not in password database\
    &unlockpw;
    exit 1;
}

if ($uid == 0) {
    print "${whoami}: Error: I'd rather not remove a user with a uid of 0.\n";
    &unlockpw;
    exit 1;
}
>Release-Note:
>Audit-Trail:
>Unformatted:

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?200104181547.f3IFlNx24895>