summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_socket.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-08-16 12:52:03 +0000
committerrwatson <rwatson@FreeBSD.org>2002-08-16 12:52:03 +0000
commit2b82cd24f10c789221e2b4edc59b96a7733b9e71 (patch)
treea570fe9c67cfb6ae0cdff5d5e57c3c023aecddac /sys/kern/sys_socket.c
parent6742ffa0ae2d6a1a7f5ed81f56bf52bd504a8d6a (diff)
downloadFreeBSD-src-2b82cd24f10c789221e2b4edc59b96a7733b9e71.zip
FreeBSD-src-2b82cd24f10c789221e2b4edc59b96a7733b9e71.tar.gz
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
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r--sys/kern/sys_socket.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 19f4d9b..53ca5b9 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -157,20 +157,22 @@ soo_ioctl(fp, cmd, data, td)
}
int
-soo_poll(fp, events, cred, td)
+soo_poll(fp, events, active_cred, td)
struct file *fp;
int events;
- struct ucred *cred;
+ struct ucred *active_cred;
struct thread *td;
{
struct socket *so = (struct socket *)fp->f_data;
- return so->so_proto->pr_usrreqs->pru_sopoll(so, events, cred, td);
+ return so->so_proto->pr_usrreqs->pru_sopoll(so, events,
+ fp->f_cred, td);
}
int
-soo_stat(fp, ub, td)
+soo_stat(fp, ub, active_cred, td)
struct file *fp;
struct stat *ub;
+ struct ucred *active_cred;
struct thread *td;
{
struct socket *so = (struct socket *)fp->f_data;
OpenPOWER on IntegriCloud