Date: Sat, 14 Sep 2002 15:16:30 -0700 From: Marcus Reid <marcus@blazingdot.com> To: freebsd-stable@freebsd.org Subject: Problem with pw Message-ID: <20020914221630.GA89292@blazingdot.com>
next in thread | raw e-mail | index | archive | help
Hi:
If you specify a username to pw userdel via the -n option, and the
user doesn't exist but a UID matching the username does, it will
delete the user with that UID instead. Yes, all numeric usernames
are bad, but shouldn't behave strangely.
There is a -u option to specify by UID; this behavior doesn't make
sense. The following code in usr.sbin/pw/pw_user.c is the culprit:
/*
* Determine whether 'n' switch is name or uid - we don't
* really don't really care which we have, but we need to
* know.
*/
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;
}
I think we _do_ care if the 'n' switch is a name or a uid. This just seems
a bit careless :) Simply removing this block entirely should do the trick.
Marcus
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020914221630.GA89292>
