|
|
1.1 ! root 1: /* $Header: /usr/src/sys/i8086/drv/RCS/ipc.c,v 2.1 88/09/03 13:06:15 src Exp $ ! 2: * ! 3: * The information contained herein is a trade secret of INETCO ! 4: * Systems, and is confidential information. It is provided under ! 5: * a license agreement, and may be copied or disclosed only under ! 6: * the terms of that agreement. Any reproduction or disclosure of ! 7: * this material without the express written authorization of ! 8: * INETCO Systems or persuant to the license agreement is unlawful. ! 9: * ! 10: * Copyright (c) 1985 ! 11: * An unpublished work by INETCO Systems, Ltd. ! 12: * All rights reserved. ! 13: */ ! 14: ! 15: /* ! 16: * Inter-Process Communication. ! 17: * ! 18: * $Log: /usr/src/sys/i8086/drv/RCS/ipc.c,v $ ! 19: * Revision 2.1 88/09/03 13:06:15 src ! 20: * *** empty log message *** ! 21: * ! 22: * Revision 1.1 88/03/24 17:05:02 src ! 23: * Initial revision ! 24: * ! 25: */ ! 26: #include <coherent.h> ! 27: #include <sys/ipc.h> ! 28: #include <sys/uproc.h> ! 29: ! 30: /* ! 31: * Determine Inter-Process Communication Access Permissions. ! 32: * ! 33: * Input: p = pointer to inter-process communication permission struct. ! 34: * ! 35: * Action: If super user, permissions are 0600. ! 36: * If uid is that of the creator or owner of the message id, ! 37: * use user permissions. ! 38: * If gid is that of the creator or owner of the message id, ! 39: * use group permissions. ! 40: * Otherwise, use others permissions. ! 41: * ! 42: * Output: 0600 = Read/Alter permission. ! 43: * 0400 = Read permission. ! 44: * 0200 = Alter permission. ! 45: * 0 = No permission. ! 46: */ ! 47: ! 48: ipcaccess( p ) ! 49: ! 50: register struct ipc_perm * p; ! 51: ! 52: { ! 53: if ( u.u_uid == 0 ) ! 54: return 0600; ! 55: ! 56: if ((u.u_uid == p->uid) || (u.u_uid == p->cuid)) ! 57: return p->mode & 0600; ! 58: ! 59: if ((u.u_gid == p->gid) || (u.u_gid == p->cgid)) ! 60: return (p->mode << 3) & 0600; ! 61: ! 62: return (p->mode << 6) & 0600; ! 63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.