1/* $Id: sysv_ipc.c,v 1.8 1997/11/18 12:52:10 bde Exp $ */ |
2/* $NetBSD: sysv_ipc.c,v 1.7 1994/06/29 06:33:11 cgd Exp $ */ 3 4/* 5 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 26 unchanged lines hidden (view full) --- 36#include <sys/param.h> 37#include <sys/ipc.h> 38#include <sys/ucred.h> 39 40#if defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG) 41 42/* 43 * Check for ipc permission |
44 * 45 * XXX: Should pass proc argument so that we can pass 46 * XXX: proc->p_acflag to suser() |
47 */ 48 49int 50ipcperm(cred, perm, mode) 51 struct ucred *cred; 52 struct ipc_perm *perm; 53 int mode; 54{ 55 |
56 if (suser(cred, (u_short *)NULL)) |
57 return (0); 58 59 /* Check for user match. */ 60 if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) { 61 if (mode & IPC_M) 62 return (EPERM); 63 /* Check for group match. */ 64 mode >>= 3; --- 222 unchanged lines hidden --- |