Home
last modified time | relevance | path

Searched refs:policydb (Results 1 – 25 of 53) 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()
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 …]
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 …]
Dgenbools.c66 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 …]
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()
139 const policydb_t *policydb = &p->p; in sepol_iface_query() local
145 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()
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 …]
Dgenusers.c35 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 …]
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 …]
Dports.c42 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 …]
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()
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,
Dservices.c77 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()
352 sepol_av_to_string(policydb, tclass, in get_class_info()
[all …]
Droles.c15 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()
/external/selinux/policycoreutils/sepolicy/
Dinfo.c93 static PyObject* get_sens(const char *name, const apol_policy_t * policydb) in get_sens() argument
105 qpol_policy_t *q = apol_policy_get_qpol(policydb); in get_sens()
110 if (apol_level_query_set_sens(policydb, query, name)) in get_sens()
112 if (apol_level_get_by_query(policydb, query, &v)) in get_sens()
121 ap_mls_lvl = (apol_mls_level_t *) apol_mls_level_create_from_qpol_level_datum(policydb, level); in get_sens()
122 tmp = apol_mls_level_render(policydb, ap_mls_lvl); in get_sens()
164 apol_policy_t *policydb = NULL; in qpol_cat_datum_compare() local
168 policydb = (apol_policy_t *) data; in qpol_cat_datum_compare()
169 q = apol_policy_get_qpol(policydb); in qpol_cat_datum_compare()
170 assert(policydb); in qpol_cat_datum_compare()
[all …]
/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/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()
197 tmp_dbase->policydb = NULL; in dbase_policydb_init()
225 sepol_policydb_t * policydb) in dbase_policydb_attach() argument
230 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/checkpolicy/test/
Ddismod.c57 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 …]
Ddispol.c37 static policydb_t policydb; variable
409 if (policydb_init(&policydb)) { in main()
413 ret = policydb_read(&policydb, &pf, 1); in main()
435 display_avtab(&policydb.te_avtab, RENDER_UNCONDITIONAL, in main()
436 &policydb, out_fp); in main()
439 display_avtab(&policydb.te_cond_avtab, in main()
440 RENDER_CONDITIONAL, &policydb, out_fp); in main()
443 display_avtab(&policydb.te_cond_avtab, RENDER_ENABLED, in main()
444 &policydb, out_fp); in main()
447 display_avtab(&policydb.te_cond_avtab, RENDER_DISABLED, in main()
[all …]
/external/selinux/checkpolicy/
Dcheckpolicy.c93 static policydb_t policydb; variable
235 type_rules = malloc(sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types()
241 sizeof(struct avtab_node) * policydb.p_types.nprim); in identify_equiv_types()
242 if (avtab_map(&policydb.te_avtab, create_type_rules, type_rules)) in identify_equiv_types()
248 for (i = 0; i < policydb.p_types.nprim - 1; i++) { in identify_equiv_types()
251 for (j = i + 1; j < policydb.p_types.nprim; j++) { in identify_equiv_types()
279 policydb.p_type_val_to_name[i], in identify_equiv_types()
280 policydb.p_type_val_to_name[j]); in identify_equiv_types()
510 sepol_set_policydb(&policydb); in main()
542 if (policydb_init(&policydb)) { in main()
[all …]
/external/selinux/libsepol/include/sepol/
Dinterfaces.h13 const sepol_policydb_t * policydb,
18 const sepol_policydb_t * policydb,
24 const sepol_policydb_t * policydb,
31 sepol_policydb_t * policydb,
42 const sepol_policydb_t * policydb,
Dports.h17 const sepol_policydb_t * policydb,
22 const sepol_policydb_t * policydb,
28 sepol_policydb_t * policydb,
39 const sepol_policydb_t * policydb,
Dnodes.h17 const sepol_policydb_t * policydb,
22 const sepol_policydb_t * policydb,
28 sepol_policydb_t * policydb,
39 const sepol_policydb_t * policydb,
/external/selinux/policycoreutils/sepolgen-ifgen/
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