/external/libsepol/src/ |
D | users.c | 16 const policydb_t * policydb, in user_to_record() argument 20 const char *name = policydb->p_user_val_to_name[user_idx]; in user_to_record() 21 user_datum_t *usrdatum = policydb->user_val_to_struct[user_idx]; in user_to_record() 37 char *role = policydb->p_role_val_to_name[bit]; in user_to_record() 44 if (policydb->mls) { in user_to_record() 61 if (mls_to_string(handle, policydb, &context, &str) < 0) { in user_to_record() 79 if (mls_to_string(handle, policydb, &context, &str) < 0) { in user_to_record() 106 policydb_t *policydb = &p->p; in sepol_user_modify() local 137 usrdatum = hashtab_search(policydb->p_users.table, in sepol_user_modify() 161 roldatum = hashtab_search(policydb->p_roles.table, in sepol_user_modify() [all …]
|
D | context.c | 88 const policydb_t * policydb, in context_to_string() argument 99 strlen(policydb->p_user_val_to_name[context->user - 1]) + 1; in context_to_string() 101 strlen(policydb->p_role_val_to_name[context->role - 1]) + 1; in context_to_string() 102 scontext_len += strlen(policydb->p_type_val_to_name[context->type - 1]); in context_to_string() 103 scontext_len += mls_compute_context_len(policydb, context); in context_to_string() 119 policydb->p_user_val_to_name[context->user - 1], in context_to_string() 120 policydb->p_role_val_to_name[context->role - 1], in context_to_string() 121 policydb->p_type_val_to_name[context->type - 1]); in context_to_string() 124 strlen(policydb->p_user_val_to_name[context->user - 1]) + 1 + in context_to_string() 125 strlen(policydb->p_role_val_to_name[context->role - 1]) + 1 + in context_to_string() [all …]
|
D | genbools.c | 66 static int load_booleans(struct policydb *policydb, const char *path, argument 96 datum = hashtab_search(policydb->p_bools.table, name); 127 hashtab_search(policydb->p_bools.table, 151 struct policydb policydb; local 155 if (policydb_init(&policydb)) 157 if (policydb_from_image(NULL, data, len, &policydb) < 0) 160 if (load_booleans(&policydb, booleans, &changes) < 0) { 167 if (evaluate_conds(&policydb) < 0) { 177 rc = policydb_write(&policydb, &pf); 185 policydb_destroy(&policydb); [all …]
|
D | booleans.c | 15 policydb_t * policydb, in bool_update() argument 31 hashtab_search(policydb->p_bools.table, name); in bool_update() 55 const policydb_t * policydb, in bool_to_record() argument 59 const char *name = policydb->p_bool_val_to_name[bool_idx]; in bool_to_record() 60 cond_bool_datum_t *booldatum = policydb->bool_val_to_struct[bool_idx]; in bool_to_record() 90 policydb_t *policydb = &p->p; in sepol_bool_set() local 91 if (bool_update(handle, policydb, key, data) < 0) in sepol_bool_set() 94 if (evaluate_conds(policydb) < 0) { in sepol_bool_set() 110 const policydb_t *policydb = &p->p; in sepol_bool_count() local 111 *response = policydb->p_bools.nprim; in sepol_bool_count() [all …]
|
D | interfaces.c | 13 const policydb_t * policydb, in iface_from_record() argument 30 if (context_from_record(handle, policydb, in iface_from_record() 39 if (context_from_record(handle, policydb, in iface_from_record() 67 const policydb_t * policydb, in iface_to_record() argument 84 if (context_to_record(handle, policydb, ifcon, &tmp_con) < 0) in iface_to_record() 91 if (context_to_record(handle, policydb, msgcon, &tmp_con) < 0) in iface_to_record() 114 const policydb_t *policydb = &p->p; in sepol_iface_exists() local 120 head = policydb->ocontexts[OCON_NETIF]; in sepol_iface_exists() 139 const policydb_t *policydb = &p->p; in sepol_iface_query() local 145 head = policydb->ocontexts[OCON_NETIF]; in sepol_iface_query() [all …]
|
D | nodes.c | 15 const policydb_t * policydb, in node_from_record() argument 56 if (context_from_record(handle, policydb, &tmp_con, in node_from_record() 84 const policydb_t * policydb, in node_to_record() argument 129 if (context_to_record(handle, policydb, con, &tmp_con) < 0) in node_to_record() 153 const policydb_t *policydb = &p->p; in sepol_node_count() local 155 head = policydb->ocontexts[OCON_NODE]; in sepol_node_count() 159 head = policydb->ocontexts[OCON_NODE6]; in sepol_node_count() 175 const policydb_t *policydb = &p->p; in sepol_node_exists() local 186 head = policydb->ocontexts[OCON_NODE]; in sepol_node_exists() 202 head = policydb->ocontexts[OCON_NODE6]; in sepol_node_exists() [all …]
|
D | genusers.c | 35 static int load_users(struct policydb *policydb, const char *path) argument 87 usrdatum = hashtab_search(policydb->p_users.table, q); 113 usrdatum->s.value = ++policydb->p_users.nprim; 114 if (hashtab_insert(policydb->p_users.table, 164 roldatum = hashtab_search(policydb->p_roles.table, q); 185 if (policydb->mls) { 228 if (mls_context_to_sid(policydb, oldc, &r, &context) < 274 if (mls_context_to_sid(policydb, oldc, &r, &context) < 295 struct policydb policydb; local 299 if (policydb_init(&policydb)) [all …]
|
D | mls.c | 43 const policydb_t * policydb, in mls_to_string() argument 50 int len = mls_compute_context_len(policydb, mls) + 1; in mls_to_string() 61 mls_sid_to_context(policydb, mls, &ptr); in mls_to_string() 79 const policydb_t * policydb, in mls_from_string() argument 88 if (mls_context_to_sid(policydb, '$', &tmp_cp, mls) < 0) { in mls_from_string() 109 int mls_compute_context_len(const policydb_t * policydb, in mls_compute_context_len() argument 116 if (!policydb->mls) in mls_compute_context_len() 123 strlen(policydb-> in mls_compute_context_len() 135 strlen(policydb->p_cat_val_to_name[i]) + 1; in mls_compute_context_len() 140 strlen(policydb-> in mls_compute_context_len() [all …]
|
D | ports.c | 42 const policydb_t * policydb, in port_from_record() argument 74 if (context_from_record(handle, policydb, &tmp_con, in port_from_record() 101 const policydb_t * policydb, in port_to_record() argument 124 if (context_to_record(handle, policydb, con, &tmp_con) < 0) in port_to_record() 149 const policydb_t *policydb = &p->p; in sepol_port_count() local 151 head = policydb->ocontexts[OCON_PORT]; in sepol_port_count() 167 const policydb_t *policydb = &p->p; in sepol_port_exists() local 178 head = policydb->ocontexts[OCON_PORT]; in sepol_port_exists() 205 const policydb_t *policydb = &p->p; in sepol_port_query() local 216 head = policydb->ocontexts[OCON_PORT]; in sepol_port_query() [all …]
|
D | mls.h | 31 const policydb_t * policydb, 35 const policydb_t * policydb, 39 extern int mls_compute_context_len(const policydb_t * policydb, 43 extern void mls_sid_to_context(const policydb_t * policydb, 48 extern int mls_context_to_sid(const policydb_t * policydb, 58 extern int mls_compute_sid(policydb_t * policydb,
|
D | policydb_convert.c | 11 void *data, size_t len, policydb_t * policydb) in policydb_from_image() argument 22 if (policydb_read(policydb, &pf, 0)) { in policydb_from_image() 23 policydb_destroy(policydb); in policydb_from_image() 35 policydb_t * policydb, void **newdata, size_t * newlen) in policydb_to_image() argument 41 struct policydb tmp_policydb; in policydb_to_image() 47 if (policydb_write(policydb, &pf)) { in policydb_to_image() 66 if (policydb_write(policydb, &pf)) { in policydb_to_image()
|
D | context.h | 12 const policydb_t * policydb, 17 const policydb_t * policydb, 23 const policydb_t * policydb, 28 extern int context_is_valid(const policydb_t * policydb, 33 const policydb_t * policydb,
|
D | roles.c | 15 policydb_t *policydb = &p->p; in sepol_role_exists() local 16 *response = (hashtab_search(policydb->p_roles.table, in sepol_role_exists() 28 policydb_t *policydb = &p->p; in sepol_role_list() local 29 unsigned int tmp_nroles = policydb->p_roles.nprim; in sepol_role_list() 37 tmp_roles[i] = strdup(policydb->p_role_val_to_name[i]); in sepol_role_list()
|
D | services.c | 77 static policydb_t mypolicydb, *policydb = &mypolicydb; variable 131 policydb = p; in sepol_set_policydb() 153 policydb = &mypolicydb; in sepol_set_policydb_from_file() 220 if (policydb->policy_type == POLICY_KERN && in get_name_list() 221 policydb->policyvers >= POLICYDB_VERSION_CONSTRAINT_NAMES && in get_name_list() 252 policydb->p_user_val_to_name[i]); in get_name_list() 256 policydb->p_role_val_to_name[i]); in get_name_list() 260 policydb->p_type_val_to_name[i]); in get_name_list() 343 policydb->p_class_val_to_name[tclass - 1]); in get_class_info() 351 sepol_av_to_string(policydb, tclass, constraint->permissions)); in get_class_info() [all …]
|
/external/sepolicy/tools/sepolicy-analyze/ |
D | dups.c | 15 policydb_t *policydb = args; in find_dups_helper() local 33 sattr = &policydb->type_attr_map[k->source_type - 1]; in find_dups_helper() 34 tattr = &policydb->type_attr_map[k->target_type - 1]; in find_dups_helper() 35 stype = policydb->type_val_to_struct[k->source_type - 1]; in find_dups_helper() 36 ttype = policydb->type_val_to_struct[k->target_type - 1]; in find_dups_helper() 51 stype2 = policydb->type_val_to_struct[avkey.source_type - 1]; in find_dups_helper() 52 ttype2 = policydb->type_val_to_struct[avkey.target_type - 1]; in find_dups_helper() 56 for (node = avtab_search_node(&policydb->te_avtab, &avkey); in find_dups_helper() 67 display_allow(policydb, k, i, d->data); in find_dups_helper() 68 display_allow(policydb, &node->key, i, node->datum.data); in find_dups_helper() [all …]
|
D | typecmp.c | 120 static int find_match(policydb_t *policydb, struct avtab_node *l1, in find_match() argument 146 display_allow(policydb, &l1->key, idx1, perms1); in find_match() 148 display_allow(policydb, &c->key, idx2, perms2); in find_match() 157 static int analyze_types(policydb_t * policydb, char diff, char equiv) in analyze_types() argument 168 type_rules = malloc(sizeof(struct avtab_node) * policydb->p_types.nprim); in analyze_types() 173 memset(type_rules, 0, sizeof(struct avtab_node) * policydb->p_types.nprim); in analyze_types() 180 if (expand_avtab(policydb, &policydb->te_avtab, &exp_avtab)) { in analyze_types() 186 if (expand_avtab(policydb, &policydb->te_cond_avtab, &exp_cond_avtab)) { in analyze_types() 204 for (i = 0; i < policydb->p_types.nprim - 1; i++) { in analyze_types() 207 type = policydb->type_val_to_struct[i]; in analyze_types() [all …]
|
D | neverallow.c | 20 static int read_typeset(policydb_t *policydb, char **ptr, char *end, in read_typeset() argument 113 type = hashtab_search(policydb->p_types.table, id); in read_typeset() 124 rc = ebitmap_union(&typeset->negset, &policydb->attr_type_map[type->s.value - 1]); in read_typeset() 126 rc = ebitmap_union(&typeset->types, &policydb->attr_type_map[type->s.value - 1]); in read_typeset() 144 for (bit = 0; bit < policydb->p_types.nprim; bit++) { in read_typeset() 147 if (policydb->type_val_to_struct[bit] && in read_typeset() 148 policydb->type_val_to_struct[bit]->flavor == TYPE_ATTRIB) in read_typeset() 163 for (bit = 0; bit < policydb->p_types.nprim; bit++) { in read_typeset() 164 if (policydb->type_val_to_struct[bit] && in read_typeset() 165 policydb->type_val_to_struct[bit]->flavor == TYPE_ATTRIB) in read_typeset() [all …]
|
D | utils.c | 12 void display_allow(policydb_t *policydb, avtab_key_t *key, int idx, uint32_t perms) in display_allow() argument 15 policydb->p_type_val_to_name[key->source_type in display_allow() 18 policydb->p_type_val_to_name[key->target_type in display_allow() 20 policydb->p_class_val_to_name[key->target_class - 1], in display_allow() 22 (policydb, key->target_class, perms)); in display_allow() 25 int load_policy(char *filename, policydb_t * policydb, struct policy_file *pf) in load_policy() argument 53 if (policydb_init(policydb)) { in load_policy() 59 ret = policydb_read(policydb, pf, 0); in load_policy()
|
D | perm.c | 7 static int list_permissive(policydb_t * policydb) in list_permissive() argument 15 ebitmap_for_each_bit(&policydb->permissive_map, n, bit) in list_permissive() 18 printf("%s\n", policydb->p_type_val_to_name[bit -1]); in list_permissive() 24 int permissive_func (int argc, __attribute__ ((unused)) char **argv, policydb_t *policydb) { in permissive_func() argument 29 return list_permissive(policydb); in permissive_func()
|
/external/libsepol/tests/ |
D | test-downgrade.c | 37 static policydb_t policydb; variable 51 if (policydb_init(&policydb)) { in downgrade_test_init() 70 policydb_destroy(&policydb); in downgrade_test_cleanup() 133 policydb_destroy(&policydb); in do_downgrade_test() 137 if (read_binary_policy(POLICY_BIN_HI, &policydb) != 0) { in do_downgrade_test() 144 policydb.mls = mls ? 1 : 0; in do_downgrade_test() 146 for (hi = policydb.policyvers; hi >= POLICYDB_VERSION_MIN; hi--) { in do_downgrade_test() 148 version = policydb.policyvers; in do_downgrade_test() 154 policydb.policyvers = lo; in do_downgrade_test() 157 if (write_binary_policy(POLICY_BIN_LO, &policydb) != 0) { in do_downgrade_test() [all …]
|
/external/checkpolicy/test/ |
D | dismod.c | 57 static policydb_t policydb; variable 302 display_id(&policydb, fp, SYM_TYPES, type->s.value - 1, ""); in display_type_callback() 321 display_id(&policydb, fp, SYM_TYPES, i, ""); in display_type_callback() 327 display_id(&policydb, fp, SYM_TYPES, type->s.value - 1, ""); in display_type_callback() 506 display_id(&policydb, fp, SYM_ROLES, role->s.value - 1, ""); in role_display_callback() 508 display_type_set(&role->types, 0, &policydb, fp); in role_display_callback() 601 display_expr(&policydb, cond->expr, out_fp); in display_avdecl() 608 &policydb, out_fp); in display_avdecl() 615 &policydb, out_fp); in display_avdecl() 674 avrule_block_t *block = policydb.global; in display_avblock() [all …]
|
D | dispol.c | 38 static policydb_t policydb; variable 434 if (policydb_init(&policydb)) { in main() 438 ret = policydb_read(&policydb, &pf, 1); in main() 456 display_avtab(&policydb.te_avtab, RENDER_UNCONDITIONAL, in main() 457 &policydb, out_fp); in main() 460 display_avtab(&policydb.te_cond_avtab, in main() 461 RENDER_CONDITIONAL, &policydb, out_fp); in main() 464 display_avtab(&policydb.te_cond_avtab, RENDER_ENABLED, in main() 465 &policydb, out_fp); in main() 468 display_avtab(&policydb.te_cond_avtab, RENDER_DISABLED, in main() [all …]
|
/external/libsepol/include/sepol/ |
D | interfaces.h | 10 const sepol_policydb_t * policydb, 15 const sepol_policydb_t * policydb, 21 const sepol_policydb_t * policydb, 28 sepol_policydb_t * policydb, 39 const sepol_policydb_t * policydb,
|
/external/checkpolicy/ |
D | checkpolicy.c | 92 static policydb_t policydb; variable 234 type_rules = malloc(sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types() 240 sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types() 241 if (avtab_map(&policydb.te_avtab, create_type_rules, type_rules)) in identify_equiv_types() 247 for (i = 0; i < policydb.p_types.nprim - 1; i++) { in identify_equiv_types() 250 for (j = i + 1; j < policydb.p_types.nprim; j++) { in identify_equiv_types() 278 policydb.p_type_val_to_name[i], in identify_equiv_types() 279 policydb.p_type_val_to_name[j]); in identify_equiv_types() 498 sepol_set_policydb(&policydb); in main() 525 if (policydb_init(&policydb)) { in main() [all …]
|
/external/libsepol/include/ |
D | Makefile | 9 test -d $(INCDIR)/policydb || install -m 755 -d $(INCDIR)/policydb 11 install -m 644 $(wildcard sepol/policydb/*.h) $(INCDIR)/policydb
|