aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/vnode.h
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-08-16 12:52:03 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-08-16 12:52:03 +0000
commitea6027a8e13af09156894213851240cafa6482b9 (patch)
treea570fe9c67cfb6ae0cdff5d5e57c3c023aecddac /sys/sys/vnode.h
parent1e03ff6cf08bd7bbe62093d4fd2ab64d7d210ebe (diff)
downloadsrc-ea6027a8e13af09156894213851240cafa6482b9.tar.gz
src-ea6027a8e13af09156894213851240cafa6482b9.zip
Make similar changes to fo_stat() and fo_poll() as made earlier to
fo_read() and fo_write(): explicitly use the cred argument to fo_poll() as "active_cred" using the passed file descriptor's f_cred reference to provide access to the file credential. Add an active_cred argument to fo_stat() so that implementers have access to the active credential as well as the file credential. Generally modify callers of fo_stat() to pass in td->td_ucred rather than fp->f_cred, which was redundantly provided via the fp argument. This set of modifications also permits threads to perform these operations on behalf of another thread without modifying their credential. Trickle this change down into fo_stat/poll() implementations: - badfo_poll(), badfo_stat(): modify/add arguments. - kqueue_poll(), kqueue_stat(): modify arguments. - pipe_poll(), pipe_stat(): modify/add arguments, pass active_cred to MAC checks rather than td->td_ucred. - soo_poll(), soo_stat(): modify/add arguments, pass fp->f_cred rather than cred to pru_sopoll() to maintain current semantics. - sopoll(): moidfy arguments. - vn_poll(), vn_statfile(): modify/add arguments, pass new arguments to vn_stat(). Pass active_cred to MAC and fp->f_cred to VOP_POLL() to maintian current semantics. - vn_close(): rename cred to file_cred to reflect reality while I'm here. - vn_stat(): Add active_cred and file_cred arguments to vn_stat() and consumers so that this distinction is maintained at the VFS as well as 'struct file' layer. Pass active_cred instead of td->td_ucred to MAC and to VOP_GETATTR() to maintain current semantics. - fifofs: modify the creation of a "filetemp" so that the file credential is properly initialized and can be used in the socket code if desired. Pass ap->a_td->td_ucred as the active credential to soo_poll(). If we teach the vnop interface about the distinction between file and active credentials, we would use the active credential here. Note that current inconsistent passing of active_cred vs. file_cred to VOP's is maintained. It's not clear why GETATTR would be authorized using active_cred while POLL would be authorized using file_cred at the file system level. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Notes
Notes: svn path=/head/; revision=101983
Diffstat (limited to 'sys/sys/vnode.h')
-rw-r--r--sys/sys/vnode.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 8bd1bacfdfbd..d977be3d0910 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -701,7 +701,7 @@ void vprint(char *label, struct vnode *vp);
int vrecycle(struct vnode *vp, struct mtx *inter_lkp,
struct thread *td);
int vn_close(struct vnode *vp,
- int flags, struct ucred *cred, struct thread *td);
+ int flags, struct ucred *file_cred, struct thread *td);
void vn_finished_write(struct mount *mp);
int vn_isdisk(struct vnode *vp, int *errp);
int vn_lock(struct vnode *vp, int flags, struct thread *td);
@@ -725,7 +725,8 @@ int vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, caddr_t base,
int len, off_t offset, enum uio_seg segflg, int ioflg,
struct ucred *active_cred, struct ucred *file_cred, int *aresid,
struct thread *td);
-int vn_stat(struct vnode *vp, struct stat *sb, struct thread *td);
+int vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred,
+ struct ucred *file_cred, struct thread *td);
int vn_start_write(struct vnode *vp, struct mount **mpp, int flags);
dev_t vn_todev(struct vnode *vp);
int vn_write_suspend_wait(struct vnode *vp, struct mount *mp,