1/* $Id: sysv_ipc.c,v 1.7 1997/11/06 19:29:22 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
--- 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
46int
47ipcperm(cred, perm, mode)
48 struct ucred *cred;
49 struct ipc_perm *perm;
50 int mode;
51{
52
53 if (cred->cr_uid == 0)
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 ---
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
46int
47ipcperm(cred, perm, mode)
48 struct ucred *cred;
49 struct ipc_perm *perm;
50 int mode;
51{
52
53 if (cred->cr_uid == 0)
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 ---