<None>

John F Haugh II jfh at greenber.austin.ibm.com
Thu Feb 14 08:55:58 AEST 1991


In article <1991Feb12.184920.5967 at nrcnet0.nrc.ca> ng at cfd.di.nrc.ca writes:
>According to the man pages of setuid() and setgid(), the behavior of
>the respective functions should be the same. Could somebody familiar
>with the setuid stuff enlighten me on why they aren't? Or is it a defect?

If any kind of defect it is one with the documentation.  The setgid()
and setuid() calls are supposed to be "POSIX Compliant".  I don't
have the docs in from of me right now, but I am fairly certain that
they specify the proper POSIX behavior (though I reserve the right to
be wrong ...)

>setuid (0); setgid (0);
>UID=2003 EUID=   0 GID=   0 EGID=   0          <--- GID expected to be 20

The situtation is that the effective UID at the time of the call to
setgid() is 0.  From POSIX 4.2.2.2 (3),

	"If the process has appropriate privileges, the setgid()
	 functions sets the real group ID, effective group ID, and
	 saved set-group-ID to gid."

If you execute the setgid() function when the effective GID is not
0, you should see the behavior that you expect.
-- 
John F. Haugh II      |      I've Been Moved     |    MaBellNet: (512) 838-4340
SneakerNet: 809/1D064 |          AGAIN !         |      VNET: LCCB386 at AUSVMQ
BangNet: ..!cs.utexas.edu!ibmchs!auschs!snowball.austin.ibm.com!jfh (e-i-e-i-o)



More information about the Comp.unix.aix mailing list