Home | History | Annotate | Download | only in src

Lines Matching defs:rc

287 	int rc = SEPOL_ERR;
296 rc = symtab_insert(pdb, SYM_COMMONS, key, sepol_common, SCOPE_DECL, 0, &value);
297 if (rc != SEPOL_OK) {
303 rc = symtab_init(&sepol_common->permissions, PERM_SYMTAB_SIZE);
304 if (rc != SEPOL_OK) {
314 rc = hashtab_insert(sepol_common->permissions.table, key, sepol_perm);
315 if (rc != SEPOL_OK) {
330 return rc;
335 int rc = SEPOL_ERR;
349 rc = symtab_insert(pdb, SYM_CLASSES, key, sepol_class, SCOPE_DECL, 0, &value);
350 if (rc != SEPOL_OK) {
357 rc = symtab_init(&sepol_class->permissions, PERM_SYMTAB_SIZE);
358 if (rc != SEPOL_OK) {
368 rc = cil_common_to_policydb(pdb, cil_common, &sepol_common);
369 if (rc != SEPOL_OK) {
384 rc = hashtab_insert(sepol_class->permissions.table, key, sepol_perm);
385 if (rc != SEPOL_OK) {
399 return rc;
404 int rc = SEPOL_ERR;
413 rc = SEPOL_OK;
418 rc = symtab_insert(pdb, SYM_ROLES, (hashtab_key_t)key, sepol_role, SCOPE_DECL, 0, &value);
419 if (rc != SEPOL_OK) {
424 rc = SEPOL_ERR;
434 return rc;
439 int rc = SEPOL_ERR;
444 rc = __cil_get_sepol_role_datum(pdb, DATUM(cil_role), &sepol_role);
445 if (rc != SEPOL_OK) goto exit;
447 rc = __cil_get_sepol_role_datum(pdb, DATUM(cil_role->bounds), &sepol_parent);
448 if (rc != SEPOL_OK) goto exit;
462 int rc = SEPOL_ERR;
470 rc = __cil_get_sepol_role_datum(pdb, DATUM(role), &sepol_role);
471 if (rc != SEPOL_OK) goto exit;
476 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_type);
477 if (rc != SEPOL_OK) goto exit;
481 rc = SEPOL_ERR;
490 return rc;
495 int rc = SEPOL_ERR;
504 rc = symtab_insert(pdb, SYM_TYPES, key, sepol_type, SCOPE_DECL, 0, &value);
505 if (rc != SEPOL_OK) {
517 return rc;
522 int rc = SEPOL_ERR;
527 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_type), &sepol_type);
528 if (rc != SEPOL_OK) goto exit;
530 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_type->bounds), &sepol_parent);
531 if (rc != SEPOL_OK) goto exit;
545 int rc = SEPOL_ERR;
551 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_alias->actual), &sepol_type);
552 if (rc != SEPOL_OK) goto exit;
557 rc = symtab_insert(pdb, SYM_TYPES, key, sepol_alias, SCOPE_DECL, 0, NULL);
558 if (rc != SEPOL_OK) {
570 return rc;
575 int rc = SEPOL_ERR;
578 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_typeperm->type), &sepol_type);
579 if (rc != SEPOL_OK) goto exit;
590 return rc;
596 int rc = SEPOL_ERR;
611 rc = symtab_insert(pdb, SYM_TYPES, key, sepol_attr, SCOPE_DECL, 0, &value);
612 if (rc != SEPOL_OK) {
623 return rc;
628 int rc = SEPOL_ERR;
636 rc = SEPOL_ERR;
644 return rc;
649 int rc = SEPOL_ERR;
660 rc = __cil_typeattr_bitmap_init(pdb);
661 if (rc != SEPOL_OK) {
666 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_attr), &sepol_type);
667 if (rc != SEPOL_OK) goto exit;
674 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_type);
675 if (rc != SEPOL_OK) goto exit;
680 rc = SEPOL_OK;
682 return rc;
687 int rc = SEPOL_ERR;
702 return rc;
707 int rc = SEPOL_ERR;
714 rc = symtab_insert(pdb, SYM_USERS, key, sepol_user, SCOPE_DECL, 0, &value);
715 if (rc != SEPOL_OK) {
726 return rc;
731 int rc = SEPOL_ERR;
736 rc = __cil_get_sepol_user_datum(pdb, DATUM(cil_user), &sepol_user);
737 if (rc != SEPOL_OK) goto exit;
739 rc = __cil_get_sepol_user_datum(pdb, DATUM(cil_user->bounds), &sepol_parent);
740 if (rc != SEPOL_OK) goto exit;
754 int rc = SEPOL_ERR;
761 rc = __cil_get_sepol_user_datum(pdb, DATUM(userrole->user), &sepol_user);
762 if (rc != SEPOL_OK) goto exit;
764 rc = __cil_expand_role(userrole->role, &role_bitmap);
765 if (rc != SEPOL_OK) goto exit;
770 rc = __cil_get_sepol_role_datum(pdb, DATUM(db->val_to_role[i]), &sepol_role);
771 if (rc != SEPOL_OK) goto exit;
785 rc = SEPOL_OK;
789 return rc;
794 int rc = SEPOL_ERR;
801 rc = symtab_insert(pdb, SYM_BOOLS, key, sepol_bool, SCOPE_DECL, 0, &value);
802 if (rc != SEPOL_OK) {
813 return rc;
818 int rc = SEPOL_ERR;
831 rc = symtab_insert(pdb, SYM_CATS, key, sepol_cat, SCOPE_DECL, 0, &value);
832 if (rc != SEPOL_OK) {
844 return rc;
849 int rc = SEPOL_ERR;
855 rc = __cil_get_sepol_cat_datum(pdb, DATUM(cil_alias->actual), &sepol_cat);
856 if (rc != SEPOL_OK) goto exit;
859 rc = symtab_insert(pdb, SYM_CATS, key, sepol_alias, SCOPE_DECL, 0, NULL);
860 if (rc != SEPOL_OK) {
873 return rc;
878 int rc = SEPOL_ERR;
894 rc = symtab_insert(pdb, SYM_LEVELS, key, sepol_level, SCOPE_DECL, 0, &value);
895 if (rc != SEPOL_OK) {
910 return rc;
915 int rc = SEPOL_ERR;
922 rc = __cil_get_sepol_level_datum(pdb, DATUM(cil_alias->actual), &sepol_level);
923 if (rc != SEPOL_OK) goto exit;
926 rc = symtab_insert(pdb, SYM_LEVELS, key, sepol_alias, SCOPE_DECL, 0, NULL);
927 if (rc != SEPOL_OK) {
934 rc = mls_level_cpy(mls_level, sepol_level->level);
935 if (rc != SEPOL_OK) {
948 return rc;
953 int rc = SEPOL_OK;
959 rc = SEPOL_ERR;
983 return rc;
1004 int rc = SEPOL_OK;
1024 rc = SEPOL_ERR;
1038 rc = SEPOL_ERR;
1044 rc = avtab_insert(&pdb->te_avtab, &avtab_key, &avtab_datum);
1064 rc = SEPOL_ERR;
1074 rc = __cil_cond_insert_rule(&pdb->te_cond_avtab, &avtab_key, &avtab_datum, cond_node, cond_flavor);
1078 return rc;
1083 int rc = SEPOL_ERR;
1095 rc = __cil_expand_type(cil_rule->src, &src_bitmap);
1096 if (rc != SEPOL_OK) goto exit;
1098 rc = __cil_expand_type(cil_rule->tgt, &tgt_bitmap);
1099 if (rc != SEPOL_OK) goto exit;
1103 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_rule->result), &sepol_result);
1104 if (rc != SEPOL_OK) goto exit;
1109 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_src);
1110 if (rc != SEPOL_OK) goto exit;
1115 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[j]), &sepol_tgt);
1116 if (rc != SEPOL_OK) goto exit;
1119 rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_obj);
1120 if (rc != SEPOL_OK) goto exit;
1122 rc = __cil_insert_type_rule(pdb, kind, sepol_src->s.value, sepol_tgt->s.value, sepol_obj->s.value, sepol_result->s.value, cond_node, cond_flavor);
1123 if (rc != SEPOL_OK) goto exit;
1128 rc = SEPOL_OK;
1134 return rc;
1144 int rc = SEPOL_ERR;
1168 rc = __cil_expand_type(typetrans->src, &src_bitmap);
1169 if (rc != SEPOL_OK) goto exit;
1171 rc = __cil_expand_type(typetrans->tgt, &tgt_bitmap);
1172 if (rc != SEPOL_OK) goto exit;
1176 rc = __cil_get_sepol_type_datum(pdb, DATUM(typetrans->result), &sepol_result);
1177 if (rc != SEPOL_OK) goto exit;
1182 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_src);
1183 if (rc != SEPOL_OK) goto exit;
1188 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[j]), &sepol_tgt);
1189 if (rc != SEPOL_OK) goto exit;
1193 rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_obj);
1194 if (rc != SEPOL_OK) goto exit;
1204 rc = hashtab_insert(filename_trans_table, (hashtab_key_t)new, &(new->otype));
1205 if (rc != SEPOL_OK) {
1206 if (rc == SEPOL_EEXIST) {
1212 rc = SEPOL_OK;
1225 if (rc != SEPOL_OK) {
1233 rc = SEPOL_OK;
1239 return rc;
1249 int rc = SEPOL_ERR;
1265 rc = SEPOL_ERR;
1277 return rc;
1282 int rc = SEPOL_OK;
1302 rc = SEPOL_ERR;
1311 rc = avtab_insert(&pdb->te_avtab, &avtab_key, &avtab_datum);
1320 rc = __cil_cond_insert_rule(&pdb->te_cond_avtab, &avtab_key, &avtab_datum, cond_node, cond_flavor);
1324 return rc;
1411 int rc = SEPOL_ERR;
1417 rc = __cil_get_sepol_class_datum(pdb, DATUM(cp->class), &sepol_class);
1418 if (rc != SEPOL_OK) goto exit;
1420 rc = __cil_perms_to_datum(cp->perms, sepol_class, &data);
1421 if (rc != SEPOL_OK) goto exit;
1434 rc = __cil_check_neverallows(neverallows, src, tgt, sepol_class->s.value, data);
1435 if (rc != SEPOL_OK) {
1440 rc = __cil_get_sepol_type_datum(pdb, src, &sepol_src);
1441 if (rc != SEPOL_OK) goto exit;
1443 rc = __cil_get_sepol_type_datum(pdb, tgt, &sepol_tgt);
1444 if (rc != SEPOL_OK) goto exit;
1446 rc = __cil_insert_avrule(pdb, kind, sepol_src->s.value, sepol_tgt->s.value, sepol_class->s.value, data, cond_node, cond_flavor);
1447 if (rc != SEPOL_OK) {
1455 return rc;
1461 int rc = SEPOL_ERR;
1468 rc = __cil_avrule_expand_helper(pdb, kind, src, tgt, cp, neverallows, cond_node, cond_flavor);
1469 if (rc != SEPOL_OK) {
1476 rc = __cil_avrule_expand(pdb, kind, src, tgt, cmp->classperms, neverallows, cond_node, cond_flavor);
1477 if (rc != SEPOL_OK) {
1485 rc = __cil_avrule_expand(pdb, kind, src, tgt, cp->classperms, neverallows, cond_node, cond_flavor);
1486 if (rc != SEPOL_OK) {
1495 return rc;
1500 int rc = SEPOL_ERR;
1508 rc = SEPOL_OK;
1514 rc = SEPOL_OK;
1526 rc = __cil_expand_type(src, &type_bitmap);
1527 if (rc != SEPOL_OK) goto exit;
1533 rc = __cil_avrule_expand(pdb, kind, src, src, classperms, neverallows, cond_node, cond_flavor);
1534 if (rc != SEPOL_OK) {
1541 rc = __cil_avrule_expand(pdb, kind, src, tgt, classperms, neverallows, cond_node, cond_flavor);
1542 if (rc != SEPOL_OK) goto exit;
1548 return rc;
1558 int rc;
1580 rc = __cil_typetransition_to_avtab(pdb, db, cil_typetrans, cond_node, cond_flavor, filename_trans_table);
1581 if (rc != SEPOL_OK) {
1588 rc = __cil_type_rule_to_avtab(pdb, db, cil_type_rule, cond_node, cond_flavor);
1589 if (rc != SEPOL_OK) {
1596 rc = __cil_avrule_to_avtab(pdb, db, cil_avrule, args->neverallows, cond_node, cond_flavor);
1597 if (rc != SEPOL_OK) {
1637 int rc = __cil_cond_expr_to_sepol_expr_helper(pdb, l, head, tail);
1638 if (rc != SEPOL_OK) {
1653 int rc = SEPOL_ERR;
1695 rc = __cil_cond_item_to_sepol_expr(pdb, item->next, &h1, &t1);
1696 if (rc != SEPOL_OK) {
1707 rc = __cil_cond_item_to_sepol_expr(pdb, item->next->next, &h2, &t2);
1708 if (rc != SEPOL_OK) {
1721 rc = __cil_cond_item_to_sepol_expr(pdb, item, &h1, &t1);
1722 if (rc != SEPOL_OK) {
1728 rc = __cil_cond_item_to_sepol_expr(pdb, item, &h2, &t2);
1729 if (rc != SEPOL_OK) {
1753 int rc;
1756 rc = __cil_cond_expr_to_sepol_expr_helper(pdb, cil_expr, &head, &tail);
1757 if (rc != SEPOL_OK) {
1767 int rc = SEPOL_ERR;
1782 rc = SEPOL_ERR;
1788 rc = __cil_cond_expr_to_sepol_expr(pdb, cil_boolif->datum_expr, &tmp_cond->expr);
1789 if (rc != SEPOL_OK) {
1796 rc = cond_normalize_expr(pdb, tmp_cond);
1797 if (rc != SEPOL_OK) {
1808 rc = SEPOL_ERR;
1845 rc = cil_tree_walk(true_node, __cil_cond_to_policydb_helper, NULL, NULL, &bool_args);
1846 if (rc != SEPOL_OK) {
1854 rc = cil_tree_walk(false_node, __cil_cond_to_policydb_helper, NULL, NULL, &bool_args);
1855 if (rc != SEPOL_OK) {
1864 return rc;
1869 int rc = SEPOL_ERR;
1882 rc = __cil_expand_role(DATUM(roletrans->src), &role_bitmap);
1883 if (rc != SEPOL_OK) goto exit;
1885 rc = __cil_expand_type(roletrans->tgt, &type_bitmap);
1886 if (rc != SEPOL_OK) goto exit;
1890 rc = __cil_get_sepol_role_datum(pdb, DATUM(roletrans->result), &sepol_result);
1891 if (rc != SEPOL_OK) goto exit;
1896 rc = __cil_get_sepol_role_datum(pdb, DATUM(db->val_to_role[i]), &sepol_src);
1897 if (rc != SEPOL_OK) goto exit;
1902 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[j]), &sepol_tgt);
1903 if (rc != SEPOL_OK) goto exit;
1907 rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_obj);
1908 if (rc != SEPOL_OK) goto exit;
1917 rc = SEPOL_OK;
1918 rc = hashtab_insert(role_trans_table, (hashtab_key_t)new, &(new->new_role));
1919 if (rc != SEPOL_OK) {
1920 if (rc == SEPOL_EEXIST) {
1926 rc = SEPOL_OK;
1938 if (rc != SEPOL_OK) {
1946 rc = SEPOL_OK;
1952 return rc;
1957 int rc = SEPOL_ERR;
1965 rc = __cil_expand_role(roleallow->src, &src_bitmap);
1966 if (rc != SEPOL_OK) goto exit;
1968 rc = __cil_expand_role(roleallow->tgt, &tgt_bitmap);
1969 if (rc != SEPOL_OK) goto exit;
1974 rc = __cil_get_sepol_role_datum(pdb, DATUM(db->val_to_role[i]), &sepol_src);
1975 if (rc != SEPOL_OK) goto exit;
1980 rc = __cil_get_sepol_role_datum(pdb, DATUM(db->val_to_role[j]), &sepol_tgt);
1981 if (rc != SEPOL_OK) goto exit;
1993 rc = SEPOL_OK;
1998 return rc;
2003 int rc = SEPOL_ERR;
2007 rc = __cil_get_sepol_user_datum(pdb, item->data, &sepol_user);
2008 if (rc != SEPOL_OK) goto exit;
2019 rc = __cil_expand_role(item->data, &role_bitmap);
2020 if (rc != SEPOL_OK) goto exit;
2025 rc = __cil_get_sepol_role_datum(pdb, DATUM(db->val_to_role[i]), &sepol_role);
2026 if (rc != SEPOL_OK) {
2044 rc = __cil_get_sepol_type_datum(pdb, item->data, &sepol_type);
2045 if (rc != SEPOL_OK) {
2056 rc = __cil_expand_type(item->data, &type_bitmap);
2057 if (rc != SEPOL_OK) goto exit;
2062 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_type);
2063 if (rc != SEPOL_OK) {
2086 int rc = SEPOL_ERR;
2154 rc = __cil_constrain_expr_datum_to_sepol_expr(pdb, db, r_item, expr_flavor, expr);
2155 if (rc != SEPOL_OK) {
2162 rc = __cil_constrain_expr_datum_to_sepol_expr(pdb, db, curr, expr_flavor, expr);
2163 if (rc != SEPOL_OK) {
2168 rc = SEPOL_ERR;
2176 return rc;
2181 int rc = SEPOL_ERR;
2195 rc = constraint_expr_init(op);
2196 if (rc != SEPOL_OK) {
2236 rc = __cil_constrain_expr_leaf_to_sepol_expr(pdb, db, item, flavor, op);
2237 if (rc != SEPOL_OK) {
2244 rc = __cil_constrain_expr_to_sepol_expr_helper(pdb, db, l_expr, &h1, &t1);
2245 if (rc != SEPOL_OK) {
2254 rc = __cil_constrain_expr_to_sepol_expr_helper(pdb, db, l_expr, &h1, &t1);
2255 if (rc != SEPOL_OK) {
2258 rc = __cil_constrain_expr_to_sepol_expr_helper(pdb, db, r_expr, &h2, &t2);
2259 if (rc != SEPOL_OK) {
2278 int rc;
2281 rc = __cil_constrain_expr_to_sepol_expr_helper(pdb, db, cil_expr, &head, &tail);
2282 if (rc != SEPOL_OK) {
2293 int rc = SEPOL_ERR;
2301 rc = __cil_get_sepol_class_datum(pdb, class, &sepol_class);
2302 if (rc != SEPOL_OK) goto exit;
2304 rc = __cil_perms_to_datum(perms, sepol_class, &sepol_constrain->permissions);
2305 if (rc != SEPOL_OK) {
2309 rc = __cil_constrain_expr_to_sepol_expr(pdb, db, expr, &sepol_expr);
2310 if (rc != SEPOL_OK) {
2322 return rc;
2327 int rc = SEPOL_ERR;
2334 rc = cil_constrain_to_policydb_helper(pdb, db, DATUM(cp->class), cp->perms, expr);
2335 if (rc != SEPOL_OK) {
2342 rc = cil_constrain_expand(pdb, db, cmp->classperms, expr);
2343 if (rc != SEPOL_OK) {
2351 rc = cil_constrain_expand(pdb, db, cp->classperms, expr);
2352 if (rc != SEPOL_OK) {
2361 return rc;
2366 int rc = SEPOL_ERR;
2367 rc = cil_constrain_expand(pdb, db, cil_constrain->classperms, cil_constrain->datum_expr);
2368 if (rc != SEPOL_OK) {
2376 return rc;
2381 int rc = SEPOL_ERR;
2392 rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_class);
2393 if (rc != SEPOL_OK) goto exit;
2398 rc = __cil_constrain_expr_to_sepol_expr(pdb, db, expr, &sepol_expr);
2399 if (rc != SEPOL_OK) {
2409 rc = SEPOL_OK;
2413 return rc;
2418 int rc = SEPOL_ERR;
2428 rc = __cil_get_sepol_cat_datum(pdb, j->data, &sepol_cat);
2429 if (rc != SEPOL_OK) goto exit;
2431 rc = ebitmap_set_bit(&mls_level->cat, sepol_cat->s.value - 1, 1);
2432 if (rc != SEPOL_OK) goto exit;
2435 rc = __cil_get_sepol_cat_datum(pdb, i->data, &sepol_cat);
2436 if (rc != SEPOL_OK) goto exit;
2438 rc = ebitmap_set_bit(&mls_level->cat, sepol_cat->s.value - 1, 1);
2439 if (rc != SEPOL_OK) goto exit;
2451 rc = SEPOL_ERR;
2456 rc = __cil_get_sepol_level_datum(pdb, DATUM(cil_sens), &sepol_level);
2457 if (rc != SEPOL_OK) goto exit;
2466 rc = __cil_cats_to_mls_level(pdb, cats, mls_level);
2467 if (rc != SEPOL_OK) {
2479 return rc;
2484 int rc = SEPOL_ERR;
2489 rc = __cil_get_sepol_level_datum(pdb, DATUM(cil_sens), &sepol_level);
2490 if (rc != SEPOL_OK) goto exit;
2497 rc = __cil_cats_to_mls_level(pdb, cats, mls_level);
2498 if (rc != SEPOL_OK) {
2504 rc = SEPOL_OK;
2506 return rc;
2511 int rc = SEPOL_ERR;
2518 rc = cil_level_to_mls_level(pdb, low, mls_level);
2519 if (rc != SEPOL_OK) {
2525 rc = cil_level_to_mls_level(pdb, high, mls_level);
2526 if (rc != SEPOL_OK) {
2533 return rc;
2538 int rc = SEPOL_ERR;
2543 rc = __cil_get_sepol_user_datum(pdb, DATUM(cil_user), &sepol_user);
2544 if (rc != SEPOL_OK) goto exit;
2546 rc = cil_level_to_mls_level(pdb, cil_level, &sepol_user->exp_dfltlevel);
2547 if (rc != SEPOL_OK) {
2551 rc = __cil_levelrange_to_mls_range(pdb, cil_levelrange, &sepol_user->exp_range);
2552 if (rc != SEPOL_OK) {
2559 return rc;
2564 int rc = SEPOL_ERR;
2570 rc = __cil_get_sepol_user_datum(pdb, DATUM(cil_context->user), &sepol_user);
2571 if (rc != SEPOL_OK) goto exit;
2573 rc = __cil_get_sepol_role_datum(pdb, DATUM(cil_context->role), &sepol_role);
2574 if (rc != SEPOL_OK) goto exit;
2576 rc = __cil_get_sepol_type_datum(pdb, DATUM(cil_context->type), &sepol_type);
2577 if (rc != SEPOL_OK) goto exit;
2586 rc = __cil_levelrange_to_mls_range(pdb, cil_lvlrange, &sepol_context->range);
2587 if (rc != SEPOL_OK) {
2597 return rc;
2602 int rc = SEPOL_ERR;
2621 rc = __cil_context_to_sepol_context(pdb, cil_context, &new_ocon->context[0]);
2622 if (rc != SEPOL_OK) {
2632 return rc;
2637 int rc = SEPOL_ERR;
2649 rc = __cil_expand_type(rangetrans->src, &src_bitmap);
2650 if (rc != SEPOL_OK) goto exit;
2652 rc = __cil_expand_type(rangetrans->exec, &tgt_bitmap);
2653 if (rc != SEPOL_OK) goto exit;
2660 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[i]), &sepol_src);
2661 if (rc != SEPOL_OK) goto exit;
2666 rc = __cil_get_sepol_type_datum(pdb, DATUM(db->val_to_type[j]), &sepol_tgt);
2667 if (rc != SEPOL_OK) goto exit;
2671 rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_class);
2672 if (rc != SEPOL_OK) goto exit;
2679 rc = __cil_levelrange_to_mls_range(pdb, rangetrans->range, &new->target_range);
2680 if (rc != SEPOL_OK) {
2685 rc = SEPOL_OK;
2686 rc = hashtab_insert(range_trans_table, (hashtab_key_t)new, &(new->target_range));
2687 if (rc != SEPOL_OK) {
2688 if (rc == SEPOL_EEXIST) {
2694 rc = SEPOL_OK;
2707 if (rc != SEPOL_OK) {
2715 rc = SEPOL_OK;
2721 return rc;
2726 int rc = SEPOL_ERR;
2743 rc = SEPOL_ERR;
2750 rc = __cil_context_to_sepol_context(pdb, cil_portcon->context, &new_ocon->context[0]);
2751 if (rc != SEPOL_OK) {
2759 return rc;
2764 int rc = SEPOL_ERR;
2774 rc = __cil_context_to_sepol_context(pdb, cil_netifcon->if_context, &new_ocon->context[0]);
2775 if (rc != SEPOL_OK) {
2779 rc = __cil_context_to_sepol_context(pdb, cil_netifcon->packet_context, &new_ocon->context[1]);
2780 if (rc != SEPOL_OK) {
2789 return rc;
2794 int rc = SEPOL_ERR;
2813 rc = SEPOL_ERR;
2817 rc = __cil_context_to_sepol_context(pdb, cil_nodecon->context, &new_ocon->context[0]);
2818 if (rc != SEPOL_OK) {
2826 return rc;
2831 int rc = SEPOL_ERR;
2842 rc = __cil_context_to_sepol_context(pdb, cil_fsuse->context, &new_ocon->context[0]);
2843 if (rc != SEPOL_OK) {
2851 return rc;
2856 int rc = SEPOL_ERR;
2886 rc = __cil_context_to_sepol_context(pdb, cil_genfscon->context, &new_ocon->context[0]);
2887 if (rc != SEPOL_OK) {
2895 return rc;
2900 int rc = SEPOL_ERR;
2910 rc = __cil_context_to_sepol_context(pdb, cil_pirqcon->context, &new_ocon->context[0]);
2911 if (rc != SEPOL_OK) {
2919 return rc;
2924 int rc = SEPOL_ERR;
2935 rc = __cil_context_to_sepol_context(pdb, cil_iomemcon->context, &new_ocon->context[0]);
2936 if (rc != SEPOL_OK) {
2944 return rc;
2949 int rc = SEPOL_ERR;
2960 rc = __cil_context_to_sepol_context(pdb, cil_ioportcon->context, &new_ocon->context[0]);
2961 if (rc != SEPOL_OK) {
2969 return rc;
2974 int rc = SEPOL_ERR;
2984 rc = __cil_context_to_sepol_context(pdb, cil_pcidevicecon->context, &new_ocon->context[0]);
2985 if (rc != SEPOL_OK) {
2993 return rc;
2998 int rc = SEPOL_ERR;
3008 rc = __cil_context_to_sepol_context(pdb, cil_devicetreecon->context, &new_ocon->context[0]);
3009 if (rc != SEPOL_OK) {
3017 return rc;
3032 int rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_class);
3033 if (rc != SEPOL_OK) goto exit;
3087 int rc = __cil_get_sepol_class_datum(pdb, DATUM(c->data), &sepol_class);
3088 if (rc != SEPOL_OK) goto exit;
3110 int rc = SEPOL_OK;
3135 rc = cil_role_to_policydb(pdb, node->data);
3138 rc = cil_type_to_policydb(pdb, node->data);
3141 rc = cil_typeattribute_to_policydb(pdb, node->data);
3144 rc = cil_policycap_to_policydb(pdb, node->data);
3147 rc = cil_user_to_policydb(pdb, node->data);
3150 rc = cil_bool_to_policydb(pdb, node->data);
3154 rc = cil_catalias_to_policydb(pdb, node->data);
3159 rc = cil_sepol_level_define(pdb, node->data);
3169 rc = cil_type_bounds_to_policydb(pdb, node->data);
3172 rc = cil_typealias_to_policydb(pdb, node->data);
3175 rc = cil_typepermissive_to_policydb(pdb, node->data);
3178 rc = cil_typeattribute_to_bitmap(pdb, db, node->data);
3182 rc = cil_sensalias_to_policydb(pdb, node->data);
3186 rc = cil_role_bounds_to_policydb(pdb, node->data);
3187 if (rc != SEPOL_OK) goto exit;
3188 rc = cil_roletype_to_policydb(pdb, db, node->data);
3191 rc = cil_user_bounds_to_policydb(pdb, node->data);
3192 if (rc != SEPOL_OK) goto exit;
3194 rc = cil_userlevel_userrange_to_policydb(pdb, node->data);
3198 rc = cil_userrole_to_policydb(pdb, db, node->data);
3201 rc = cil_type_rule_to_policydb(pdb, db, node->data);
3215 rc = cil_avrule_to_policydb(pdb, db, node->data, neverallows);
3220 rc = cil_roletrans_to_policydb(pdb, db, node->data, role_trans_table);
3223 /*rc = cil_roleattributeset_to_policydb(pdb, node->data);*/
3226 rc = cil_typetransition_to_policydb(pdb, db, node->data, filename_trans_table);
3229 rc = cil_constrain_to_policydb(pdb, db, node->data);
3233 rc = cil_constrain_to_policydb(pdb, db, node->data);
3237 rc = cil_validatetrans_to_policydb(pdb, db, node->data);
3241 rc = cil_validatetrans_to_policydb(pdb, db, node->data);
3246 rc = cil_rangetransition_to_policydb(pdb, db, node->data, range_trans_table);
3252 rc = cil_default_to_policydb(pdb, node->data);
3255 rc = cil_defaultrange_to_policydb(pdb, node->data);
3264 rc = cil_booleanif_to_policydb(pdb, db, node, args->neverallows, filename_trans_table);
3269 rc = cil_avrule_to_policydb(pdb, db, node->data, args->neverallows);
3274 rc = cil_roleallow_to_policydb(pdb, db, node->data);
3284 if (rc != SEPOL_OK) {
3287 return rc;
3292 int rc = SEPOL_ERR;
3298 rc = SEPOL_OK;
3303 rc = SEPOL_OK;
3309 rc = __cil_node_to_policydb(node, extra_args);
3310 if (rc != SEPOL_OK) {
3315 return rc;
3320 int rc = SEPOL_ERR;
3322 rc = cil_portcon_to_policydb(pdb, db->portcon);
3323 if (rc != SEPOL_OK) {
3327 rc = cil_netifcon_to_policydb(pdb, db->netifcon);
3328 if (rc != SEPOL_OK) {
3332 rc = cil_nodecon_to_policydb(pdb, db->nodecon);
3333 if (rc != SEPOL_OK) {
3337 rc = cil_fsuse_to_policydb(pdb, db->fsuse);
3338 if (rc != SEPOL_OK) {
3342 rc = cil_genfscon_to_policydb(pdb, db->genfscon);
3343 if (rc != SEPOL_OK) {
3348 rc = cil_pirqcon_to_policydb(pdb, db->pirqcon);
3349 if (rc != SEPOL_OK) {
3353 rc = cil_iomemcon_to_policydb(pdb, db->iomemcon);
3354 if (rc != SEPOL_OK) {
3358 rc = cil_ioportcon_to_policydb(pdb, db->ioportcon);
3359 if (rc != SEPOL_OK) {
3363 rc = cil_pcidevicecon_to_policydb(pdb, db->pcidevicecon);
3364 if (rc != SEPOL_OK) {
3368 rc = cil_devicetreecon_to_policydb(pdb, db->devicetreecon);
3369 if (rc != SEPOL_OK) {
3375 return rc;
3489 int rc = SEPOL_ERR;
3492 rc = hashtab_map(policydb->p_commons.table, &__cil_common_val_array_insert, policydb);
3493 if (rc != SEPOL_OK) {
3499 rc = hashtab_map(policydb->p_classes.table, &__cil_class_val_array_insert, policydb);
3500 if (rc != SEPOL_OK) {
3506 rc = hashtab_map(policydb->p_roles.table, &__cil_role_val_array_insert, policydb);
3507 if (rc != SEPOL_OK) {
3513 rc = hashtab_map(policydb->p_types.table, &__cil_type_val_array_insert, policydb);
3514 if (rc != SEPOL_OK) {
3520 rc = hashtab_map(policydb->p_users.table, &__cil_user_val_array_insert, policydb);
3521 if (rc != SEPOL_OK) {
3527 rc = hashtab_map(policydb->p_bools.table, &__cil_bool_val_array_insert, policydb);
3528 if (rc != SEPOL_OK) {
3533 rc = hashtab_map(policydb->p_levels.table, &__cil_level_val_array_insert, policydb);
3534 if (rc != SEPOL_OK) {
3539 rc = hashtab_map(policydb->p_cats.table, &__cil_cat_val_array_insert, policydb);
3540 if (rc != SEPOL_OK) {
3545 return rc;
3584 int rc;
3587 rc = sepol_policydb_create(spdb);
3588 if (rc < 0) {
3607 return rc;
3613 int rc = SEPOL_ERR;
3621 rc = cil_classorder_to_policydb(pdb, db);
3622 if (rc != SEPOL_OK) {
3627 rc = cil_catorder_to_policydb(pdb, db);
3628 if (rc != SEPOL_OK) {
3632 rc = cil_sensitivityorder_to_policydb(pdb, db);
3633 if (rc != SEPOL_OK) {
3638 rc = avtab_alloc(&pdb->te_avtab, MAX_AVTAB_SIZE);
3639 if (rc != SEPOL_OK) {
3643 rc = avtab_alloc(&pdb->te_cond_avtab, MAX_AVTAB_SIZE);
3644 if (rc != SEPOL_OK) {
3652 return rc;
3708 int rc = SEPOL_ERR;
3711 rc = __cil_policydb_create(db, &pdb);
3712 if (rc != SEPOL_OK) {
3716 rc = cil_binary_create_allocated_pdb(db, pdb);
3717 if (rc != SEPOL_OK) {
3728 return rc;
3735 int rc = SEPOL_ERR;
3753 rc = __cil_policydb_init(pdb, db);
3754 if (rc != SEPOL_OK) {
3788 rc = cil_tree_walk(db->ast->root, __cil_binary_create_helper, NULL, NULL, &extra_args);
3789 if (rc != SEPOL_OK) {
3795 rc = __cil_policydb_val_arrays_create(pdb);
3796 if (rc != SEPOL_OK) {
3803 rc = cil_sidorder_to_policydb(pdb, db);
3804 if (rc != SEPOL_OK) {
3808 rc = __cil_contexts_to_policydb(pdb, db);
3809 if (rc != SEPOL_OK) {
3815 rc = __cil_typeattr_bitmap_init(pdb);
3816 if (rc != SEPOL_OK) {
3825 rc = SEPOL_OK;
3833 return rc;