MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mls_devfs_create_device

Function mls_devfs_create_device

freebsd/security/mac_mls/mac_mls.c:904–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903
904static void
905mls_devfs_create_device(struct ucred *cred, struct mount *mp,
906 struct cdev *dev, struct devfs_dirent *de, struct label *delabel)
907{
908 struct mac_mls *mm;
909 const char *dn;
910 int mls_type;
911
912 mm = SLOT(delabel);
913 dn = devtoname(dev);
914 if (strcmp(dn, "null") == 0 ||
915 strcmp(dn, "zero") == 0 ||
916 strcmp(dn, "random") == 0 ||
917 strncmp(dn, "fd/", strlen("fd/")) == 0)
918 mls_type = MAC_MLS_TYPE_EQUAL;
919 else if (strcmp(dn, "kmem") == 0 ||
920 strcmp(dn, "mem") == 0)
921 mls_type = MAC_MLS_TYPE_HIGH;
922 else if (ptys_equal &&
923 (strncmp(dn, "ttyp", strlen("ttyp")) == 0 ||
924 strncmp(dn, "pts/", strlen("pts/")) == 0 ||
925 strncmp(dn, "ptyp", strlen("ptyp")) == 0))
926 mls_type = MAC_MLS_TYPE_EQUAL;
927 else
928 mls_type = MAC_MLS_TYPE_LOW;
929 mls_set_effective(mm, mls_type, 0, NULL);
930}
931
932static void
933mls_devfs_create_directory(struct mount *mp, char *dirname, int dirnamelen,

Callers

nothing calls this directly

Calls 4

strcmpFunction · 0.85
strncmpFunction · 0.85
mls_set_effectiveFunction · 0.85
devtonameFunction · 0.50

Tested by

no test coverage detected