Home
last modified time | relevance | path

Searched refs:policydb (Results 1 – 25 of 55) sorted by relevance

123

/external/selinux/libsepol/src/
Dusers.c16 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()
41 char *role = policydb->p_role_val_to_name[bit]; in user_to_record()
47 if (policydb->mls) { in user_to_record()
64 if (mls_to_string(handle, policydb, &context, &str) < 0) { in user_to_record()
82 if (mls_to_string(handle, policydb, &context, &str) < 0) { in user_to_record()
109 policydb_t *policydb = &p->p; in sepol_user_modify() local
140 usrdatum = hashtab_search(policydb->p_users.table, cname); in sepol_user_modify()
163 roldatum = hashtab_search(policydb->p_roles.table, roles[i]); in sepol_user_modify()
[all …]
Dcontext.c88 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 …]
Dbooleans.c15 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 …]
Dinterfaces.c13 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()
138 const policydb_t *policydb = &p->p; in sepol_iface_query() local
144 head = policydb->ocontexts[OCON_NETIF]; in sepol_iface_query()
[all …]
Dnodes.c15 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()
174 const policydb_t *policydb = &p->p; in sepol_node_exists() local
185 head = policydb->ocontexts[OCON_NODE]; in sepol_node_exists()
201 head = policydb->ocontexts[OCON_NODE6]; in sepol_node_exists()
[all …]
Dibendports.c15 const policydb_t *policydb, in ibendport_from_record() argument
45 if (context_from_record(handle, policydb, &tmp_con, in ibendport_from_record()
72 const policydb_t *policydb, in ibendport_to_record() argument
91 if (context_to_record(handle, policydb, con, &tmp_con) < 0) in ibendport_to_record()
114 const policydb_t *policydb = &p->p; in sepol_ibendport_count() local
116 head = policydb->ocontexts[OCON_IBENDPORT]; in sepol_ibendport_count()
130 const policydb_t *policydb = &p->p; in sepol_ibendport_exists() local
137 head = policydb->ocontexts[OCON_IBENDPORT]; in sepol_ibendport_exists()
158 const policydb_t *policydb = &p->p; in sepol_ibendport_query() local
165 head = policydb->ocontexts[OCON_IBENDPORT]; in sepol_ibendport_query()
[all …]
Dmls.c43 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 …]
Dibpkeys.c17 const policydb_t *policydb, in ibpkey_from_record() argument
42 if (context_from_record(handle, policydb, &tmp_con, in ibpkey_from_record()
69 const policydb_t *policydb, in ibpkey_to_record() argument
85 if (context_to_record(handle, policydb, con, &tmp_con) < 0) in ibpkey_to_record()
108 const policydb_t *policydb = &p->p; in sepol_ibpkey_count() local
110 head = policydb->ocontexts[OCON_IBPKEY]; in sepol_ibpkey_count()
124 const policydb_t *policydb = &p->p; in sepol_ibpkey_exists() local
131 head = policydb->ocontexts[OCON_IBPKEY]; in sepol_ibpkey_exists()
154 const policydb_t *policydb = &p->p; in sepol_ibpkey_query() local
161 head = policydb->ocontexts[OCON_IBPKEY]; in sepol_ibpkey_query()
[all …]
Dports.c56 const policydb_t * policydb, in port_from_record() argument
88 if (context_from_record(handle, policydb, &tmp_con, in port_from_record()
115 const policydb_t * policydb, in port_to_record() argument
138 if (context_to_record(handle, policydb, con, &tmp_con) < 0) in port_to_record()
163 const policydb_t *policydb = &p->p; in sepol_port_count() local
165 head = policydb->ocontexts[OCON_PORT]; in sepol_port_count()
180 const policydb_t *policydb = &p->p; in sepol_port_exists() local
191 head = policydb->ocontexts[OCON_PORT]; in sepol_port_exists()
218 const policydb_t *policydb = &p->p; in sepol_port_query() local
229 head = policydb->ocontexts[OCON_PORT]; in sepol_port_query()
[all …]
Dmls.h31 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,
Dpolicydb_convert.c11 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()
Dservices.c78 static policydb_t mypolicydb, *policydb = &mypolicydb; variable
132 policydb = p; in sepol_set_policydb()
154 policydb = &mypolicydb; in sepol_set_policydb_from_file()
221 if (policydb->policy_type == POLICY_KERN && in get_name_list()
222 policydb->policyvers >= POLICYDB_VERSION_CONSTRAINT_NAMES && in get_name_list()
253 policydb->p_user_val_to_name[i]); in get_name_list()
257 policydb->p_role_val_to_name[i]); in get_name_list()
261 policydb->p_type_val_to_name[i]); in get_name_list()
344 policydb->p_class_val_to_name[tclass - 1]); in get_class_info()
353 sepol_av_to_string(policydb, tclass, in get_class_info()
[all …]
Dcontext.h12 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,
Droles.c15 policydb_t *policydb = &p->p; in sepol_role_exists() local
16 *response = (hashtab_search(policydb->p_roles.table, role) != NULL); in sepol_role_exists()
26 policydb_t *policydb = &p->p; in sepol_role_list() local
27 unsigned int tmp_nroles = policydb->p_roles.nprim; in sepol_role_list()
35 tmp_roles[i] = strdup(policydb->p_role_val_to_name[i]); in sepol_role_list()
/external/selinux/libsemanage/src/
Ddatabase_policydb.c37 sepol_policydb_t *policydb; member
48 sepol_policydb_free(dbase->policydb); in dbase_policydb_drop_cache()
94 sepol_policydb_t *policydb = NULL; in dbase_policydb_cache() local
107 if (sepol_policydb_create(&policydb) < 0) { in dbase_policydb_cache()
132 if (sepol_policydb_read(policydb, pf) < 0) in dbase_policydb_cache()
145 dbase->policydb = policydb; in dbase_policydb_cache()
152 sepol_policydb_free(policydb); in dbase_policydb_cache()
196 tmp_dbase->policydb = NULL; in dbase_policydb_init()
224 sepol_policydb_t * policydb) in dbase_policydb_attach() argument
229 dbase->policydb = policydb; in dbase_policydb_attach()
[all …]
Dfcontexts_local.c84 const sepol_policydb_t *policydb; member
95 const sepol_policydb_t *policydb = arg->policydb; in validate_handler() local
104 && sepol_context_check(handle->sepolh, policydb, in validate_handler()
122 const sepol_policydb_t * policydb) in semanage_fcontext_validate_local() argument
127 arg.policydb = policydb; in semanage_fcontext_validate_local()
/external/selinux/libsepol/tests/
Dtest-downgrade.c37 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/selinux/checkpolicy/test/
Ddismod.c57 static policydb_t policydb; variable
327 display_id(&policydb, fp, SYM_TYPES, type->s.value - 1, ""); in display_type_callback()
346 display_id(&policydb, fp, SYM_TYPES, i, ""); in display_type_callback()
352 display_id(&policydb, fp, SYM_TYPES, type->s.value - 1, ""); in display_type_callback()
531 display_id(&policydb, fp, SYM_ROLES, role->s.value - 1, ""); in role_display_callback()
533 display_type_set(&role->types, 0, &policydb, fp); in role_display_callback()
626 display_expr(&policydb, cond->expr, out_fp); in display_avdecl()
633 &policydb, out_fp); in display_avdecl()
640 &policydb, out_fp); in display_avdecl()
699 avrule_block_t *block = policydb.global; in display_avblock()
[all …]
Ddispol.c37 static policydb_t policydb; variable
425 if (policydb_init(&policydb)) { in main()
429 ret = policydb_read(&policydb, &pf, 1); in main()
451 display_avtab(&policydb.te_avtab, RENDER_UNCONDITIONAL, in main()
452 &policydb, out_fp); in main()
455 display_avtab(&policydb.te_cond_avtab, in main()
456 RENDER_CONDITIONAL, &policydb, out_fp); in main()
459 display_avtab(&policydb.te_cond_avtab, RENDER_ENABLED, in main()
460 &policydb, out_fp); in main()
463 display_avtab(&policydb.te_cond_avtab, RENDER_DISABLED, in main()
[all …]
/external/selinux/checkpolicy/
Dcheckpolicy.c99 static policydb_t policydb; variable
241 type_rules = malloc(sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types()
247 sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types()
248 if (avtab_map(&policydb.te_avtab, create_type_rules, type_rules)) in identify_equiv_types()
254 for (i = 0; i < policydb.p_types.nprim - 1; i++) { in identify_equiv_types()
257 for (j = i + 1; j < policydb.p_types.nprim; j++) { in identify_equiv_types()
285 policydb.p_type_val_to_name[i], in identify_equiv_types()
286 policydb.p_type_val_to_name[j]); in identify_equiv_types()
527 sepol_set_policydb(&policydb); in main()
559 if (policydb_init(&policydb)) { in main()
[all …]
/external/selinux/libsepol/include/sepol/
Dinterfaces.h14 const sepol_policydb_t * policydb,
19 const sepol_policydb_t * policydb,
25 const sepol_policydb_t * policydb,
32 sepol_policydb_t * policydb,
43 const sepol_policydb_t * policydb,
Dnodes.h18 const sepol_policydb_t * policydb,
23 const sepol_policydb_t * policydb,
29 sepol_policydb_t * policydb,
40 const sepol_policydb_t * policydb,
Dibendports.h19 const sepol_policydb_t *policydb,
24 const sepol_policydb_t *policydb,
30 sepol_policydb_t *policydb,
41 const sepol_policydb_t *policydb,
Dibpkeys.h19 const sepol_policydb_t *policydb,
24 const sepol_policydb_t *policydb,
30 sepol_policydb_t *policydb,
41 const sepol_policydb_t *policydb,
/external/selinux/python/audit2allow/
Dsepolgen-ifgen-attr-helper.c147 policydb_t *policydb; in load_policy() local
163 policydb = malloc(sizeof(policydb_t)); in load_policy()
164 if (policydb == NULL) { in load_policy()
169 if (policydb_init(policydb)) { in load_policy()
171 free(policydb); in load_policy()
175 ret = policydb_read(policydb, &pf, 1); in load_policy()
179 free(policydb); in load_policy()
185 return policydb; in load_policy()

123