Xref: utzoo comp.lang.c:8250 comp.unix.questions:6099 comp.unix.wizards:7133 Path: utzoo!mnetor!uunet!husc6!mailrus!ames!hao!gatech!dcc1!douglas From: douglas@dcc1.UUCP (Douglas B. Jones) Newsgroups: comp.lang.c,comp.unix.questions,comp.unix.wizards Subject: Re: [braindamaged?] use of access(2) -- long note Message-ID: <311@dcc1.UUCP> Date: 16 Mar 88 19:20:56 GMT References: <59@vsi.UUCP> <1056@stratus.UUCP> <70@vsi.UUCP> <305@wsccs.UUCP> Sender: root@dcc1.UUCP Reply-To: douglas@dcc1.UUCP (Douglas B. Jones) Distribution: comp Organization: DeKalb College, Clarkston GA Lines: 29 Keywords: access(2), permissions, setuid/setgid There has been some talk about the access(2) only working on the real uid/gid pair. Two alternate possibilites: 1) have a saccess(2) which will check against setuid/setgid. If they fail, then it will check against realuid/realgid. OR, maybe it will just check against the setuid/setgid. 2) have another routine, call it faccess(2), which will have the call: ret = faccess(file_path,uid,gid); so you can check against the uid and gid pair. You could also set uid or gid to -1, and it would not check for that type. ret = faccess(file_path,uid,-1); /* don't check for gid */ ret = faccess(file_path,-1,gid); /* don't check for uid */ ret = faccess(file_path,uid,gid); /* check for both */ I'm not familiar with NFS, but I seem to remember something about some id having -1 as the uid (and/or maybe gid) number. If this is the case, some other number might have to be picked; say -9999 or -MAXINT. -- Douglas B. Jones DeKalb College / 555 N. Indian Creek Drive Clarkston, Ga. 30021 / (404) 299-4233 {cbosgd,hplabs,ihnp4,seismo,ulyses}!gatech!dcc1!douglas or douglas@dcc1