patch-2.1.72 linux/ipc/util.c
Next file: linux/kernel/itimer.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index
- Lines: 30
- Date:
Tue Dec 9 09:49:59 1997
- Orig file:
v2.1.71/linux/ipc/util.c
- Orig date:
Tue May 13 22:41:19 1997
diff -u --recursive --new-file v2.1.71/linux/ipc/util.c linux/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 @@
{ /* 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 @@
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;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov