*BSD News Article 62549


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!inferno.mpx.com.au!news.mel.aone.net.au!imci4!newsfeed.internetmci.com!EU.net!Austria.EU.net!news.aut.alcatel.at!atusc73!ladavac
From: ladavac@aut.alcatel.at (Marino Ladavac)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: (getuid() && geteuid())
Date: 20 Feb 1996 12:44:34 GMT
Organization: Alcatel Austria AG
Lines: 26
Message-ID: <4gcfni$7jn@atusks02.aut.alcatel.at>
References: <4ffe84$ed1@dali.cs.uni-magdeburg.de> <4gb1h2$d34@uriah.heep.sax.de>
NNTP-Posting-Host: atusc73.aut.alcatel.at
X-Newsreader: TIN [version 1.2 PL2]

J Wunsch (j@uriah.heep.sax.de) wrote:
: jesse@csmd.cs.UNI-Magdeburg.DE (Roland Jesse) writes:

: > How may I handle the bug in getuid() and geteuid() that both are always 
: > successful ?

: Huh?  Why do you consider it a bug?  Any process does have a real and
: an effective UID, hence both functions must always be successful!

: > I want to install a little programm to get root-permissions for executing 
: > one command. To check the startup permissions there is a line like:
: > 
: > if (geteuid() && getuid()) (void) exit(1);
: > 
: > This works for SunOS 4.1.3 but doesn't for FreeBSD 2.1.
: > Are there _any_ other ways to go around ?

: What is it supposed to do?  What doesn't work?

From code snippet, exit unless the executable is setuid root or executed
by root (or someone setuid root.)

To the original poster: did you set the executable SUID root or did you try
to execute it as root?

/Alby