summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-08-19 16:43:25 +0000
committerrwatson <rwatson@FreeBSD.org>2002-08-19 16:43:25 +0000
commit1a7cd1a210c4be2ec85df8513276938c23be1b95 (patch)
treeb56250ebc97ff756401e26512847769076ec6e53 /sys/kern/vfs_extattr.c
parent25617b8fc0dd0452d39b8873c1df9d7fc6fbbf9c (diff)
downloadFreeBSD-src-1a7cd1a210c4be2ec85df8513276938c23be1b95.zip
FreeBSD-src-1a7cd1a210c4be2ec85df8513276938c23be1b95.tar.gz
Break out mac_check_vnode_op() into three seperate checks:
mac_check_vnode_poll(), mac_check_vnode_read(), mac_check_vnode_write(). This improves the consistency with other existing vnode checks, and allows policies to avoid implementing switch statements to determine what operations they do and do not want to authorize. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 39f8423..fce45fe 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -734,8 +734,7 @@ open(td, uap)
vat.va_size = 0;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
#ifdef MAC
- error = mac_check_vnode_op(td->td_ucred, vp,
- MAC_OP_VNODE_WRITE);
+ error = mac_check_vnode_write(td->td_ucred, vp);
if (error == 0)
#endif
error = VOP_SETATTR(vp, &vat, td->td_ucred, td);
@@ -2368,8 +2367,7 @@ truncate(td, uap)
if (vp->v_type == VDIR)
error = EISDIR;
#ifdef MAC
- else if ((error = mac_check_vnode_op(td->td_ucred, vp,
- MAC_OP_VNODE_WRITE))) {}
+ else if ((error = mac_check_vnode_write(td->td_ucred, vp))) {}
#endif
else if ((error = vn_writechk(vp)) == 0 &&
(error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
@@ -2426,8 +2424,7 @@ ftruncate(td, uap)
if (vp->v_type == VDIR)
error = EISDIR;
#ifdef MAC
- else if ((error = mac_check_vnode_op(td->td_ucred, vp,
- MAC_OP_VNODE_WRITE))) {}
+ else if ((error = mac_check_vnode_write(td->td_ucred, vp))) {}
#endif
else if ((error = vn_writechk(vp)) == 0) {
VATTR_NULL(&vattr);
@@ -3345,8 +3342,7 @@ fhopen(td, uap)
VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); /* XXX */
#ifdef MAC
- error = mac_check_vnode_op(td->td_ucred, vp,
- MAC_OP_VNODE_WRITE);
+ error = mac_check_vnode_write(td->td_ucred, vp);
if (error == 0) {
#endif
VATTR_NULL(vap);
OpenPOWER on IntegriCloud