Deleted Added
full compact
sysv_ipc.c (46112) sysv_ipc.c (46116)
1/* $Id: sysv_ipc.c,v 1.9 1999/01/30 12:21:48 phk Exp $ */
1/* $Id: sysv_ipc.c,v 1.10 1999/04/27 11:16:15 phk 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

--- 20 unchanged lines hidden (view full) ---

30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include "opt_sysvipc.h"
35
36#include <sys/param.h>
37#include <sys/ipc.h>
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

--- 20 unchanged lines hidden (view full) ---

30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include "opt_sysvipc.h"
35
36#include <sys/param.h>
37#include <sys/ipc.h>
38#include <sys/proc.h>
38#include <sys/ucred.h>
39
40#if defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG)
41
42/*
43 * Check for ipc permission
39#include <sys/ucred.h>
40
41#if defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG)
42
43/*
44 * Check for ipc permission
44 *
45 * XXX: Should pass proc argument so that we can pass
46 * XXX: proc->p_acflag to suser_xxx()
47 */
48
49int
45 */
46
47int
50ipcperm(cred, perm, mode)
51 struct ucred *cred;
48ipcperm(p, perm, mode)
49 struct proc *p;
52 struct ipc_perm *perm;
53 int mode;
54{
50 struct ipc_perm *perm;
51 int mode;
52{
53 struct ucred *cred = p->p_ucred;
55
54
56 if (suser_xxx(cred, (u_short *)NULL))
55 if (suser(p))
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 ---
56 return (0);
57
58 /* Check for user match. */
59 if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) {
60 if (mode & IPC_M)
61 return (EPERM);
62 /* Check for group match. */
63 mode >>= 3;

--- 222 unchanged lines hidden ---