Article View: net.bugs
Article #132Re: Usefulness of access(2) - (nf)
From: mark
Date: Fri, 23 Sep 1983 05:42
Date: Fri, 23 Sep 1983 05:42
34 lines
1636 bytes
1636 bytes
NOTE: This is in response to an article in net.bugs, asking for an
eaccess() system call to check permissions based on effective
user- and group-ids. I've added net.unix-wizards to the news
group list, since it belongs there, but shouldn't be stranded
from the original article.
Rather than another application-specific system call, how about a
more general solution:
int permiss(path, uid, gid)
char *path;
int uid;
int gid;
Permiss() determines filesystem permissions to 'path' by user 'uid' in
group 'gid'. Returns a value built up from 04 for read-, 02 for write-
and 01 for execute-access.
Permiss() could even replace access(), with a compatibility function
in libc:
extern int
access(path, mode)
char *path;
int mode;
{
return ((permiss(path, getuid(), getgid()) & mode) == 0 ? -1 : 0);
}
This is still a partially-baked idea, but I believe it to be "cleaner"
than access(), and preferable to adding yet another system call.
Mark Brukhartz
..!{allegra,ihnp4,ittvax,trsvax}!laidbak!mark
Technical Details
Message-ID:
<172@laidbak.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!security!genrad!mit-eddie!mit-vax!eagle!mhuxi!houxm!ihnp4!laidbak!markReferences:
<2916@uiucdcs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site laidbak.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!security!genrad!mit-eddie!mit-vax!eagle!mhuxi!houxm!ihnp4!laidbak!mark From: mark@laidbak.UUCP Newsgroups: net.bugs,net.unix-wizards Subject: Re: Usefulness of access(2) - (nf) Message-ID: <172@laidbak.UUCP> Date: Fri, 23-Sep-83 01:42:30 EDT Article-I.D.: laidbak.172 Posted: Fri Sep 23 01:42:30 1983 Date-Received: Sat, 24-Sep-83 03:37:06 EDT References: <2916@uiucdcs.UUCP> Organization: LAI, Westmont, IL Lines: 34