Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!awdprime!greenber.austin.ibm.com!jfh From: jfh@greenber.austin.ibm.com (John F Haugh II) Newsgroups: comp.unix.aix Subject: Re: Message-ID: <5321@awdprime.UUCP> Date: 13 Feb 91 21:55:58 GMT References: <1991Feb12.184920.5967@nrcnet0.nrc.ca> Sender: news@awdprime.UUCP Organization: Obfuscated Features "R" Us, LCC Austin Lines: 27 In article <1991Feb12.184920.5967@nrcnet0.nrc.ca> ng@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)