| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include <string.h> |
| 6 |
#include <sepol/policydb/polcaps.h> |
| 7 |
|
| 8 |
static const char *polcap_names[] = { |
| 9 |
"network_peer_controls", |
| 10 |
"open_perms", |
| 11 |
"extended_socket_class", |
| 12 |
"always_check_network", |
| 13 |
"cgroup_seclabel", |
| 14 |
"nnp_nosuid_transition", |
| 15 |
NULL |
| 16 |
}; |
| 17 |
|
| 18 |
int sepol_polcap_getnum(const char *name) |
| 19 |
{ |
| 20 |
int capnum; |
| 21 |
|
| 22 |
for (capnum = 0; capnum <= POLICYDB_CAPABILITY_MAX; capnum++) { |
| 23 |
if (polcap_names[capnum] == NULL) |
| 24 |
continue; |
| 25 |
if (strcasecmp(polcap_names[capnum], name) == 0) |
| 26 |
return capnum; |
| 27 |
} |
| 28 |
return -1; |
| 29 |
} |
| 30 |
|
| 31 |
const char *sepol_polcap_getname(unsigned int capnum) |
| 32 |
{ |
| 33 |
if (capnum > POLICYDB_CAPABILITY_MAX) |
| 34 |
return NULL; |
| 35 |
|
| 36 |
return polcap_names[capnum]; |
| 37 |
} |