diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-06-22 22:28:56 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-06-22 22:28:56 +0000 |
commit | bf6f6091a42014bc9d3a94ad39db39be05f0ac95 (patch) | |
tree | bc4b3b8a3ea1113c0b04660bb9d668ef73c73e57 /sys/kern/kern_alq.c | |
parent | 4e21fcc762aac198eecaa42ece0d974d33185911 (diff) | |
download | FreeBSD-src-bf6f6091a42014bc9d3a94ad39db39be05f0ac95.zip FreeBSD-src-bf6f6091a42014bc9d3a94ad39db39be05f0ac95.tar.gz |
Add an explicit credential argument to alq_open() to allow the caller to
specify what credential to use when authorizing vn_open() and later
write operations, rather than curthread->td_ucred.
When writing KTR traces to an ALQ, specify the credential of the thread
generating the sysctl request.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/kern/kern_alq.c')
-rw-r--r-- | sys/kern/kern_alq.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 5335393..94f0118 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -326,7 +326,8 @@ SYSINIT(ald, SI_SUB_LOCK, SI_ORDER_ANY, ald_startup, NULL) * Create the queue data structure, allocate the buffer, and open the file. */ int -alq_open(struct alq **alqp, const char *file, int size, int count) +alq_open(struct alq **alqp, const char *file, struct ucred *cred, int size, + int count) { struct thread *td; struct nameidata nd; @@ -344,7 +345,7 @@ alq_open(struct alq **alqp, const char *file, int size, int count) NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td); flags = FWRITE | O_NOFOLLOW | O_CREAT; - error = vn_open(&nd, &flags, 0); + error = vn_open_cred(&nd, &flags, 0, cred); if (error) return (error); @@ -356,7 +357,7 @@ alq_open(struct alq **alqp, const char *file, int size, int count) alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO); alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO); alq->aq_vp = nd.ni_vp; - alq->aq_cred = crhold(td->td_ucred); + alq->aq_cred = crhold(cred); alq->aq_entmax = count; alq->aq_entlen = size; alq->aq_entfree = alq->aq_first; |