Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F. Haugh II) Newsgroups: comp.sources.wanted Subject: Re: User level access control Summary: what's wrong with ... Message-ID: <17106@rpp386.cactus.org> Date: 7 Oct 89 13:51:03 GMT References: <"891006132638.75046.606.CHD50-2"@CompuServe.COM> Reply-To: jfh@rpp386.cactus.org (John F. Haugh II) Organization: TrishTrash Readers, Inc. Lines: 32 In article <"891006132638.75046.606.CHD50-2"@CompuServe.COM> 75046.606@CompuServe.COM (Larry W. Virden) writes: >What I have in mind is a program which would read a user-provided >database of 'groups' and determine whether the user in question was >permitted to access a particular file. There would have to be >various security features built into the software, but this would >allow a project or individual maintain some level of control wihtout >having to go thru adding groups to a system group file. Perhaps >someone remembers seeing something like this? What about ... groupaccess (file) char *file; { struct stat sb; struct group *gp; char *user = logname(); char *cp; stat (file, &sb); gp = getgrgid (sb.st_gid); for (cp = gp->gr_mem;cp;cp++) if (strcmp (cp, logname) == 0) break; return (cp != 0); } -- John F. Haugh II +-Things you didn't want to know:------ VoiceNet: (512) 832-8832 Data: -8835 | The real meaning of MACH is ... InterNet: jfh@rpp386.cactus.org | ... Messages Are Crufty Hacks. UUCPNet: {texbell|bigtex}!rpp386!jfh +--------------------------------------