setuid (euid) after setuid (uid) on System 5

david.w.dykstra dwd at cbnewsc.ATT.COM
Tue Mar 21 02:24:26 AEST 1989


>From article <123 at cat.Fulcrum.BT.CO.UK>, by igb at Fulcrum.BT.CO.UK (Ian G Batten):
- 
- Should the following program work or not, on System Five?  This is a
- common idiom in the source code of HoneyDanber uucp, and two local System
- Five machines refuse to honour the second setuid. 
- 
- main ()
- {
-   int uid, euid;
- 
-   printf ("uid = %d; euid = %d\n", uid = getuid (), euid = geteuid ());
-   if (setuid (uid) != 0)
-     perror ("setuid (uid)");
-   printf ("uid = %d; euid = %d\n", getuid (), geteuid ());
-   if (setuid (euid) != 0)
-     perror ("setuid (euid)");
-   printf ("uid = %d; euid = %d\n", getuid (), geteuid ());
- }
This works on my System V 3.2.1 system only if the program is not
set-uid to root.  If it is set-uid to something else (like uucp in the
HoneyDanber stuff) then it works.  I'm not sure why it shouldn't work
for root.

- Dave Dykstra
  AT&T Bell Labs, Skokie, IL   att!ttrdf!dwd



More information about the Comp.bugs.sys5 mailing list