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

Function lomac_devfs_create_device

freebsd/security/mac_lomac/mac_lomac.c:1025–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025static void
1026lomac_devfs_create_device(struct ucred *cred, struct mount *mp,
1027 struct cdev *dev, struct devfs_dirent *de, struct label *delabel)
1028{
1029 struct mac_lomac *ml;
1030 const char *dn;
1031 int lomac_type;
1032
1033 ml = SLOT(delabel);
1034 dn = devtoname(dev);
1035 if (strcmp(dn, "null") == 0 ||
1036 strcmp(dn, "zero") == 0 ||
1037 strcmp(dn, "random") == 0 ||
1038 strncmp(dn, "fd/", strlen("fd/")) == 0 ||
1039 strncmp(dn, "ttyv", strlen("ttyv")) == 0)
1040 lomac_type = MAC_LOMAC_TYPE_EQUAL;
1041 else if (ptys_equal &&
1042 (strncmp(dn, "ttyp", strlen("ttyp")) == 0 ||
1043 strncmp(dn, "pts/", strlen("pts/")) == 0 ||
1044 strncmp(dn, "ptyp", strlen("ptyp")) == 0))
1045 lomac_type = MAC_LOMAC_TYPE_EQUAL;
1046 else
1047 lomac_type = MAC_LOMAC_TYPE_HIGH;
1048 lomac_set_single(ml, lomac_type, 0);
1049}
1050
1051static void
1052lomac_devfs_create_directory(struct mount *mp, char *dirname, int dirnamelen,

Callers

nothing calls this directly

Calls 4

strcmpFunction · 0.85
strncmpFunction · 0.85
lomac_set_singleFunction · 0.85
devtonameFunction · 0.50

Tested by

no test coverage detected