Need something like access(2) that uses effective uid, gid

Scott Southard scott at thirdi.UUCP
Wed May 24 06:59:20 AEST 1989


I'm writing a program that will run setuid and needs to check file access
permissions relative to the effective user.  Access(2) uses the real user
and group id's to check permissions, so it is useless.  Am I stuck with
using stat(2) and geteuid(2) and getegid(2) and doing all sorts of ugly
convolutions to determine whether a file or directory is accessible, or
is there an easier way?  Open(2) doesn't help much either, since I can't
open a directory for writing even though the permission bits allow writing,
etc.  Has anyone written a public domain version of access that uses open,
stat, and whatever else is needed to mimic access(2)?

Any help on this would be appreciated.
-- 
Scott Southard
Third Eye Software, Inc.
{pyramid,hpda,apple}!thirdi!scott



More information about the Comp.unix.questions mailing list