• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Tresys Technology, LLC. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *    1. Redistributions of source code must retain the above copyright notice,
8  *       this list of conditions and the following disclaimer.
9  *
10  *    2. Redistributions in binary form must reproduce the above copyright notice,
11  *       this list of conditions and the following disclaimer in the documentation
12  *       and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17  * EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * The views and conclusions contained in the software and documentation are those
26  * of the authors and should not be interpreted as representing official policies,
27  * either expressed or implied, of Tresys Technology, LLC.
28  */
29 
30 #ifndef CIL_VERIFY_H_
31 #define CIL_VERIFY_H_
32 
33 #include <stdint.h>
34 
35 #include "cil_internal.h"
36 #include "cil_flavor.h"
37 #include "cil_tree.h"
38 #include "cil_list.h"
39 
40 enum cil_syntax {
41 	CIL_SYN_STRING      = 1 << 0,
42 	CIL_SYN_LIST        = 1 << 1,
43 	CIL_SYN_EMPTY_LIST  = 1 << 2,
44 	CIL_SYN_N_LISTS     = 1 << 3,
45 	CIL_SYN_N_STRINGS   = 1 << 4,
46 	CIL_SYN_END         = 1 << 5
47 };
48 
49 struct cil_args_verify {
50 	struct cil_db *db;
51 	struct cil_complex_symtab *csymtab;
52 	int *avrule_cnt;
53 	int *handleunknown;
54 	int *mls;
55 	int *nseuserdflt;
56 	int *pass;
57 };
58 
59 int cil_verify_name(const struct cil_db *db, const char *name, enum cil_flavor flavor);
60 int __cil_verify_syntax(struct cil_tree_node *parse_current, enum cil_syntax s[], size_t len);
61 int cil_verify_expr_syntax(struct cil_tree_node *current, enum cil_flavor op, enum cil_flavor expr_flavor);
62 int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_flavor r_flavor, enum cil_flavor op, enum cil_flavor expr_flavor);
63 int cil_verify_constraint_expr_syntax(struct cil_tree_node *current, enum cil_flavor op);
64 int cil_verify_conditional_blocks(struct cil_tree_node *current);
65 int cil_verify_decl_does_not_shadow_macro_parameter(struct cil_macro *macro, struct cil_tree_node *node, const char *name);
66 int __cil_verify_ranges(struct cil_list *list);
67 int __cil_verify_ordered_node_helper(struct cil_tree_node *node, uint32_t *finished, void *extra_args);
68 int __cil_verify_ordered(struct cil_tree_node *current, enum cil_flavor flavor);
69 int __cil_verify_initsids(struct cil_list *sids);
70 int __cil_verify_senscat(struct cil_sens *sens, struct cil_cat *cat);
71 int __cil_verify_helper(struct cil_tree_node *node, __attribute__((unused)) uint32_t *finished, void *extra_args);
72 int __cil_pre_verify_helper(struct cil_tree_node *node, __attribute__((unused)) uint32_t *finished, void *extra_args);
73 
74 #endif
75