summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_mls
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-10-05 18:25:48 +0000
committerrwatson <rwatson@FreeBSD.org>2002-10-05 18:25:48 +0000
commitf79fd8d75dd2dbf45f899ab499e2f41e29577b14 (patch)
tree407f9e0033c7814b65b9cf691bff744f046ca36b /sys/security/mac_mls
parentabda58cc1e0c7e68a18c225136603919b193bb42 (diff)
downloadFreeBSD-src-f79fd8d75dd2dbf45f899ab499e2f41e29577b14.zip
FreeBSD-src-f79fd8d75dd2dbf45f899ab499e2f41e29577b14.tar.gz
Merge implementation of mpo_check_vnode_link() for various appropriate
file-system aware MAC policies. Sync to MAC tree. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/security/mac_mls')
-rw-r--r--sys/security/mac_mls/mac_mls.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c
index 27b74b1..4adc3f5 100644
--- a/sys/security/mac_mls/mac_mls.c
+++ b/sys/security/mac_mls/mac_mls.c
@@ -1471,6 +1471,29 @@ mac_mls_check_vnode_getextattr(struct ucred *cred, struct vnode *vp,
return (0);
}
+static int
+mac_mls_check_vnode_link(struct ucred *cred, struct vnode *dvp,
+ struct label *dlabel, struct vnode *vp, struct label *label,
+ struct componentname *cnp)
+{
+ struct mac_mls *subj, *obj;
+
+ if (!mac_mls_enabled)
+ return (0);
+
+ subj = SLOT(&cred->cr_label);
+ obj = SLOT(dlabel);
+
+ if (!mac_mls_dominate_single(obj, subj))
+ return (EACCES);
+
+ obj = SLOT(dlabel);
+ if (!mac_mls_dominate_single(obj, subj))
+ return (EACCES);
+
+ return (0);
+}
+
static int
mac_mls_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
struct label *dlabel, struct componentname *cnp)
@@ -2050,6 +2073,8 @@ static struct mac_policy_op_entry mac_mls_ops[] =
(macop_t)mac_mls_check_vnode_getacl },
{ MAC_CHECK_VNODE_GETEXTATTR,
(macop_t)mac_mls_check_vnode_getextattr },
+ { MAC_CHECK_VNODE_LINK,
+ (macop_t)mac_mls_check_vnode_link },
{ MAC_CHECK_VNODE_LOOKUP,
(macop_t)mac_mls_check_vnode_lookup },
{ MAC_CHECK_VNODE_OPEN,
OpenPOWER on IntegriCloud