| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#include "test-expander-attr-map.h" |
| 23 |
#include "test-common.h" |
| 24 |
|
| 25 |
#include <sepol/policydb/policydb.h> |
| 26 |
#include <CUnit/Basic.h> |
| 27 |
#include <stdlib.h> |
| 28 |
|
| 29 |
extern policydb_t base_expanded2; |
| 30 |
|
| 31 |
void test_expander_attr_mapping(void) |
| 32 |
{ |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
const char *typesb1[] = { "attr_check_base_1_1_t", "attr_check_base_1_2_t" }; |
| 39 |
const char *typesb2[] = { "attr_check_base_2_1_t", "attr_check_base_2_2_t" }; |
| 40 |
const char *typesb3[] = { "attr_check_base_3_1_t", "attr_check_base_3_2_t", |
| 41 |
"attr_check_base_3_3_t", "attr_check_base_3_4_t" |
| 42 |
}; |
| 43 |
const char *typesb4[] = { "attr_check_base_4_1_t", "attr_check_base_4_2_t" }; |
| 44 |
const char *typesb5[] = { "attr_check_base_5_1_t", "attr_check_base_5_2_t" }; |
| 45 |
const char *typesb6[] = { "attr_check_base_6_1_t", "attr_check_base_6_2_t", |
| 46 |
"attr_check_base_6_3_t", "attr_check_base_6_4_t" |
| 47 |
}; |
| 48 |
const char *typesbo2[] = { "attr_check_base_optional_2_1_t", |
| 49 |
"attr_check_base_optional_2_2_t" |
| 50 |
}; |
| 51 |
const char *typesbo5[] = { "attr_check_base_optional_5_1_t", |
| 52 |
"attr_check_base_optional_5_2_t" |
| 53 |
}; |
| 54 |
const char *typesm2[] = { "attr_check_mod_2_1_t", "attr_check_mod_2_2_t" }; |
| 55 |
const char *typesm4[] = { "attr_check_mod_4_1_t", "attr_check_mod_4_2_t" }; |
| 56 |
const char *typesm5[] = { "attr_check_mod_5_1_t", "attr_check_mod_5_2_t" }; |
| 57 |
const char *typesm6[] = { "attr_check_mod_6_1_t", "attr_check_mod_6_2_t", |
| 58 |
"attr_check_mod_6_3_t", "attr_check_mod_6_4_t" |
| 59 |
}; |
| 60 |
const char *typesmo2[] = { "attr_check_mod_optional_4_1_t", |
| 61 |
"attr_check_mod_optional_4_2_t" |
| 62 |
}; |
| 63 |
const char *typesb10[] = { "attr_check_base_10_1_t", "attr_check_base_10_2_t" }; |
| 64 |
const char *typesb11[] = { "attr_check_base_11_3_t", "attr_check_base_11_4_t" }; |
| 65 |
const char *typesm10[] = { "attr_check_mod_10_1_t", "attr_check_mod_10_2_t" }; |
| 66 |
const char *typesm11[] = { "attr_check_mod_11_3_t", "attr_check_mod_11_4_t" }; |
| 67 |
|
| 68 |
test_attr_types(&base_expanded2, "attr_check_base_1", NULL, typesb1, 2); |
| 69 |
test_attr_types(&base_expanded2, "attr_check_base_2", NULL, typesb2, 2); |
| 70 |
test_attr_types(&base_expanded2, "attr_check_base_3", NULL, typesb3, 4); |
| 71 |
test_attr_types(&base_expanded2, "attr_check_base_4", NULL, typesb4, 2); |
| 72 |
test_attr_types(&base_expanded2, "attr_check_base_5", NULL, typesb5, 2); |
| 73 |
test_attr_types(&base_expanded2, "attr_check_base_6", NULL, typesb6, 4); |
| 74 |
test_attr_types(&base_expanded2, "attr_check_base_optional_2", NULL, typesbo2, 2); |
| 75 |
test_attr_types(&base_expanded2, "attr_check_base_optional_5", NULL, typesbo5, 2); |
| 76 |
test_attr_types(&base_expanded2, "attr_check_mod_2", NULL, typesm2, 2); |
| 77 |
test_attr_types(&base_expanded2, "attr_check_mod_4", NULL, typesm4, 2); |
| 78 |
test_attr_types(&base_expanded2, "attr_check_mod_5", NULL, typesm5, 2); |
| 79 |
test_attr_types(&base_expanded2, "attr_check_mod_6", NULL, typesm6, 4); |
| 80 |
test_attr_types(&base_expanded2, "attr_check_mod_optional_4", NULL, typesmo2, 2); |
| 81 |
test_attr_types(&base_expanded2, "attr_check_base_7", NULL, NULL, 0); |
| 82 |
test_attr_types(&base_expanded2, "attr_check_base_8", NULL, NULL, 0); |
| 83 |
test_attr_types(&base_expanded2, "attr_check_base_9", NULL, NULL, 0); |
| 84 |
test_attr_types(&base_expanded2, "attr_check_base_10", NULL, typesb10, 2); |
| 85 |
test_attr_types(&base_expanded2, "attr_check_base_11", NULL, typesb11, 2); |
| 86 |
test_attr_types(&base_expanded2, "attr_check_mod_7", NULL, NULL, 0); |
| 87 |
test_attr_types(&base_expanded2, "attr_check_mod_8", NULL, NULL, 0); |
| 88 |
test_attr_types(&base_expanded2, "attr_check_mod_9", NULL, NULL, 0); |
| 89 |
test_attr_types(&base_expanded2, "attr_check_mod_10", NULL, typesm10, 2); |
| 90 |
test_attr_types(&base_expanded2, "attr_check_mod_11", NULL, typesm11, 2); |
| 91 |
test_attr_types(&base_expanded2, "attr_check_base_optional_8", NULL, NULL, 0); |
| 92 |
test_attr_types(&base_expanded2, "attr_check_mod_optional_7", NULL, NULL, 0); |
| 93 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_5")); |
| 94 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_5_1_t")); |
| 95 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_5_2_t")); |
| 96 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_8")); |
| 97 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_8_1_t")); |
| 98 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_base_optional_disabled_8_2_t")); |
| 99 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_4")); |
| 100 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_4_1_t")); |
| 101 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_4_2_t")); |
| 102 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_7")); |
| 103 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_7_1_t")); |
| 104 |
CU_ASSERT(!hashtab_search((&base_expanded2)->p_types.table, "attr_check_mod_optional_disabled_7_2_t")); |
| 105 |
} |