Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Apr 2006 22:38:15 GMT
From:      Martin Nagy <nagy.martin@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   standards/96239: [PATCH] /usr/bin/id output not POSIX compliant when invoked with euid != ruid
Message-ID:  <200604232238.k3NMcFc5095253@www.freebsd.org>
Resent-Message-ID: <200604232240.k3NMeIx7083364@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604232238.k3NMcFc5095253>