Xref: utzoo comp.unix.wizards:15120 comp.bugs.sys5:812 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!tank!mimsy!eneevax!haven!rutgers!att!cbnewsc!dwd From: dwd@cbnewsc.ATT.COM (david.w.dykstra) Newsgroups: comp.unix.wizards,comp.bugs.sys5 Subject: Re: setuid (euid) after setuid (uid) on System 5 Message-ID: <280@cbnewsc.ATT.COM> Date: 20 Mar 89 16:24:26 GMT References: <123@cat.Fulcrum.BT.CO.UK> Organization: AT&T Bell Laboratories Lines: 25 From article <123@cat.Fulcrum.BT.CO.UK>, by igb@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