summaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-12-16 05:34:03 +0000
commit967c65a99059fd459b956c1588ce0ba227912c4e (patch)
tree8224d013ff5d255420713d05610c7efebd204d2a /ipc/util.c
parente20c1cc1656a66a2773bca4591a895cbc12696ff (diff)
Merge with Linux 2.1.72, part 1.
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 88e63c6fc..f0ba7fedd 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -1,6 +1,11 @@
/*
* linux/ipc/util.c
* Copyright (C) 1992 Krishna Balasubramanian
+ *
+ * Sep 1997 - Call suser() last after "normal" permission checks so we
+ * get BSD style process accounting right.
+ * Occurs in several places in the IPC code.
+ * Chris Evans, <chris@ferret.lmh.ox.ac.uk>
*/
#include <linux/config.h>
@@ -35,8 +40,6 @@ int ipcperms (struct ipc_perm *ipcp, short flag)
{ /* flag will most probably be 0 or S_...UGO from <linux/stat.h> */
int requested_mode, granted_mode;
- if (suser())
- return 0;
requested_mode = (flag >> 6) | (flag >> 3) | flag;
granted_mode = ipcp->mode;
if (current->euid == ipcp->cuid || current->euid == ipcp->uid)
@@ -44,7 +47,7 @@ int ipcperms (struct ipc_perm *ipcp, short flag)
else if (in_group_p(ipcp->cgid) || in_group_p(ipcp->gid))
granted_mode >>= 3;
/* is there some bit set in requested_mode but not in granted_mode? */
- if (requested_mode & ~granted_mode & 0007)
+ if ((requested_mode & ~granted_mode & 0007) && !suser())
return -1;
return 0;
}