sysv_ipc.c (31261) | sysv_ipc.c (43426) |
---|---|
1/* $Id: sysv_ipc.c,v 1.7 1997/11/06 19:29:22 phk Exp $ */ | 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 | 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() |
|
44 */ 45 46int 47ipcperm(cred, perm, mode) 48 struct ucred *cred; 49 struct ipc_perm *perm; 50 int mode; 51{ 52 | 47 */ 48 49int 50ipcperm(cred, perm, mode) 51 struct ucred *cred; 52 struct ipc_perm *perm; 53 int mode; 54{ 55 |
53 if (cred->cr_uid == 0) | 56 if (suser(cred, (u_short *)NULL)) |
54 return (0); 55 56 /* Check for user match. */ 57 if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) { 58 if (mode & IPC_M) 59 return (EPERM); 60 /* Check for group match. */ 61 mode >>= 3; --- 222 unchanged lines hidden --- | 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 --- |