Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!pravda.aa.msen.com!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!news.sprintlink.net!uunet!news-maint From: tale@ten.uu.net (David C Lawrence) Newsgroups: comp.unix.bsd.bsdi.misc Subject: Re: BSDI setuid() Date: 12 Sep 1995 18:53:16 GMT Organization: UUNET Technologies Inc, Fairfax VA USA Lines: 16 Message-ID: <434kus$64k@gs2.UU.NET> References: <4347is$lm5@ccshst05.cs.uoguelph.ca> NNTP-Posting-Host: rodan.uu.net To: bbarber@uoguelph.ca (DYE JOB) In <4347is$lm5@ccshst05.cs.uoguelph.ca> bbarber@uoguelph.ca (DYE JOB) writes: > I've noticed a difference with BSDI setuid() as apposed to that on > a SYSV system. You've been POSIXed. > As it turns out, "setuid(geteuid())" will return -1 from a program > that is being executed by any program that is u+s. Not wholly true. It will return -1 from a program that is setuid but not setuid to root, or unless the program is setuid to the uid of the real owner of the process (eg, geteuid() == getruid()). The setuid man page describes this. Just change it to setruid(geteuid()) and you will get the behaviour the original programmer desired.