Subject: bin/21146: useradd --help
To: None <gnats-bugs@gnats.netbsd.org>
From: Daniel Lamblin <daniell@tnt.toves.net>
List: netbsd-bugs
Date: 04/14/2003 04:09:37
>Number:         21146
>Category:       bin
>Synopsis:       useradd has left the password file locked.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 14 01:10:00 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Lamblin
>Release:        NetBSD 1.6
>Organization:
	netbsd hobbyist
>Environment:
System: NetBSD tnt 1.6 NetBSD 1.6 (PM8500wACARD6260wMX98715AEC) #0: Mon Apr 14 00:10:10 EDT 2003 root@tnt:/usr/src/sys/arch/macppc/compile/PM8500wACARD6260wMX98715AEC macppc
Architecture: powerpc
Machine: macppc
>Description:
	I ran `useradd --help` which didn't work as I expected, but failed
	in such a way as to leave my password file locked.  It also left me
	uncertain as to how to unlock it; it would be nice if it both didn't
	do this, and made a helpful comment about proceeding on foot in case
	of failure.
	I'm supposing I just find and delete the pw_lock file, but do I need
	to worry about anything being in an inconsistant state?
>How-To-Repeat:
	root@tnt:~# adduser --help
	bash: adduser: command not found
	root@tnt:~# useradd --help
	useradd: Warning: home directory `/home/--help' doesn't exist, and -m was not specified
	usage: pwd_mkdb [-BLps] [-d directory] [-u user] file
	useradd: pw_mkdb failed: No such file or directory
	root@tnt:~# userdel --help
	userdel: No such user `--help'
	root@tnt:~# man useradd
	:q
	root@tnt:~# useradd -m -s /usr/pkg/bin/bash friend
	useradd: can't obtain pw_lock: File exists
	root@tnt:~# vipw
	vipw: the passwd file is busy.
	root@tnt:~# echo sigh
	sigh

>Fix:
	Don't pass variables to programs without first checking if they will be
	seen as flags.  Also do more exit code checking, though maybe --help
	exits with 0.
>Release-Note:
>Audit-Trail:
>Unformatted: