1*2d543d20SAndroid Build Coastguard Worker /*
2*2d543d20SAndroid Build Coastguard Worker * Author: Karl MacMillan <[email protected]>
3*2d543d20SAndroid Build Coastguard Worker *
4*2d543d20SAndroid Build Coastguard Worker * Copyright (C) 2006 Tresys Technology, LLC
5*2d543d20SAndroid Build Coastguard Worker *
6*2d543d20SAndroid Build Coastguard Worker * This library is free software; you can redistribute it and/or
7*2d543d20SAndroid Build Coastguard Worker * modify it under the terms of the GNU Lesser General Public
8*2d543d20SAndroid Build Coastguard Worker * License as published by the Free Software Foundation; either
9*2d543d20SAndroid Build Coastguard Worker * version 2.1 of the License, or (at your option) any later version.
10*2d543d20SAndroid Build Coastguard Worker *
11*2d543d20SAndroid Build Coastguard Worker * This library is distributed in the hope that it will be useful,
12*2d543d20SAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*2d543d20SAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14*2d543d20SAndroid Build Coastguard Worker * Lesser General Public License for more details.
15*2d543d20SAndroid Build Coastguard Worker *
16*2d543d20SAndroid Build Coastguard Worker * You should have received a copy of the GNU Lesser General Public
17*2d543d20SAndroid Build Coastguard Worker * License along with this library; if not, write to the Free Software
18*2d543d20SAndroid Build Coastguard Worker * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19*2d543d20SAndroid Build Coastguard Worker */
20*2d543d20SAndroid Build Coastguard Worker
21*2d543d20SAndroid Build Coastguard Worker #include "test-deps.h"
22*2d543d20SAndroid Build Coastguard Worker #include "parse_util.h"
23*2d543d20SAndroid Build Coastguard Worker #include "helpers.h"
24*2d543d20SAndroid Build Coastguard Worker
25*2d543d20SAndroid Build Coastguard Worker #include <sepol/policydb/policydb.h>
26*2d543d20SAndroid Build Coastguard Worker #include <sepol/policydb/link.h>
27*2d543d20SAndroid Build Coastguard Worker
28*2d543d20SAndroid Build Coastguard Worker #include <stdlib.h>
29*2d543d20SAndroid Build Coastguard Worker
30*2d543d20SAndroid Build Coastguard Worker /* Tests for dependency checking / handling, specifically:
31*2d543d20SAndroid Build Coastguard Worker *
32*2d543d20SAndroid Build Coastguard Worker * 1 type in module global.
33*2d543d20SAndroid Build Coastguard Worker * 2 attribute in module global.
34*2d543d20SAndroid Build Coastguard Worker * 3 object class / perm in module global.
35*2d543d20SAndroid Build Coastguard Worker * 4 boolean in module global.
36*2d543d20SAndroid Build Coastguard Worker * 5 role in module global.
37*2d543d20SAndroid Build Coastguard Worker *
38*2d543d20SAndroid Build Coastguard Worker * 6 type in module optional.
39*2d543d20SAndroid Build Coastguard Worker * 7 attribute in module optional.
40*2d543d20SAndroid Build Coastguard Worker * 8 object class / perm in module optional.
41*2d543d20SAndroid Build Coastguard Worker * 9 boolean in module optional.
42*2d543d20SAndroid Build Coastguard Worker * 10 role in module optional.
43*2d543d20SAndroid Build Coastguard Worker *
44*2d543d20SAndroid Build Coastguard Worker * 11 type in base optional.
45*2d543d20SAndroid Build Coastguard Worker * 12 attribute in base optional.
46*2d543d20SAndroid Build Coastguard Worker * 13 object class / perm in base optional.
47*2d543d20SAndroid Build Coastguard Worker * 14 boolean in base optional.
48*2d543d20SAndroid Build Coastguard Worker * 15 role in base optional.
49*2d543d20SAndroid Build Coastguard Worker *
50*2d543d20SAndroid Build Coastguard Worker * Each of these tests are done with the dependency met and not
51*2d543d20SAndroid Build Coastguard Worker * met. Additionally, each of the required symbols is used in the
52*2d543d20SAndroid Build Coastguard Worker * scope it is required.
53*2d543d20SAndroid Build Coastguard Worker *
54*2d543d20SAndroid Build Coastguard Worker * In addition to the simple tests, we have test with more complex
55*2d543d20SAndroid Build Coastguard Worker * modules that test:
56*2d543d20SAndroid Build Coastguard Worker *
57*2d543d20SAndroid Build Coastguard Worker * 17 mutual dependencies between two modules.
58*2d543d20SAndroid Build Coastguard Worker * 18 circular dependency between three modules.
59*2d543d20SAndroid Build Coastguard Worker * 19 large number of dependencies in a module with a more complex base.
60*2d543d20SAndroid Build Coastguard Worker * 20 nested optionals with requires.
61*2d543d20SAndroid Build Coastguard Worker *
62*2d543d20SAndroid Build Coastguard Worker * Again, each of these tests is done with the requirements met and not
63*2d543d20SAndroid Build Coastguard Worker * met.
64*2d543d20SAndroid Build Coastguard Worker */
65*2d543d20SAndroid Build Coastguard Worker
66*2d543d20SAndroid Build Coastguard Worker #include <sepol/debug.h>
67*2d543d20SAndroid Build Coastguard Worker #include <sepol/handle.h>
68*2d543d20SAndroid Build Coastguard Worker
69*2d543d20SAndroid Build Coastguard Worker #include "helpers.h"
70*2d543d20SAndroid Build Coastguard Worker
71*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_TYPE_GLOBAL 0
72*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_ATTR_GLOBAL 1
73*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_OBJ_GLOBAL 2
74*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_BOOL_GLOBAL 3
75*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_ROLE_GLOBAL 4
76*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_PERM_GLOBAL 5
77*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_TYPE_OPT 6
78*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_ATTR_OPT 7
79*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_OBJ_OPT 8
80*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_BOOL_OPT 9
81*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_ROLE_OPT 10
82*2d543d20SAndroid Build Coastguard Worker #define BASE_MODREQ_PERM_OPT 11
83*2d543d20SAndroid Build Coastguard Worker #define NUM_BASES 12
84*2d543d20SAndroid Build Coastguard Worker
85*2d543d20SAndroid Build Coastguard Worker static policydb_t bases_met[NUM_BASES];
86*2d543d20SAndroid Build Coastguard Worker static policydb_t bases_notmet[NUM_BASES];
87*2d543d20SAndroid Build Coastguard Worker
88*2d543d20SAndroid Build Coastguard Worker extern int mls;
89*2d543d20SAndroid Build Coastguard Worker
deps_test_init(void)90*2d543d20SAndroid Build Coastguard Worker int deps_test_init(void)
91*2d543d20SAndroid Build Coastguard Worker {
92*2d543d20SAndroid Build Coastguard Worker int i;
93*2d543d20SAndroid Build Coastguard Worker
94*2d543d20SAndroid Build Coastguard Worker /* To test linking we need 1 base per link test and in
95*2d543d20SAndroid Build Coastguard Worker * order to load them in the init function we have
96*2d543d20SAndroid Build Coastguard Worker * to keep them all around. Not ideal, but it shouldn't
97*2d543d20SAndroid Build Coastguard Worker * matter too much.
98*2d543d20SAndroid Build Coastguard Worker */
99*2d543d20SAndroid Build Coastguard Worker for (i = 0; i < NUM_BASES; i++) {
100*2d543d20SAndroid Build Coastguard Worker if (test_load_policy(&bases_met[i], POLICY_BASE, mls, "test-deps", "base-metreq.conf"))
101*2d543d20SAndroid Build Coastguard Worker return -1;
102*2d543d20SAndroid Build Coastguard Worker }
103*2d543d20SAndroid Build Coastguard Worker
104*2d543d20SAndroid Build Coastguard Worker for (i = 0; i < NUM_BASES; i++) {
105*2d543d20SAndroid Build Coastguard Worker if (test_load_policy(&bases_notmet[i], POLICY_BASE, mls, "test-deps", "base-notmetreq.conf"))
106*2d543d20SAndroid Build Coastguard Worker return -1;
107*2d543d20SAndroid Build Coastguard Worker }
108*2d543d20SAndroid Build Coastguard Worker
109*2d543d20SAndroid Build Coastguard Worker return 0;
110*2d543d20SAndroid Build Coastguard Worker }
111*2d543d20SAndroid Build Coastguard Worker
deps_test_cleanup(void)112*2d543d20SAndroid Build Coastguard Worker int deps_test_cleanup(void)
113*2d543d20SAndroid Build Coastguard Worker {
114*2d543d20SAndroid Build Coastguard Worker int i;
115*2d543d20SAndroid Build Coastguard Worker
116*2d543d20SAndroid Build Coastguard Worker for (i = 0; i < NUM_BASES; i++) {
117*2d543d20SAndroid Build Coastguard Worker policydb_destroy(&bases_met[i]);
118*2d543d20SAndroid Build Coastguard Worker }
119*2d543d20SAndroid Build Coastguard Worker
120*2d543d20SAndroid Build Coastguard Worker for (i = 0; i < NUM_BASES; i++) {
121*2d543d20SAndroid Build Coastguard Worker policydb_destroy(&bases_notmet[i]);
122*2d543d20SAndroid Build Coastguard Worker }
123*2d543d20SAndroid Build Coastguard Worker
124*2d543d20SAndroid Build Coastguard Worker return 0;
125*2d543d20SAndroid Build Coastguard Worker }
126*2d543d20SAndroid Build Coastguard Worker
127*2d543d20SAndroid Build Coastguard Worker /* This function performs testing of the dependency handles for module global
128*2d543d20SAndroid Build Coastguard Worker * symbols. It is capable of testing 2 scenarios - the dependencies are met
129*2d543d20SAndroid Build Coastguard Worker * and the dependencies are not met.
130*2d543d20SAndroid Build Coastguard Worker *
131*2d543d20SAndroid Build Coastguard Worker * Parameters:
132*2d543d20SAndroid Build Coastguard Worker * req_met boolean indicating whether the base policy meets the
133*2d543d20SAndroid Build Coastguard Worker * requirements for the modules global block.
134*2d543d20SAndroid Build Coastguard Worker * b index of the base policy in the global bases_met array.
135*2d543d20SAndroid Build Coastguard Worker *
136*2d543d20SAndroid Build Coastguard Worker * policy name of the policy module to load for this test.
137*2d543d20SAndroid Build Coastguard Worker * decl_type name of the unique type found in the module's global
138*2d543d20SAndroid Build Coastguard Worker * section is to find that avrule_decl.
139*2d543d20SAndroid Build Coastguard Worker */
do_deps_modreq_global(int req_met,int b,const char * policy,const char * decl_type)140*2d543d20SAndroid Build Coastguard Worker static void do_deps_modreq_global(int req_met, int b, const char *policy, const char *decl_type)
141*2d543d20SAndroid Build Coastguard Worker {
142*2d543d20SAndroid Build Coastguard Worker policydb_t *base;
143*2d543d20SAndroid Build Coastguard Worker policydb_t mod;
144*2d543d20SAndroid Build Coastguard Worker policydb_t *mods[] = { &mod };
145*2d543d20SAndroid Build Coastguard Worker avrule_decl_t *decl;
146*2d543d20SAndroid Build Coastguard Worker int ret, link_ret;
147*2d543d20SAndroid Build Coastguard Worker sepol_handle_t *h;
148*2d543d20SAndroid Build Coastguard Worker
149*2d543d20SAndroid Build Coastguard Worker /* suppress error reporting - this is because we know that we
150*2d543d20SAndroid Build Coastguard Worker * are going to get errors and don't want libsepol complaining
151*2d543d20SAndroid Build Coastguard Worker * about it constantly. */
152*2d543d20SAndroid Build Coastguard Worker h = sepol_handle_create();
153*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(h != NULL);
154*2d543d20SAndroid Build Coastguard Worker sepol_msg_set_callback(h, NULL, NULL);
155*2d543d20SAndroid Build Coastguard Worker
156*2d543d20SAndroid Build Coastguard Worker if (req_met) {
157*2d543d20SAndroid Build Coastguard Worker base = &bases_met[b];
158*2d543d20SAndroid Build Coastguard Worker link_ret = 0;
159*2d543d20SAndroid Build Coastguard Worker } else {
160*2d543d20SAndroid Build Coastguard Worker base = &bases_notmet[b];
161*2d543d20SAndroid Build Coastguard Worker link_ret = -3;
162*2d543d20SAndroid Build Coastguard Worker }
163*2d543d20SAndroid Build Coastguard Worker
164*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(test_load_policy(&mod, POLICY_MOD, mls, "test-deps", policy) == 0);
165*2d543d20SAndroid Build Coastguard Worker
166*2d543d20SAndroid Build Coastguard Worker /* link the modules and check for the correct return value.
167*2d543d20SAndroid Build Coastguard Worker */
168*2d543d20SAndroid Build Coastguard Worker ret = link_modules(h, base, mods, 1, 0);
169*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(ret == link_ret);
170*2d543d20SAndroid Build Coastguard Worker policydb_destroy(&mod);
171*2d543d20SAndroid Build Coastguard Worker sepol_handle_destroy(h);
172*2d543d20SAndroid Build Coastguard Worker
173*2d543d20SAndroid Build Coastguard Worker if (!req_met)
174*2d543d20SAndroid Build Coastguard Worker return;
175*2d543d20SAndroid Build Coastguard Worker
176*2d543d20SAndroid Build Coastguard Worker decl = test_find_decl_by_sym(base, SYM_TYPES, decl_type);
177*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(decl != NULL);
178*2d543d20SAndroid Build Coastguard Worker
179*2d543d20SAndroid Build Coastguard Worker CU_ASSERT(decl->enabled == 1);
180*2d543d20SAndroid Build Coastguard Worker }
181*2d543d20SAndroid Build Coastguard Worker
182*2d543d20SAndroid Build Coastguard Worker /* Test that symbol require statements in the global scope of a module
183*2d543d20SAndroid Build Coastguard Worker * work correctly. This will cover tests 1 - 5 (described above).
184*2d543d20SAndroid Build Coastguard Worker *
185*2d543d20SAndroid Build Coastguard Worker * Each of these policies will require as few symbols as possible to
186*2d543d20SAndroid Build Coastguard Worker * use the required symbol in addition requiring (for example, the type
187*2d543d20SAndroid Build Coastguard Worker * test also requires an object class for an allow rule).
188*2d543d20SAndroid Build Coastguard Worker */
deps_modreq_global(void)189*2d543d20SAndroid Build Coastguard Worker static void deps_modreq_global(void)
190*2d543d20SAndroid Build Coastguard Worker {
191*2d543d20SAndroid Build Coastguard Worker /* object classes */
192*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_OBJ_GLOBAL, "modreq-obj-global.conf", "mod_global_t");
193*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_OBJ_GLOBAL, "modreq-obj-global.conf", "mod_global_t");
194*2d543d20SAndroid Build Coastguard Worker /* types */
195*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_TYPE_GLOBAL, "modreq-type-global.conf", "mod_global_t");
196*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_TYPE_GLOBAL, "modreq-type-global.conf", "mod_global_t");
197*2d543d20SAndroid Build Coastguard Worker /* attributes */
198*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_ATTR_GLOBAL, "modreq-attr-global.conf", "mod_global_t");
199*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_ATTR_GLOBAL, "modreq-attr-global.conf", "mod_global_t");
200*2d543d20SAndroid Build Coastguard Worker /* booleans */
201*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_BOOL_GLOBAL, "modreq-bool-global.conf", "mod_global_t");
202*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_BOOL_GLOBAL, "modreq-bool-global.conf", "mod_global_t");
203*2d543d20SAndroid Build Coastguard Worker /* roles */
204*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_ROLE_GLOBAL, "modreq-role-global.conf", "mod_global_t");
205*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_ROLE_GLOBAL, "modreq-role-global.conf", "mod_global_t");
206*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(1, BASE_MODREQ_PERM_GLOBAL, "modreq-perm-global.conf", "mod_global_t");
207*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_global(0, BASE_MODREQ_PERM_GLOBAL, "modreq-perm-global.conf", "mod_global_t");
208*2d543d20SAndroid Build Coastguard Worker }
209*2d543d20SAndroid Build Coastguard Worker
210*2d543d20SAndroid Build Coastguard Worker /* This function performs testing of the dependency handles for module optional
211*2d543d20SAndroid Build Coastguard Worker * symbols. It is capable of testing 2 scenarios - the dependencies are met
212*2d543d20SAndroid Build Coastguard Worker * and the dependencies are not met.
213*2d543d20SAndroid Build Coastguard Worker *
214*2d543d20SAndroid Build Coastguard Worker * Parameters:
215*2d543d20SAndroid Build Coastguard Worker * req_met boolean indicating whether the base policy meets the
216*2d543d20SAndroid Build Coastguard Worker * requirements for the modules global block.
217*2d543d20SAndroid Build Coastguard Worker * b index of the base policy in the global bases_met array.
218*2d543d20SAndroid Build Coastguard Worker *
219*2d543d20SAndroid Build Coastguard Worker * policy name of the policy module to load for this test.
220*2d543d20SAndroid Build Coastguard Worker * decl_type name of the unique type found in the module's global
221*2d543d20SAndroid Build Coastguard Worker * section is to find that avrule_decl.
222*2d543d20SAndroid Build Coastguard Worker */
do_deps_modreq_opt(int req_met,int ret_val,int b,const char * policy,const char * decl_type)223*2d543d20SAndroid Build Coastguard Worker static void do_deps_modreq_opt(int req_met, int ret_val, int b, const char *policy, const char *decl_type)
224*2d543d20SAndroid Build Coastguard Worker {
225*2d543d20SAndroid Build Coastguard Worker policydb_t *base;
226*2d543d20SAndroid Build Coastguard Worker policydb_t mod;
227*2d543d20SAndroid Build Coastguard Worker policydb_t *mods[] = { &mod };
228*2d543d20SAndroid Build Coastguard Worker avrule_decl_t *decl;
229*2d543d20SAndroid Build Coastguard Worker int ret;
230*2d543d20SAndroid Build Coastguard Worker sepol_handle_t *h;
231*2d543d20SAndroid Build Coastguard Worker
232*2d543d20SAndroid Build Coastguard Worker /* suppress error reporting - this is because we know that we
233*2d543d20SAndroid Build Coastguard Worker * are going to get errors and don't want libsepol complaining
234*2d543d20SAndroid Build Coastguard Worker * about it constantly. */
235*2d543d20SAndroid Build Coastguard Worker h = sepol_handle_create();
236*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(h != NULL);
237*2d543d20SAndroid Build Coastguard Worker sepol_msg_set_callback(h, NULL, NULL);
238*2d543d20SAndroid Build Coastguard Worker
239*2d543d20SAndroid Build Coastguard Worker if (req_met) {
240*2d543d20SAndroid Build Coastguard Worker base = &bases_met[b];
241*2d543d20SAndroid Build Coastguard Worker } else {
242*2d543d20SAndroid Build Coastguard Worker base = &bases_notmet[b];
243*2d543d20SAndroid Build Coastguard Worker }
244*2d543d20SAndroid Build Coastguard Worker
245*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(test_load_policy(&mod, POLICY_MOD, mls, "test-deps", policy) == 0);
246*2d543d20SAndroid Build Coastguard Worker
247*2d543d20SAndroid Build Coastguard Worker /* link the modules and check for the correct return value.
248*2d543d20SAndroid Build Coastguard Worker */
249*2d543d20SAndroid Build Coastguard Worker ret = link_modules(h, base, mods, 1, 0);
250*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(ret == ret_val);
251*2d543d20SAndroid Build Coastguard Worker policydb_destroy(&mod);
252*2d543d20SAndroid Build Coastguard Worker sepol_handle_destroy(h);
253*2d543d20SAndroid Build Coastguard Worker if (ret_val < 0)
254*2d543d20SAndroid Build Coastguard Worker return;
255*2d543d20SAndroid Build Coastguard Worker
256*2d543d20SAndroid Build Coastguard Worker decl = test_find_decl_by_sym(base, SYM_TYPES, decl_type);
257*2d543d20SAndroid Build Coastguard Worker CU_ASSERT_FATAL(decl != NULL);
258*2d543d20SAndroid Build Coastguard Worker
259*2d543d20SAndroid Build Coastguard Worker if (req_met) {
260*2d543d20SAndroid Build Coastguard Worker CU_ASSERT(decl->enabled == 1);
261*2d543d20SAndroid Build Coastguard Worker } else {
262*2d543d20SAndroid Build Coastguard Worker CU_ASSERT(decl->enabled == 0);
263*2d543d20SAndroid Build Coastguard Worker }
264*2d543d20SAndroid Build Coastguard Worker }
265*2d543d20SAndroid Build Coastguard Worker
266*2d543d20SAndroid Build Coastguard Worker /* Test that symbol require statements in the global scope of a module
267*2d543d20SAndroid Build Coastguard Worker * work correctly. This will cover tests 6 - 10 (described above).
268*2d543d20SAndroid Build Coastguard Worker *
269*2d543d20SAndroid Build Coastguard Worker * Each of these policies will require as few symbols as possible to
270*2d543d20SAndroid Build Coastguard Worker * use the required symbol in addition requiring (for example, the type
271*2d543d20SAndroid Build Coastguard Worker * test also requires an object class for an allow rule).
272*2d543d20SAndroid Build Coastguard Worker */
deps_modreq_opt(void)273*2d543d20SAndroid Build Coastguard Worker static void deps_modreq_opt(void)
274*2d543d20SAndroid Build Coastguard Worker {
275*2d543d20SAndroid Build Coastguard Worker /* object classes */
276*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_OBJ_OPT, "modreq-obj-opt.conf", "mod_opt_t");
277*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, 0, BASE_MODREQ_OBJ_OPT, "modreq-obj-opt.conf", "mod_opt_t");
278*2d543d20SAndroid Build Coastguard Worker /* types */
279*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_TYPE_OPT, "modreq-type-opt.conf", "mod_opt_t");
280*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, 0, BASE_MODREQ_TYPE_OPT, "modreq-type-opt.conf", "mod_opt_t");
281*2d543d20SAndroid Build Coastguard Worker /* attributes */
282*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_ATTR_OPT, "modreq-attr-opt.conf", "mod_opt_t");
283*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, 0, BASE_MODREQ_ATTR_OPT, "modreq-attr-opt.conf", "mod_opt_t");
284*2d543d20SAndroid Build Coastguard Worker /* booleans */
285*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_BOOL_OPT, "modreq-bool-opt.conf", "mod_opt_t");
286*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, 0, BASE_MODREQ_BOOL_OPT, "modreq-bool-opt.conf", "mod_opt_t");
287*2d543d20SAndroid Build Coastguard Worker /* roles */
288*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_ROLE_OPT, "modreq-role-opt.conf", "mod_opt_t");
289*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, 0, BASE_MODREQ_ROLE_OPT, "modreq-role-opt.conf", "mod_opt_t");
290*2d543d20SAndroid Build Coastguard Worker /* permissions */
291*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(1, 0, BASE_MODREQ_PERM_OPT, "modreq-perm-opt.conf", "mod_opt_t");
292*2d543d20SAndroid Build Coastguard Worker do_deps_modreq_opt(0, -3, BASE_MODREQ_PERM_OPT, "modreq-perm-opt.conf", "mod_opt_t");
293*2d543d20SAndroid Build Coastguard Worker }
294*2d543d20SAndroid Build Coastguard Worker
deps_add_tests(CU_pSuite suite)295*2d543d20SAndroid Build Coastguard Worker int deps_add_tests(CU_pSuite suite)
296*2d543d20SAndroid Build Coastguard Worker {
297*2d543d20SAndroid Build Coastguard Worker if (NULL == CU_add_test(suite, "deps_modreq_global", deps_modreq_global)) {
298*2d543d20SAndroid Build Coastguard Worker return CU_get_error();
299*2d543d20SAndroid Build Coastguard Worker }
300*2d543d20SAndroid Build Coastguard Worker
301*2d543d20SAndroid Build Coastguard Worker if (NULL == CU_add_test(suite, "deps_modreq_opt", deps_modreq_opt)) {
302*2d543d20SAndroid Build Coastguard Worker return CU_get_error();
303*2d543d20SAndroid Build Coastguard Worker }
304*2d543d20SAndroid Build Coastguard Worker
305*2d543d20SAndroid Build Coastguard Worker return 0;
306*2d543d20SAndroid Build Coastguard Worker }
307