|
|
1.1 ! root 1: /* ! 2: * Inter-Process Communication common access routine. ! 3: * ! 4: * $Log: ipc.c,v $ ! 5: * Revision 1.3 93/04/14 10:11:48 root ! 6: * r75 ! 7: * ! 8: * Revision 1.1 88/03/24 17:05:02 src ! 9: * Initial revision ! 10: * ! 11: */ ! 12: #include <sys/coherent.h> ! 13: #include <sys/ipc.h> ! 14: ! 15: /* ! 16: * Determine Inter-Process Communication Access Permissions. ! 17: * ! 18: * Input: p = pointer to inter-process communication permission struct. ! 19: * ! 20: * Action: If super user, permissions are 0600. ! 21: * If uid is that of the creator or owner of the message id, ! 22: * use user permissions. ! 23: * If gid is that of the creator or owner of the message id, ! 24: * use group permissions. ! 25: * Otherwise, use others permissions. ! 26: * ! 27: * Output: 0600 = Read/Alter permission. ! 28: * 0400 = Read permission. ! 29: * 0200 = Alter permission. ! 30: * 0 = No permission. ! 31: */ ! 32: int ! 33: ipcaccess(p) ! 34: register struct ipc_perm * p; ! 35: { ! 36: if (u.u_uid == 0) ! 37: return 0600; ! 38: ! 39: if ((u.u_uid == p->uid) || (u.u_uid == p->cuid)) ! 40: return p->mode & 0600; ! 41: ! 42: if ((u.u_gid == p->gid) || (u.u_gid == p->cgid)) ! 43: return (p->mode << 3) & 0600; ! 44: ! 45: return (p->mode << 6) & 0600; ! 46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.