summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_biba
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-02-10 12:35:57 +0000
committered <ed@FreeBSD.org>2012-02-10 12:35:57 +0000
commit28b4a002d6c95bc9e26ea30871aa91c1cc4b3563 (patch)
tree38fefd1e5bde255db2d3eab529d481ce373dec71 /sys/security/mac_biba
parent7bf1094d6b76324d8ab7decb5dc0d06999a72842 (diff)
downloadFreeBSD-src-28b4a002d6c95bc9e26ea30871aa91c1cc4b3563.zip
FreeBSD-src-28b4a002d6c95bc9e26ea30871aa91c1cc4b3563.tar.gz
Remove direct access to si_name.
Code should just use the devtoname() function to obtain the name of a character device. Also add const keywords to pieces of code that need it to build properly. MFC after: 2 weeks
Diffstat (limited to 'sys/security/mac_biba')
-rw-r--r--sys/security/mac_biba/mac_biba.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c
index 3f24ff8..aa37fc7 100644
--- a/sys/security/mac_biba/mac_biba.c
+++ b/sys/security/mac_biba/mac_biba.c
@@ -948,18 +948,20 @@ biba_devfs_create_device(struct ucred *cred, struct mount *mp,
struct cdev *dev, struct devfs_dirent *de, struct label *delabel)
{
struct mac_biba *mb;
+ const char *dn;
int biba_type;
mb = SLOT(delabel);
- if (strcmp(dev->si_name, "null") == 0 ||
- strcmp(dev->si_name, "zero") == 0 ||
- strcmp(dev->si_name, "random") == 0 ||
- strncmp(dev->si_name, "fd/", strlen("fd/")) == 0)
+ dn = devtoname(dev);
+ if (strcmp(dn, "null") == 0 ||
+ strcmp(dn, "zero") == 0 ||
+ strcmp(dn, "random") == 0 ||
+ strncmp(dn, "fd/", strlen("fd/")) == 0)
biba_type = MAC_BIBA_TYPE_EQUAL;
else if (ptys_equal &&
- (strncmp(dev->si_name, "ttyp", strlen("ttyp")) == 0 ||
- strncmp(dev->si_name, "pts/", strlen("pts/")) == 0 ||
- strncmp(dev->si_name, "ptyp", strlen("ptyp")) == 0))
+ (strncmp(dn, "ttyp", strlen("ttyp")) == 0 ||
+ strncmp(dn, "pts/", strlen("pts/")) == 0 ||
+ strncmp(dn, "ptyp", strlen("ptyp")) == 0))
biba_type = MAC_BIBA_TYPE_EQUAL;
else
biba_type = MAC_BIBA_TYPE_HIGH;
OpenPOWER on IntegriCloud