summaryrefslogtreecommitdiffstats
path: root/sys/posix4
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-05-06 16:15:42 +0000
committerrwatson <rwatson@FreeBSD.org>2001-05-06 16:15:42 +0000
commit305a69de6642df7e722a7bf5afefcbc6799aa46c (patch)
tree3cecbd0713cf405478d6e55246736b51d0a92afc /sys/posix4
parentc6090aa3fbb1a31bf3cd149c182e50d31056c81b (diff)
downloadFreeBSD-src-305a69de6642df7e722a7bf5afefcbc6799aa46c.zip
FreeBSD-src-305a69de6642df7e722a7bf5afefcbc6799aa46c.tar.gz
o First step in cleaning up authorization code for the posix4
implementation. Move from direct uid 0 comparision to using suser_xxx() call with the same semantics. Simplify CAN_AFFECT() macro as passed pcred was redundant. The checks here still aren't "right", but they are probably "better". Obtained from: TrustedBSD Project
Diffstat (limited to 'sys/posix4')
-rw-r--r--sys/posix4/p1003_1b.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/posix4/p1003_1b.c b/sys/posix4/p1003_1b.c
index 577456f..569bb6f 100644
--- a/sys/posix4/p1003_1b.c
+++ b/sys/posix4/p1003_1b.c
@@ -70,14 +70,14 @@ MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B");
*
* Can process p, with pcred pc, do "write flavor" operations to process q?
*/
-#define CAN_AFFECT(p, pc, q) \
- ((pc)->pc_ucred->cr_uid == 0 || \
- (pc)->p_ruid == (q)->p_cred->p_ruid || \
- (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \
- (pc)->p_ruid == (q)->p_ucred->cr_uid || \
- (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid)
+#define CAN_AFFECT(p, q) \
+ (!suser_xxx(NULL, p, PRISON_ROOT) || \
+ (p)->p_cred->pc_ruid == (q)->p_cred->p_ruid || \
+ (p)->p_ucred->cr_uid == (q)->p_cred->p_ruid || \
+ (p)->p_cred->pc_ruid == (q)->p_ucred->cr_uid || \
+ (p)->p_ucred->cr_uid == (q)->p_ucred->cr_uid)
#else
-#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0)
+#define CAN_AFFECT(p, q) (!suser_xxx(NULL, p, PRISON_ROOT))
#endif
/*
@@ -99,7 +99,7 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp)
{
/* Enforce permission policy.
*/
- if (CAN_AFFECT(p, p->p_cred, other_proc))
+ if (CAN_AFFECT(p, other_proc))
*pp = other_proc;
else
ret = EPERM;
OpenPOWER on IntegriCloud