Home
last modified time | relevance | path

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

12

/external/sepolicy/tools/
Dsepolicy-analyze.c22 int load_policy(char *filename, policydb_t * policydb, struct policy_file *pf) in load_policy() argument
50 if (policydb_init(policydb)) { in load_policy()
56 ret = policydb_read(policydb, pf, 0); in load_policy()
177 static void display_allow(policydb_t *policydb, avtab_key_t *key, int idx, in display_allow() argument
181 policydb->p_type_val_to_name[key->source_type in display_allow()
184 policydb->p_type_val_to_name[key->target_type in display_allow()
186 policydb->p_class_val_to_name[key->target_class - 1], in display_allow()
188 (policydb, key->target_class, perms)); in display_allow()
191 static int find_match(policydb_t *policydb, struct avtab_node *l1, in find_match() argument
217 display_allow(policydb, &l1->key, idx1, perms1); in find_match()
[all …]
Dsepolicy-check.c188 int load_policy(char *filename, policydb_t *policydb, struct policy_file *pf) { in load_policy() argument
215 if (policydb_init(policydb)) { in load_policy()
221 ret = policydb_read(policydb, pf, 0); in load_policy()
236 policydb_t policydb; in main() local
276 sepol_set_policydb(&policydb); in main()
279 if (load_policy(policy, &policydb, &pf)) in main()
282 match = check_rule(source, target, class, perm, &policydb); in main()
294 policydb_destroy(&policydb); in main()
/external/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,
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()
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()
351 sepol_av_to_string(policydb, tclass, constraint->permissions)); in get_class_info()
[all …]
/external/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/libsepol/include/sepol/
Dinterfaces.h10 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,
Dports.h14 const sepol_policydb_t * policydb,
19 const sepol_policydb_t * policydb,
25 sepol_policydb_t * policydb,
36 const sepol_policydb_t * policydb,
Dnodes.h14 const sepol_policydb_t * policydb,
19 const sepol_policydb_t * policydb,
25 sepol_policydb_t * policydb,
36 const sepol_policydb_t * policydb,
Dcontext.h15 const sepol_policydb_t * policydb,
19 const sepol_policydb_t * policydb,
24 const sepol_policydb_t * policydb, const char *mls);
/external/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.c38 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/checkpolicy/
Dcheckpolicy.c92 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/
DMakefile9 test -d $(INCDIR)/policydb || install -m 755 -d $(INCDIR)/policydb
11 install -m 644 $(wildcard sepol/policydb/*.h) $(INCDIR)/policydb

12