Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Mar 1997 00:02:45 +0100
From:      Hinrich Eilts <eilts@tor.muc.de>
To:        freebsd-questions@freebsd.org
Cc:        eilts@tor.muc.de
Subject:   setgid(2)
Message-ID:  <199703292302.AAA00407@odin.muc.de>

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

what is the right behaviour of setgid(2)? Assume following situation: A program
is installed with group-bit 's' and contain two setgid(2)-calls, the first set
the program to its real group, the second to its old effective group (this the
program is installed and set to). For example:
-rwxr-sr-x  1 root  mail  387562 Mar 29 17:29 /usr/local/bin/elm
is invoked by user Fred in group 'wheel'. Just after start 'elm' has effective
group 'mail'. After the first setgid it becomes effective group 'wheel', the second
setgid shall set effective group back to 'mail'. In FreeBSD-2.1, this worked but now
in FreeBSD-2.2.1 it fails, because the second setgid(2) failed.
If setgid(2) is replaced by setegid(2), it works. I assume, setgid(2) in FreeBSD-2.1
has not overwritten the saved-gid but in FreeBSD-2.2 it overwrite it? What is the
right behaviour?

Hinrich



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