platform_system_sepolicy/tools/sepolicy-analyze/perm.c
dcashman ef4fd30672 Accept command-line input for neverallow-check.
Also, divide each sepolicy-analyze function into its own component for simplified
command-line parsing and potentially eventual modularization.

Bug: 18005561
Change-Id: I45fa07d776cf1bec7d60dba0c03ee05142b86c19
2014-10-31 11:38:32 -07:00

30 lines
690 B
C

#include "perm.h"
void permissive_usage() {
fprintf(stderr, "\tpermissive\n");
}
static int list_permissive(policydb_t * policydb)
{
struct ebitmap_node *n;
unsigned int bit;
/*
* iterate over all domains and check if domain is in permissive
*/
ebitmap_for_each_bit(&policydb->permissive_map, n, bit)
{
if (ebitmap_node_get_bit(n, bit)) {
printf("%s\n", policydb->p_type_val_to_name[bit -1]);
}
}
return 0;
}
int permissive_func (int argc, __attribute__ ((unused)) char **argv, policydb_t *policydb) {
if (argc != 1) {
USAGE_ERROR = true;
return -1;
}
return list_permissive(policydb);
}