-
-/*
- * XXX This routine would be common to all sysV style IPC
- * (if the others were implemented).
- */
-ipcaccess(ipc, mode, cred)
- register struct ipc_perm *ipc;
- int mode;
- register struct ucred *cred;
-{
- register int m;
-
- if (cred->cr_uid == 0)
- return(0);
- /*
- * Access check is based on only one of owner, group, public.
- * If not owner, then check group.
- * If not a member of the group, then check public access.
- */
- mode &= 0700;
- m = ipc->mode;
- if (cred->cr_uid != ipc->uid && cred->cr_uid != ipc->cuid) {
- m <<= 3;
- if (!groupmember(ipc->gid, cred) &&
- !groupmember(ipc->cgid, cred))
- m <<= 3;
- }
- if ((mode&m) == mode)
- return (0);
- return (EACCES);
-}