aboutsummaryrefslogtreecommitdiff
path: root/sys/security
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2020-05-21 01:55:35 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2020-05-21 01:55:35 +0000
commit245bfd34da590e12884bd1a5677f3227a36d4bcf (patch)
treebd3f30b09ed71ce881641d920535207ad89d75dc /sys/security
parent49caa483b3fafffd9cf5197eb30e8bb235aa7410 (diff)
downloadsrc-245bfd34da590e12884bd1a5677f3227a36d4bcf.tar.gz
src-245bfd34da590e12884bd1a5677f3227a36d4bcf.zip
Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure and yet this is duplicated across a number of places in the code. Simplify by creating a fsidcmp function (macro). Reviewed by: mjg, rmacklem Approved by: mav (mentor) MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D24749
Notes
Notes: svn path=/head/; revision=361313
Diffstat (limited to 'sys/security')
-rw-r--r--sys/security/mac_bsdextended/mac_bsdextended.c5
-rw-r--r--sys/security/mac_bsdextended/mac_bsdextended.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/sys/security/mac_bsdextended/mac_bsdextended.c b/sys/security/mac_bsdextended/mac_bsdextended.c
index 65cfb36ea496..dc597052b272 100644
--- a/sys/security/mac_bsdextended/mac_bsdextended.c
+++ b/sys/security/mac_bsdextended/mac_bsdextended.c
@@ -302,9 +302,8 @@ ugidfw_rulecheck(struct mac_bsdextended_rule *rule,
}
if (rule->mbr_object.mbo_flags & MBO_FSID_DEFINED) {
- match = (bcmp(&(vp->v_mount->mnt_stat.f_fsid),
- &(rule->mbr_object.mbo_fsid),
- sizeof(rule->mbr_object.mbo_fsid)) == 0);
+ match = (fsidcmp(&vp->v_mount->mnt_stat.f_fsid,
+ &rule->mbr_object.mbo_fsid) == 0);
if (rule->mbr_object.mbo_neg & MBO_FSID_DEFINED)
match = !match;
if (!match)
diff --git a/sys/security/mac_bsdextended/mac_bsdextended.h b/sys/security/mac_bsdextended/mac_bsdextended.h
index c09abc0f2ab0..8b998b41067d 100644
--- a/sys/security/mac_bsdextended/mac_bsdextended.h
+++ b/sys/security/mac_bsdextended/mac_bsdextended.h
@@ -101,7 +101,7 @@ struct mac_bsdextended_object {
uid_t mbo_uid_max;
gid_t mbo_gid_min;
gid_t mbo_gid_max;
- struct fsid mbo_fsid;
+ fsid_t mbo_fsid;
int mbo_type;
};