bin/172112: [patch] Fix for incorrect work: pw user show 0
Ilya A. Arkhipov
rum1cro at yandex.ru
Thu Sep 27 09:40:08 UTC 2012
>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 at 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:
More information about the freebsd-bugs
mailing list