freebsd-nq/sys/fs
Robert Watson ea6027a8e1 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
2002-08-16 12:52:03 +00:00
..
cd9660 Introduce typedefs for the member functions of struct vfsops and employ 2002-08-13 10:05:50 +00:00
coda Fix typo in the last revision. 2002-08-04 19:34:38 +00:00
deadfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
devfs Introduce typedefs for the member functions of struct vfsops and employ 2002-08-13 10:05:50 +00:00
fdescfs Make similar changes to fo_stat() and fo_poll() as made earlier to 2002-08-16 12:52:03 +00:00
fifofs Make similar changes to fo_stat() and fo_poll() as made earlier to 2002-08-16 12:52:03 +00:00
hpfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
msdosfs When a cluster entry for ``.'' is set to 0, msdosfs fails to handle it 2002-08-16 05:13:42 +00:00
ntfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
nullfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
nwfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
portalfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
procfs Fixed 64bit big endian bugs relating to abuse of ioctl argument passing. 2002-08-15 06:16:10 +00:00
pseudofs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
smbfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
specfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
udf Clean up comments that are no longer relevant. 2002-08-15 03:50:06 +00:00
umapfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
unionfs - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00