standards/96239: [PATCH] /usr/bin/id output not POSIX compliant
when invoked with euid != ruid
Martin Nagy
nagy.martin at gmail.com
Sun Apr 23 22:40:19 UTC 2006
>Number: 96239
>Category: standards
>Synopsis: [PATCH] /usr/bin/id output not POSIX compliant when invoked with euid != ruid
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Apr 23 22:40:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Martin Nagy
>Release: FreeBSD 5.4-RELEASE i386
>Organization:
none
>Environment:
All versions
>Description:
If /usr/bin/id is called with euid != ruid then its output doesn't
comply to IEEE Std 1003.2 - euid comes before gid, while it should
come after it, example:
uid=0(root) euid=1(daemon) gid=0(wheel) egid=6(mail) groups=6(mail), 0(wheel), 5(operator)
should really be:
uid=0(root) gid=0(wheel) euid=1(daemon) egid=6(mail) groups=6(mail), 0(wheel), 5(operator)
>How-To-Repeat:
> su
# cp /usr/bin/id /tmp
# chown daemon:mail /tmp/id
# chmod ug+s /tmp/id
# /tmp/id
>Fix:
Apply the patch to CURRENT version:
--- id.c.orig Sun Apr 23 12:16:28 2006
+++ id.c Sun Apr 23 13:22:51 2006
@@ -252,14 +252,14 @@
}
printf("uid=%u(%s)", uid, pw->pw_name);
+ printf(" gid=%u", gid);
+ if ((gr = getgrgid(gid)))
+ (void)printf("(%s)", gr->gr_name);
if (p_euid && (euid = geteuid()) != uid) {
(void)printf(" euid=%u", euid);
if ((pw = getpwuid(euid)))
(void)printf("(%s)", pw->pw_name);
}
- printf(" gid=%u", gid);
- if ((gr = getgrgid(gid)))
- (void)printf("(%s)", gr->gr_name);
if (p_egid && (egid = getegid()) != gid) {
(void)printf(" egid=%u", egid);
if ((gr = getgrgid(egid)))
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list