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