From owner-freebsd-stable Sat Sep 14 15:16:34 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A478E37B400 for ; Sat, 14 Sep 2002 15:16:31 -0700 (PDT) Received: from tin.blazingdot.com (tin.blazingdot.com [207.154.84.81]) by mx1.FreeBSD.org (Postfix) with SMTP id 3494943E6A for ; Sat, 14 Sep 2002 15:16:31 -0700 (PDT) (envelope-from marcus@tin.blazingdot.com) Received: (qmail 15003 invoked by uid 1001); 14 Sep 2002 22:16:30 -0000 Date: Sat, 14 Sep 2002 15:16:30 -0700 From: Marcus Reid To: freebsd-stable@freebsd.org Subject: Problem with pw Message-ID: <20020914221630.GA89292@blazingdot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i Coffee-Level: high Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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