diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-11-02 21:20:05 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-11-02 21:20:05 +0000 |
commit | 171c9bdfc747f39a6ff14b4570fc8ba71ce847ed (patch) | |
tree | 30b55386fd4c75d1ccb581fd46d61afc7272d3a9 | |
parent | 1f54f2c4113186689e8dd1bb4a71cea494184cd1 (diff) | |
download | FreeBSD-src-171c9bdfc747f39a6ff14b4570fc8ba71ce847ed.zip FreeBSD-src-171c9bdfc747f39a6ff14b4570fc8ba71ce847ed.tar.gz |
o Remove (struct proc *p = td->td_proc) indirection in ipcperm(),
as suser_td(td) works as well as suser_xxx(NULL, p->p_ucred, 0);
This simplifies upcoming changes to suser(), and causes this code
to use the right credential (well, largely) once the td->td_ucred
changes are complete. There remains some redundancy and oddness
in this code, which should be rethought after the next batch of
suser and credential changes.
-rw-r--r-- | sys/kern/sysv_ipc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c index 89ab7d2..b6e753e 100644 --- a/sys/kern/sysv_ipc.c +++ b/sys/kern/sysv_ipc.c @@ -88,14 +88,12 @@ ipcperm(td, perm, mode) struct ipc_perm *perm; int mode; { - struct proc *p = td->td_proc; - struct ucred *cred = p->p_ucred; + struct ucred *cred = td->td_proc->p_ucred; /* Check for user match. */ if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) { if (mode & IPC_M) - return (suser_xxx(p->p_ucred, NULL, 0) == 0 ? 0 : - EPERM); + return (suser_td(td) == 0 ? 0 : EPERM); /* Check for group match. */ mode >>= 3; if (!groupmember(perm->gid, cred) && @@ -107,5 +105,5 @@ ipcperm(td, perm, mode) if (mode & IPC_M) return (0); return ((mode & perm->mode) == mode || - suser_xxx(p->p_ucred, NULL, 0) == 0 ? 0 : EACCES); + suser_td(td) == 0 ? 0 : EACCES); } |