| Summary: | rmuser xyz reports incorrect error message if xyz does not exist | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | dan <dan> | ||||
| Component: | bin | Assignee: | Adrian Chadd <adrian> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Here is the patch. Thanks to Anton Berezin <tobez@tobez.org> :-) mux -- Don't be fooled by cheap finnish imitations ; BSD is the One True Code Key fingerprint = F9B6 1D5A 4963 331C 88FC CA6A AB50 1EF2 8CBE 99D6 Public Key : http://www.epita.fr/~henrio_m/ Responsible Changed From-To: freebsd-bugs->adrian I'll take this one over, since I have my fingers in the adduser code atm State Changed From-To: open->closed Commited in HEAD: rev 1.16 commited in RELENG_4: rev 1.8.2.4 |
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 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; } 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. #