Lines Matching refs:rc
37 int rc; in cond_expr_to_str() local
39 rc = strs_stack_init(&stack); in cond_expr_to_str()
40 if (rc != 0) { in cond_expr_to_str()
92 rc = strs_stack_push(stack, new_val); in cond_expr_to_str()
93 if (rc != 0) { in cond_expr_to_str()
126 int rc; in constraint_expr_to_str() local
130 rc = strs_stack_init(&stack); in constraint_expr_to_str()
131 if (rc != 0) { in constraint_expr_to_str()
234 rc = strs_stack_push(stack, new_val); in constraint_expr_to_str()
235 if (rc != 0) { in constraint_expr_to_str()
268 int rc = 0; in class_constraint_rules_to_strs() local
279 rc = -1; in class_constraint_rules_to_strs()
293 rc = strs_create_and_add(strs, format_str, 3, classkey, perms+1, expr); in class_constraint_rules_to_strs()
295 if (rc != 0) { in class_constraint_rules_to_strs()
303 return rc; in class_constraint_rules_to_strs()
316 int rc = 0; in class_validatetrans_rules_to_strs() local
321 rc = -1; in class_validatetrans_rules_to_strs()
333 rc = strs_create_and_add(strs, format_str, 2, classkey, expr); in class_validatetrans_rules_to_strs()
335 if (rc != 0) { in class_validatetrans_rules_to_strs()
341 return rc; in class_validatetrans_rules_to_strs()
349 int rc = 0; in constraint_rules_to_strs() local
355 … rc = class_constraint_rules_to_strs(pdb, name, class, class->constraints, mls_strs, non_mls_strs); in constraint_rules_to_strs()
356 if (rc != 0) { in constraint_rules_to_strs()
366 return rc; in constraint_rules_to_strs()
374 int rc = 0; in validatetrans_rules_to_strs() local
380 rc = class_validatetrans_rules_to_strs(pdb, name, class->validatetrans, mls_strs, non_mls_strs); in validatetrans_rules_to_strs()
381 if (rc != 0) { in validatetrans_rules_to_strs()
391 return rc; in validatetrans_rules_to_strs()
422 int rc; in class_or_common_perms_to_str() local
424 rc = strs_init(&strs, permtab->nprim); in class_or_common_perms_to_str()
425 if (rc != 0) { in class_or_common_perms_to_str()
429 rc = hashtab_map(permtab->table, hashtab_ordered_to_strs, strs); in class_or_common_perms_to_str()
430 if (rc != 0) { in class_or_common_perms_to_str()
451 int rc = 0; in write_class_decl_rules_to_cil() local
493 rc = -1; in write_class_decl_rules_to_cil()
502 rc = -1; in write_class_decl_rules_to_cil()
510 rc = -1; in write_class_decl_rules_to_cil()
525 if (rc != 0) { in write_class_decl_rules_to_cil()
529 return rc; in write_class_decl_rules_to_cil()
541 int rc; in write_sids_to_cil() local
543 rc = strs_init(&strs, num_sids+1); in write_sids_to_cil()
544 if (rc != 0) { in write_sids_to_cil()
556 rc = strs_add_at_index(strs, sid, i); in write_sids_to_cil()
557 if (rc != 0) { in write_sids_to_cil()
593 if (rc != 0) { in write_sids_to_cil()
597 return rc; in write_sids_to_cil()
602 int rc = 0; in write_sid_decl_rules_to_cil() local
605 rc = write_sids_to_cil(out, selinux_sid_to_str, SELINUX_SID_SZ, in write_sid_decl_rules_to_cil()
608 rc = write_sids_to_cil(out, xen_sid_to_str, XEN_SID_SZ, in write_sid_decl_rules_to_cil()
612 rc = -1; in write_sid_decl_rules_to_cil()
615 return rc; in write_sid_decl_rules_to_cil()
714 int rc = 0; in write_default_rules_to_cil() local
720 rc = write_default_user_to_cil(out, pdb->p_class_val_to_name[i], class); in write_default_rules_to_cil()
721 if (rc != 0) { in write_default_rules_to_cil()
731 rc = write_default_role_to_cil(out, pdb->p_class_val_to_name[i], class); in write_default_rules_to_cil()
732 if (rc != 0) { in write_default_rules_to_cil()
742 rc = write_default_type_to_cil(out, pdb->p_class_val_to_name[i], class); in write_default_rules_to_cil()
743 if (rc != 0) { in write_default_rules_to_cil()
757 rc = write_default_range_to_cil(out, pdb->p_class_val_to_name[i], class); in write_default_rules_to_cil()
758 if (rc != 0) { in write_default_rules_to_cil()
765 if (rc != 0) { in write_default_rules_to_cil()
769 return rc; in write_default_rules_to_cil()
783 int rc = 0; in map_sensitivity_aliases_to_strs() local
786 rc = strs_add(strs, key); in map_sensitivity_aliases_to_strs()
789 return rc; in map_sensitivity_aliases_to_strs()
798 int rc = 0; in write_sensitivity_rules_to_cil() local
800 rc = strs_init(&strs, pdb->p_levels.nprim); in write_sensitivity_rules_to_cil()
801 if (rc != 0) { in write_sensitivity_rules_to_cil()
811 rc = -1; in write_sensitivity_rules_to_cil()
827 rc = -1; in write_sensitivity_rules_to_cil()
842 rc = hashtab_map(pdb->p_levels.table, map_sensitivity_aliases_to_strs, strs); in write_sensitivity_rules_to_cil()
843 if (rc != 0) { in write_sensitivity_rules_to_cil()
856 rc = -1; in write_sensitivity_rules_to_cil()
867 rc = -1; in write_sensitivity_rules_to_cil()
877 if (rc != 0) { in write_sensitivity_rules_to_cil()
881 return rc; in write_sensitivity_rules_to_cil()
888 int rc = 0; in map_category_aliases_to_strs() local
891 rc = strs_add(strs, key); in map_category_aliases_to_strs()
894 return rc; in map_category_aliases_to_strs()
903 int rc = 0; in write_category_rules_to_cil() local
905 rc = strs_init(&strs, pdb->p_levels.nprim); in write_category_rules_to_cil()
906 if (rc != 0) { in write_category_rules_to_cil()
916 rc = -1; in write_category_rules_to_cil()
932 rc = -1; in write_category_rules_to_cil()
947 rc = hashtab_map(pdb->p_cats.table, map_category_aliases_to_strs, strs); in write_category_rules_to_cil()
948 if (rc != 0) { in write_category_rules_to_cil()
961 rc = -1; in write_category_rules_to_cil()
972 rc = -1; in write_category_rules_to_cil()
982 if (rc != 0) { in write_category_rules_to_cil()
986 return rc; in write_category_rules_to_cil()
1090 int rc = 0; in write_sensitivitycategory_rules_to_cil() local
1098 rc = -1; in write_sensitivitycategory_rules_to_cil()
1111 if (rc != 0) { in write_sensitivitycategory_rules_to_cil()
1115 return rc; in write_sensitivitycategory_rules_to_cil()
1120 int rc = 0; in write_mls_rules_to_cil() local
1131 rc = write_sensitivity_rules_to_cil(out, pdb); in write_mls_rules_to_cil()
1132 if (rc != 0) { in write_mls_rules_to_cil()
1136 rc = write_category_rules_to_cil(out, pdb); in write_mls_rules_to_cil()
1137 if (rc != 0) { in write_mls_rules_to_cil()
1141 rc = write_sensitivitycategory_rules_to_cil(out, pdb); in write_mls_rules_to_cil()
1142 if (rc != 0) { in write_mls_rules_to_cil()
1147 if (rc != 0) { in write_mls_rules_to_cil()
1151 return rc; in write_mls_rules_to_cil()
1160 int rc = 0; in write_polcap_rules_to_cil() local
1162 rc = strs_init(&strs, 32); in write_polcap_rules_to_cil()
1163 if (rc != 0) { in write_polcap_rules_to_cil()
1173 rc = -1; in write_polcap_rules_to_cil()
1177 rc = strs_create_and_add(strs, "(policycap %s)", 1, name); in write_polcap_rules_to_cil()
1178 if (rc != 0) { in write_polcap_rules_to_cil()
1190 if (rc != 0) { in write_polcap_rules_to_cil()
1194 return rc; in write_polcap_rules_to_cil()
1203 int rc = 0; in write_type_attributes_to_cil() local
1205 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_attributes_to_cil()
1206 if (rc != 0) { in write_type_attributes_to_cil()
1213 rc = strs_add(strs, pdb->p_type_val_to_name[i]); in write_type_attributes_to_cil()
1214 if (rc != 0) { in write_type_attributes_to_cil()
1226 rc = -1; in write_type_attributes_to_cil()
1235 if (rc != 0) { in write_type_attributes_to_cil()
1239 return rc; in write_type_attributes_to_cil()
1248 int rc = 0; in write_role_attributes_to_cil() local
1250 rc = strs_init(&strs, pdb->p_roles.nprim); in write_role_attributes_to_cil()
1251 if (rc != 0) { in write_role_attributes_to_cil()
1258 rc = strs_add(strs, pdb->p_role_val_to_name[i]); in write_role_attributes_to_cil()
1259 if (rc != 0) { in write_role_attributes_to_cil()
1271 rc = -1; in write_role_attributes_to_cil()
1280 if (rc != 0) { in write_role_attributes_to_cil()
1284 return rc; in write_role_attributes_to_cil()
1301 int rc = 0; in write_boolean_decl_rules_to_cil() local
1303 rc = strs_init(&strs, 32); in write_boolean_decl_rules_to_cil()
1304 if (rc != 0) { in write_boolean_decl_rules_to_cil()
1308 rc = hashtab_map(pdb->p_bools.table, map_boolean_to_strs, strs); in write_boolean_decl_rules_to_cil()
1309 if (rc != 0) { in write_boolean_decl_rules_to_cil()
1320 if (rc != 0) { in write_boolean_decl_rules_to_cil()
1324 return rc; in write_boolean_decl_rules_to_cil()
1333 int rc = 0; in write_type_decl_rules_to_cil() local
1335 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_decl_rules_to_cil()
1336 if (rc != 0) { in write_type_decl_rules_to_cil()
1343 rc = strs_add(strs, pdb->p_type_val_to_name[i]); in write_type_decl_rules_to_cil()
1344 if (rc != 0) { in write_type_decl_rules_to_cil()
1356 rc = -1; in write_type_decl_rules_to_cil()
1365 if (rc != 0) { in write_type_decl_rules_to_cil()
1369 return rc; in write_type_decl_rules_to_cil()
1379 int rc = 0; in write_type_alias_rules_to_cil() local
1381 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_alias_rules_to_cil()
1382 if (rc != 0) { in write_type_alias_rules_to_cil()
1389 rc = strs_add(strs, pdb->p_type_val_to_name[i]); in write_type_alias_rules_to_cil()
1390 if (rc != 0) { in write_type_alias_rules_to_cil()
1402 rc = -1; in write_type_alias_rules_to_cil()
1411 rc = -1; in write_type_alias_rules_to_cil()
1416 rc = -1; in write_type_alias_rules_to_cil()
1426 if (rc != 0) { in write_type_alias_rules_to_cil()
1430 return rc; in write_type_alias_rules_to_cil()
1440 int rc = 0; in write_type_bounds_rules_to_cil() local
1442 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_bounds_rules_to_cil()
1443 if (rc != 0) { in write_type_bounds_rules_to_cil()
1451 rc = strs_add(strs, pdb->p_type_val_to_name[i]); in write_type_bounds_rules_to_cil()
1452 if (rc != 0) { in write_type_bounds_rules_to_cil()
1465 rc = -1; in write_type_bounds_rules_to_cil()
1470 rc = -1; in write_type_bounds_rules_to_cil()
1480 if (rc != 0) { in write_type_bounds_rules_to_cil()
1484 return rc; in write_type_bounds_rules_to_cil()
1494 int rc; in write_type_attribute_sets_to_cil() local
1496 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_attribute_sets_to_cil()
1497 if (rc != 0) { in write_type_attribute_sets_to_cil()
1509 rc = -1; in write_type_attribute_sets_to_cil()
1513 rc = strs_create_and_add(strs, "(typeattributeset %s (%s))", in write_type_attribute_sets_to_cil()
1516 if (rc != 0) { in write_type_attribute_sets_to_cil()
1528 if (rc != 0) { in write_type_attribute_sets_to_cil()
1532 return rc; in write_type_attribute_sets_to_cil()
1541 int rc = 0; in write_type_permissive_rules_to_cil() local
1543 rc = strs_init(&strs, pdb->p_types.nprim); in write_type_permissive_rules_to_cil()
1544 if (rc != 0) { in write_type_permissive_rules_to_cil()
1550 rc = strs_add(strs, pdb->p_type_val_to_name[i-1]); in write_type_permissive_rules_to_cil()
1551 if (rc != 0) { in write_type_permissive_rules_to_cil()
1562 rc = -1; in write_type_permissive_rules_to_cil()
1571 if (rc != 0) { in write_type_permissive_rules_to_cil()
1575 return rc; in write_type_permissive_rules_to_cil()
1751 int rc = 0; in map_avtab_write_helper() local
1756 rc = -1; in map_avtab_write_helper()
1759 rc = strs_add(strs, rule); in map_avtab_write_helper()
1760 if (rc != 0) { in map_avtab_write_helper()
1767 return rc; in map_avtab_write_helper()
1774 int rc = 0; in write_avtab_flavor_to_cil() local
1776 rc = strs_init(&strs, 1000); in write_avtab_flavor_to_cil()
1777 if (rc != 0) { in write_avtab_flavor_to_cil()
1785 rc = avtab_map(&pdb->te_avtab, map_avtab_write_helper, &args); in write_avtab_flavor_to_cil()
1786 if (rc != 0) { in write_avtab_flavor_to_cil()
1797 return rc; in write_avtab_flavor_to_cil()
1803 int rc = 0; in write_avtab_to_cil() local
1806 rc = write_avtab_flavor_to_cil(out, pdb, avtab_flavors[i], indent); in write_avtab_to_cil()
1807 if (rc != 0) { in write_avtab_to_cil()
1813 if (rc != 0) { in write_avtab_to_cil()
1817 return rc; in write_avtab_to_cil()
1848 int rc = 0; in write_filename_trans_rules_to_cil() local
1850 rc = strs_init(&strs, 100); in write_filename_trans_rules_to_cil()
1851 if (rc != 0) { in write_filename_trans_rules_to_cil()
1858 rc = hashtab_map(pdb->filename_trans, map_filename_trans_to_str, &args); in write_filename_trans_rules_to_cil()
1859 if (rc != 0) { in write_filename_trans_rules_to_cil()
1870 if (rc != 0) { in write_filename_trans_rules_to_cil()
1874 return rc; in write_filename_trans_rules_to_cil()
1933 int rc; in map_range_trans_to_str() local
1940 rc = -1; in map_range_trans_to_str()
1944 rc = strs_create_and_add(strs, "(rangetransition %s %s %s %s)", 4, in map_range_trans_to_str()
1947 if (rc != 0) { in map_range_trans_to_str()
1952 return rc; in map_range_trans_to_str()
1959 int rc = 0; in write_range_trans_rules_to_cil() local
1961 rc = strs_init(&strs, 100); in write_range_trans_rules_to_cil()
1962 if (rc != 0) { in write_range_trans_rules_to_cil()
1969 rc = hashtab_map(pdb->range_tr, map_range_trans_to_str, &args); in write_range_trans_rules_to_cil()
1970 if (rc != 0) { in write_range_trans_rules_to_cil()
1981 if (rc != 0) { in write_range_trans_rules_to_cil()
1985 return rc; in write_range_trans_rules_to_cil()
1998 int rc; in write_cond_av_list_to_cil() local
2002 rc = strs_init(&strs, 64); in write_cond_av_list_to_cil()
2003 if (rc != 0) { in write_cond_av_list_to_cil()
2014 rc = -1; in write_cond_av_list_to_cil()
2017 rc = strs_add(strs, rule); in write_cond_av_list_to_cil()
2018 if (rc != 0) { in write_cond_av_list_to_cil()
2036 return rc; in write_cond_av_list_to_cil()
2057 int rc = 0; in write_cond_nodes_to_cil() local
2065 rc = -1; in write_cond_nodes_to_cil()
2092 rc = write_cond_av_list_to_cil(out, pdb, cond->true_list, 2); in write_cond_nodes_to_cil()
2093 if (rc != 0) { in write_cond_nodes_to_cil()
2103 rc = write_cond_av_list_to_cil(out, pdb, cond->false_list, 2); in write_cond_nodes_to_cil()
2104 if (rc != 0) { in write_cond_nodes_to_cil()
2121 if (rc != 0) { in write_cond_nodes_to_cil()
2125 return rc; in write_cond_nodes_to_cil()
2136 int rc = 0; in write_role_decl_rules_to_cil() local
2138 rc = strs_init(&strs, pdb->p_roles.nprim); in write_role_decl_rules_to_cil()
2139 if (rc != 0) { in write_role_decl_rules_to_cil()
2146 rc = strs_add(strs, pdb->p_role_val_to_name[i]); in write_role_decl_rules_to_cil()
2147 if (rc != 0) { in write_role_decl_rules_to_cil()
2172 rc = -1; in write_role_decl_rules_to_cil()
2189 rc = -1; in write_role_decl_rules_to_cil()
2194 rc = strs_init(&type_strs, pdb->p_types.nprim); in write_role_decl_rules_to_cil()
2195 if (rc != 0) { in write_role_decl_rules_to_cil()
2198 rc = ebitmap_to_strs(types, type_strs, pdb->p_type_val_to_name); in write_role_decl_rules_to_cil()
2199 if (rc != 0) { in write_role_decl_rules_to_cil()
2216 rc = strs_init(&strs, pdb->p_types.nprim); in write_role_decl_rules_to_cil()
2217 if (rc != 0) { in write_role_decl_rules_to_cil()
2224 rc = strs_add(strs, pdb->p_type_val_to_name[i]); in write_role_decl_rules_to_cil()
2225 if (rc != 0) { in write_role_decl_rules_to_cil()
2246 if (rc != 0) { in write_role_decl_rules_to_cil()
2250 return rc; in write_role_decl_rules_to_cil()
2258 int rc = 0; in write_role_transition_rules_to_cil() local
2260 rc = strs_init(&strs, 32); in write_role_transition_rules_to_cil()
2261 if (rc != 0) { in write_role_transition_rules_to_cil()
2271 rc = strs_create_and_add(strs, "(roletransition %s %s %s %s)", 4, in write_role_transition_rules_to_cil()
2273 if (rc != 0) { in write_role_transition_rules_to_cil()
2287 if (rc != 0) { in write_role_transition_rules_to_cil()
2291 return rc; in write_role_transition_rules_to_cil()
2299 int rc = 0; in write_role_allow_rules_to_cil() local
2301 rc = strs_init(&strs, 32); in write_role_allow_rules_to_cil()
2302 if (rc != 0) { in write_role_allow_rules_to_cil()
2310 rc = strs_create_and_add(strs, "(roleallow %s %s)", 2, role, new); in write_role_allow_rules_to_cil()
2311 if (rc != 0) { in write_role_allow_rules_to_cil()
2325 if (rc != 0) { in write_role_allow_rules_to_cil()
2329 return rc; in write_role_allow_rules_to_cil()
2339 int rc = 0; in write_user_decl_rules_to_cil() local
2341 rc = strs_init(&strs, pdb->p_users.nprim); in write_user_decl_rules_to_cil()
2342 if (rc != 0) { in write_user_decl_rules_to_cil()
2347 rc = strs_add(strs, pdb->p_user_val_to_name[i]); in write_user_decl_rules_to_cil()
2348 if (rc != 0) { in write_user_decl_rules_to_cil()
2373 rc = -1; in write_user_decl_rules_to_cil()
2379 rc = strs_init(&role_strs, pdb->p_roles.nprim); in write_user_decl_rules_to_cil()
2380 if (rc != 0) { in write_user_decl_rules_to_cil()
2383 rc = ebitmap_to_strs(roles, role_strs, pdb->p_role_val_to_name); in write_user_decl_rules_to_cil()
2384 if (rc != 0) { in write_user_decl_rules_to_cil()
2389 rc = strs_add(role_strs, (char *)DEFAULT_OBJECT); in write_user_decl_rules_to_cil()
2390 if (rc != 0) { in write_user_decl_rules_to_cil()
2414 rc = -1; in write_user_decl_rules_to_cil()
2423 rc = -1; in write_user_decl_rules_to_cil()
2442 rc = -1; in write_user_decl_rules_to_cil()
2450 rc = -1; in write_user_decl_rules_to_cil()
2464 if (rc != 0) { in write_user_decl_rules_to_cil()
2468 return rc; in write_user_decl_rules_to_cil()
2504 int rc = -1; in write_sid_context_rules_to_cil() local
2506 rc = strs_init(&strs, 32); in write_sid_context_rules_to_cil()
2507 if (rc != 0) { in write_sid_context_rules_to_cil()
2522 rc = -1; in write_sid_context_rules_to_cil()
2529 rc = -1; in write_sid_context_rules_to_cil()
2533 rc = strs_add_at_index(strs, rule, i); in write_sid_context_rules_to_cil()
2534 if (rc != 0) { in write_sid_context_rules_to_cil()
2546 if (rc != 0) { in write_sid_context_rules_to_cil()
2550 return rc; in write_sid_context_rules_to_cil()
2564 int rc = 0; in write_selinux_fsuse_rules_to_cil() local
2573 rc = -1; in write_selinux_fsuse_rules_to_cil()
2580 rc = -1; in write_selinux_fsuse_rules_to_cil()
2590 if (rc != 0) { in write_selinux_fsuse_rules_to_cil()
2594 return rc; in write_selinux_fsuse_rules_to_cil()
2603 int rc; in write_genfscon_rules_to_cil() local
2605 rc = strs_init(&strs, 32); in write_genfscon_rules_to_cil()
2606 if (rc != 0) { in write_genfscon_rules_to_cil()
2617 rc = -1; in write_genfscon_rules_to_cil()
2621 rc = strs_create_and_add(strs, "(genfscon %s %s %s)", 3, in write_genfscon_rules_to_cil()
2624 if (rc != 0) { in write_genfscon_rules_to_cil()
2637 if (rc != 0) { in write_genfscon_rules_to_cil()
2641 return rc; in write_genfscon_rules_to_cil()
2652 int rc = 0; in write_selinux_port_rules_to_cil() local
2662 rc = -1; in write_selinux_port_rules_to_cil()
2669 rc = snprintf(low_high_str, 44, "%u", low); in write_selinux_port_rules_to_cil()
2671 rc = snprintf(low_high_str, 44, "(%u %u)", low, high); in write_selinux_port_rules_to_cil()
2673 if (rc < 0 || rc >= 44) { in write_selinux_port_rules_to_cil()
2674 rc = -1; in write_selinux_port_rules_to_cil()
2680 rc = -1; in write_selinux_port_rules_to_cil()
2689 rc = 0; in write_selinux_port_rules_to_cil()
2692 if (rc != 0) { in write_selinux_port_rules_to_cil()
2696 return rc; in write_selinux_port_rules_to_cil()
2703 int rc = 0; in write_selinux_netif_rules_to_cil() local
2709 rc = -1; in write_selinux_netif_rules_to_cil()
2715 rc = -1; in write_selinux_netif_rules_to_cil()
2726 if (rc != 0) { in write_selinux_netif_rules_to_cil()
2730 return rc; in write_selinux_netif_rules_to_cil()
2739 int rc = 0; in write_selinux_node_rules_to_cil() local
2744 rc = -1; in write_selinux_node_rules_to_cil()
2750 rc = -1; in write_selinux_node_rules_to_cil()
2756 rc = -1; in write_selinux_node_rules_to_cil()
2766 if (rc != 0) { in write_selinux_node_rules_to_cil()
2770 return rc; in write_selinux_node_rules_to_cil()
2779 int rc = 0; in write_selinux_node6_rules_to_cil() local
2784 rc = -1; in write_selinux_node6_rules_to_cil()
2790 rc = -1; in write_selinux_node6_rules_to_cil()
2796 rc = -1; in write_selinux_node6_rules_to_cil()
2806 if (rc != 0) { in write_selinux_node6_rules_to_cil()
2810 return rc; in write_selinux_node6_rules_to_cil()
2822 int rc = 0; in write_selinux_ibpkey_rules_to_cil() local
2833 rc = -1; in write_selinux_ibpkey_rules_to_cil()
2840 rc = snprintf(low_high_str, 44, "%u", low); in write_selinux_ibpkey_rules_to_cil()
2842 rc = snprintf(low_high_str, 44, "(%u %u)", low, high); in write_selinux_ibpkey_rules_to_cil()
2844 if (rc < 0 || rc >= 44) { in write_selinux_ibpkey_rules_to_cil()
2845 rc = -1; in write_selinux_ibpkey_rules_to_cil()
2851 rc = -1; in write_selinux_ibpkey_rules_to_cil()
2860 rc = 0; in write_selinux_ibpkey_rules_to_cil()
2863 if (rc != 0) { in write_selinux_ibpkey_rules_to_cil()
2867 return rc; in write_selinux_ibpkey_rules_to_cil()
2875 int rc = 0; in write_selinux_ibendport_rules_to_cil() local
2879 rc = snprintf(port_str, 4, "%u", ibendportcon->u.ibendport.port); in write_selinux_ibendport_rules_to_cil()
2880 if (rc < 0 || rc >= 4) { in write_selinux_ibendport_rules_to_cil()
2881 rc = -1; in write_selinux_ibendport_rules_to_cil()
2887 rc = -1; in write_selinux_ibendport_rules_to_cil()
2897 rc = 0; in write_selinux_ibendport_rules_to_cil()
2900 if (rc != 0) { in write_selinux_ibendport_rules_to_cil()
2904 return rc; in write_selinux_ibendport_rules_to_cil()
2917 int rc = 0; in write_xen_pirq_rules_to_cil() local
2920 rc = snprintf(pirq_str, 21, "%i", pirq->u.pirq); in write_xen_pirq_rules_to_cil()
2921 if (rc < 0 || rc >= 21) { in write_xen_pirq_rules_to_cil()
2922 rc = -1; in write_xen_pirq_rules_to_cil()
2928 rc = -1; in write_xen_pirq_rules_to_cil()
2937 rc = 0; in write_xen_pirq_rules_to_cil()
2940 if (rc != 0) { in write_xen_pirq_rules_to_cil()
2944 return rc; in write_xen_pirq_rules_to_cil()
2954 int rc = 0; in write_xen_ioport_rules_to_cil() local
2960 rc = snprintf(low_high_str, 40, "0x%x", low); in write_xen_ioport_rules_to_cil()
2962 rc = snprintf(low_high_str, 40, "(0x%x 0x%x)", low, high); in write_xen_ioport_rules_to_cil()
2964 if (rc < 0 || rc >= 40) { in write_xen_ioport_rules_to_cil()
2965 rc = -1; in write_xen_ioport_rules_to_cil()
2971 rc = -1; in write_xen_ioport_rules_to_cil()
2980 rc = 0; in write_xen_ioport_rules_to_cil()
2983 if (rc != 0) { in write_xen_ioport_rules_to_cil()
2987 return rc; in write_xen_ioport_rules_to_cil()
2997 int rc = 0; in write_xen_iomem_rules_to_cil() local
3003 rc = snprintf(low_high_str, 40, "0x%"PRIx64, low); in write_xen_iomem_rules_to_cil()
3005 rc = snprintf(low_high_str, 40, "(0x%"PRIx64" 0x%"PRIx64")", low, high); in write_xen_iomem_rules_to_cil()
3007 if (rc < 0 || rc >= 40) { in write_xen_iomem_rules_to_cil()
3008 rc = -1; in write_xen_iomem_rules_to_cil()
3014 rc = -1; in write_xen_iomem_rules_to_cil()
3023 rc = 0; in write_xen_iomem_rules_to_cil()
3026 if (rc != 0) { in write_xen_iomem_rules_to_cil()
3030 return rc; in write_xen_iomem_rules_to_cil()
3038 int rc = 0; in write_xen_pcidevice_rules_to_cil() local
3041 rc = snprintf(device_str, 20, "0x%lx", (unsigned long)pcid->u.device); in write_xen_pcidevice_rules_to_cil()
3042 if (rc < 0 || rc >= 20) { in write_xen_pcidevice_rules_to_cil()
3043 rc = -1; in write_xen_pcidevice_rules_to_cil()
3049 rc = -1; in write_xen_pcidevice_rules_to_cil()
3058 rc = 0; in write_xen_pcidevice_rules_to_cil()
3061 if (rc != 0) { in write_xen_pcidevice_rules_to_cil()
3065 return rc; in write_xen_pcidevice_rules_to_cil()
3072 int rc = 0; in write_xen_devicetree_rules_to_cil() local
3078 rc = -1; in write_xen_devicetree_rules_to_cil()
3088 if (rc != 0) { in write_xen_devicetree_rules_to_cil()
3092 return rc; in write_xen_devicetree_rules_to_cil()
3101 int rc = 0; in sepol_kernel_policydb_to_cil() local
3103 rc = strs_init(&mls_constraints, 32); in sepol_kernel_policydb_to_cil()
3104 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3108 rc = strs_init(&non_mls_constraints, 32); in sepol_kernel_policydb_to_cil()
3109 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3113 rc = strs_init(&mls_validatetrans, 32); in sepol_kernel_policydb_to_cil()
3114 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3118 rc = strs_init(&non_mls_validatetrans, 32); in sepol_kernel_policydb_to_cil()
3119 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3125 rc = -1; in sepol_kernel_policydb_to_cil()
3131 rc = -1; in sepol_kernel_policydb_to_cil()
3135 rc = constraint_rules_to_strs(pdb, mls_constraints, non_mls_constraints); in sepol_kernel_policydb_to_cil()
3136 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3140 rc = validatetrans_rules_to_strs(pdb, mls_validatetrans, non_mls_validatetrans); in sepol_kernel_policydb_to_cil()
3141 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3145 rc = write_handle_unknown_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3146 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3150 rc = write_class_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3151 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3155 rc = write_sid_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3156 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3160 rc = write_default_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3161 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3165 rc = write_mls_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3166 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3173 rc = write_polcap_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3174 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3178 rc = write_type_attributes_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3179 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3183 rc = write_role_attributes_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3184 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3188 rc = write_boolean_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3189 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3193 rc = write_type_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3194 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3198 rc = write_type_alias_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3199 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3203 rc = write_type_bounds_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3204 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3208 rc = write_type_attribute_sets_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3209 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3213 rc = write_type_permissive_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3214 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3218 rc = write_avtab_to_cil(out, pdb, 0); in sepol_kernel_policydb_to_cil()
3219 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3223 rc = write_filename_trans_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3224 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3229 rc = write_range_trans_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3230 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3235 rc = write_cond_nodes_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3236 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3240 rc = write_role_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3241 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3245 rc = write_role_transition_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3246 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3250 rc = write_role_allow_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3251 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3255 rc = write_user_decl_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3256 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3263 rc = sort_ocontexts(pdb); in sepol_kernel_policydb_to_cil()
3264 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3269 rc = write_selinux_isid_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3270 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3274 rc = write_selinux_fsuse_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3275 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3279 rc = write_genfscon_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3280 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3284 rc = write_selinux_port_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3285 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3289 rc = write_selinux_netif_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3290 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3294 rc = write_selinux_node_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3295 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3299 rc = write_selinux_node6_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3300 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3304 rc = write_selinux_ibpkey_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3305 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3309 rc = write_selinux_ibendport_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3310 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3314 rc = write_xen_isid_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3315 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3319 rc = write_xen_pirq_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3320 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3324 rc = write_xen_ioport_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3325 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3329 rc = write_xen_iomem_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3330 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3334 rc = write_xen_pcidevice_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3335 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3339 rc = write_xen_devicetree_rules_to_cil(out, pdb); in sepol_kernel_policydb_to_cil()
3340 if (rc != 0) { in sepol_kernel_policydb_to_cil()
3355 return rc; in sepol_kernel_policydb_to_cil()