Date: Thu, 27 Sep 2012 09:39:15 GMT From: "Ilya A. Arkhipov" <rum1cro@yandex.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/172112: [patch] Fix for incorrect work: pw user show 0 Message-ID: <201209270939.q8R9dFgx032670@red.freebsd.org> Resent-Message-ID: <201209270940.q8R9e8pG019578@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 172112
>Category: bin
>Synopsis: [patch] Fix for incorrect work: pw user show 0
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Sep 27 09:40:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Ilya A. Arkhipov
>Release: CURRENT
>Organization:
Luxoft
>Environment:
FreeBSD gdpsolaris 10.0-CURRENT FreeBSD 10.0-CURRENT #0: Mon Sep 17 08:52:10 UTC 2012 root@gdpsolaris:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
pw incorrect works with 0 uid:
# pw user show 0
pw: no such user `0'
Yes I know regarding -u, but:
# pw user show 80
www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
we just need fix pw_user.c#318 ">" to ">="
>How-To-Repeat:
pw user show 0
>Fix:
--- pw_user.c_old 2012-09-27 12:22:27.043408321 +0000
+++ pw_user.c 2012-09-27 11:54:19.386410444 +0000
@@ -315,7 +315,7 @@
*/
if (mode != M_ADD && pwd == NULL
&& strspn(a_name->val, "0123456789") == strlen(a_name->val)
- && atoi(a_name->val) > 0) { /* Assume uid */
+ && atoi(a_name->val) >= 0) { /* Assume uid */
(a_uid = a_name)->ch = 'u';
a_name = NULL;
}
Patch attached with submission follows:
--- pw_user.c_old 2012-09-27 12:22:27.043408321 +0000
+++ pw_user.c 2012-09-27 11:54:19.386410444 +0000
@@ -315,7 +315,7 @@
*/
if (mode != M_ADD && pwd == NULL
&& strspn(a_name->val, "0123456789") == strlen(a_name->val)
- && atoi(a_name->val) > 0) { /* Assume uid */
+ && atoi(a_name->val) >= 0) { /* Assume uid */
(a_uid = a_name)->ch = 'u';
a_name = NULL;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209270939.q8R9dFgx032670>
