bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: code/module request: undo setuid


From: Bruno Haible
Subject: Re: code/module request: undo setuid
Date: Wed, 12 Nov 2008 23:56:28 +0100
User-agent: KMail/1.5.4

Sam Steingold wrote:
> > If so, the magic is
> > 
> > /* This is for executables that have the setgid bit set.  */
> > #if HAVE_SETREGID
> >   setregid (getgid (), getgid ());
> > #else
> >   setegid (getgid ());
> > #endif
> > /* This is for executables that have the setuid bit set.  */
> > #if HAVE_SETREUID
> >   setreuid (getuid (), getuid ());
> > #else
> >   seteuid (getuid ());
> > #endif
> 
> looks simple enough.

Note that on mingw and BeOS, none of these four functions exist - but these
platforms don't have different uids anyway.

> nevertheless, could you please add an "unsuid" module?

I'm not in favour of it, because the recommended approach is to put the
setuid bit only on specialized, small executables, and these executables
can exit after they have done their job.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]