Debian Codegraph @

src/conf_ast.c

raw symbols SCIP
1 /*
2 * AIDE (Advanced Intrusion Detection Environment)
3 *
4 * Copyright (C) 2019-2025 Hannes von Haugwitz
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include <stdlib.h>
22 #include <stdbool.h>
23
24 #include "conf_ast.h"cxx . . $ `<file>/include/conf_ast.h`/
25 #include "conf_lex.h"cxx . . $ `<file>/include/conf_lex.h`/
26 #include "log.h"cxx . . $ `<file>/include/log.h`/
27 #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/
28 #include "util.h"cxx . . $ `<file>/include/util.h`/
29
30 LOG_LEVELcxx . . $ LOG_LEVEL# ast_log_levelcxx . . $ ast_log_level. = LOG_LEVEL_TRACEcxx . . $ LOG_LEVEL_TRACE.;
31
32 config_option_tcxx . . $ config_option_t# config_optionscxx . . $ config_options.[] = {
33 { ACL_NO_SYMLINK_FOLLOW_OPTIONcxx . . $ ACL_NO_SYMLINK_FOLLOW_OPTION., "acl_no_symlink_follow", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
34 { DATABASE_ADD_METADATA_OPTIONcxx . . $ DATABASE_ADD_METADATA_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
35 { DATABASE_ATTRIBUTES_OPTIONcxx . . $ DATABASE_ATTRIBUTES_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
36 { DATABASE_GZIP_OPTIONcxx . . $ DATABASE_GZIP_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
37 { DATABASE_IN_OPTIONcxx . . $ DATABASE_IN_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
38 { DATABASE_OUT_OPTIONcxx . . $ DATABASE_OUT_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
39 { DATABASE_NEW_OPTIONcxx . . $ DATABASE_NEW_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
40 { LOG_LEVEL_OPTIONcxx . . $ LOG_LEVEL_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
41 { REPORT_BASE16_OPTIONcxx . . $ REPORT_BASE16_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
42 { REPORT_DETAILED_INIT_OPTIONcxx . . $ REPORT_DETAILED_INIT_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
43 { REPORT_FORCE_ATTRS_OPTIONcxx . . $ REPORT_FORCE_ATTRS_OPTION., "report_force_attrs", "Forced attributes" },
44 { REPORT_GROUPED_OPTIONcxx . . $ REPORT_GROUPED_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
45 { REPORT_IGNORE_ADDED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_ADDED_ATTRS_OPTION., "report_ignore_added_attrs", "Ignored added attributes" },
46 { REPORT_IGNORE_REMOVED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_REMOVED_ATTRS_OPTION., "report_ignore_removed_attrs", "Ignored removed attributes" },
47 { REPORT_IGNORE_CHANGED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_CHANGED_ATTRS_OPTION., "report_ignore_changed_attrs", "Ignored changed attributes" },
48 { REPORT_IGNORE_E2FSATTRS_OPTIONcxx . . $ REPORT_IGNORE_E2FSATTRS_OPTION., "report_ignore_e2fsattrs", "Ignored e2fs attributes" },
49 { REPORT_LEVEL_OPTIONcxx . . $ REPORT_LEVEL_OPTION., "report_level", "Report level" },
50 { REPORT_QUIET_OPTIONcxx . . $ REPORT_QUIET_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
51 { REPORT_APPEND_OPTIONcxx . . $ REPORT_APPEND_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
52 { REPORT_SUMMARIZE_CHANGES_OPTIONcxx . . $ REPORT_SUMMARIZE_CHANGES_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
53 { REPORT_URL_OPTIONcxx . . $ REPORT_URL_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
54 { ROOT_PREFIX_OPTIONcxx . . $ ROOT_PREFIX_OPTION., "root_prefix", "Root prefix" },
55 { WARN_DEAD_SYMLINKS_OPTIONcxx . . $ WARN_DEAD_SYMLINKS_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
56 { CONFIG_VERSIONcxx . . $ CONFIG_VERSION., "config_version", "Config version used" },
57 { CONFIG_CHECK_WARN_UNRESTRICTED_RULEScxx . . $ CONFIG_CHECK_WARN_UNRESTRICTED_RULES., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
58 { REPORT_FORMAT_OPTIONcxx . . $ REPORT_FORMAT_OPTION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
59 { LIMIT_CMDLINE_OPTIONcxx . . $ LIMIT_CMDLINE_OPTION., "limit", "Limit" },
60 { NUM_WORKERScxx . . $ NUM_WORKERS., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! },
61 };
62
63 static astcxx . . $ ast#* new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).(void) {
64 astcxx . . $ ast#* a = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(astcxx . . $ ast#));
65
66 a->linenumbercxx . . $ ast#linenumber. = conf_linenumbercxx . . $ conf_linenumber.;
67 a->filenamecxx . . $ ast#filename. = conf_filenamecxx . . $ conf_filename.;
68 a->linebufcxx . . $ ast#linebuf. = conf_linebufcxx . . $ conf_linebuf.;
69 a->nextcxx . . $ ast#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
70
71 return a;
72 }
73
74 astcxx . . $ ast#* new_string_option_statementcxx . . $ new_string_option_statement(f830a405ae9ddcd8).(config_optioncxx . . $ config_option# option, string_expressioncxx . . $ string_expression#* value) {
75 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
76
77 a->typecxx . . $ ast#type. = config_option_typecxx . . $ ast#config_option_type.;
78 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..optioncxx . . $ config_option_statement#option. = option;
79 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..acxx . . $ config_option_statement#a. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
80 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..ecxx . . $ config_option_statement#e. = value;
81 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new string option statement (%p): option: %d, value: %p", (void*) a, option, (void*) value);
82 return a;
83 }
84
85 astcxx . . $ ast#* new_attribute_option_statementcxx . . $ new_attribute_option_statement(fd58fac2666ca7f5).(config_optioncxx . . $ config_option# option, attribute_expressioncxx . . $ attribute_expression#* value) {
86 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
87
88 a->typecxx . . $ ast#type. = config_option_typecxx . . $ ast#config_option_type.;
89 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..optioncxx . . $ config_option_statement#option. = option;
90 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..acxx . . $ config_option_statement#a. = value;
91 a->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..ecxx . . $ config_option_statement#e. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
92 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new attribute option statement (%p): option: %d, value: %p", (void*) a, option, (void*) value);
93 return a;
94 }
95
96 astcxx . . $ ast#* new_include_statementcxx . . $ new_include_statement(ac1ef1c05cb212cc).(string_expressioncxx . . $ string_expression#* path, string_expressioncxx . . $ string_expression#* rx, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! execute, string_expressioncxx . . $ string_expression#* prefix) {
97 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
98
99 a->typecxx . . $ ast#type. = include_statement_typecxx . . $ ast#include_statement_type.;
100 a->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..pathcxx . . $ include_statement#path. = path;
101 a->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..rxcxx . . $ include_statement#rx. = rx;
102 a->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..executecxx . . $ include_statement#execute. = execute;
103 a->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..prefixcxx . . $ include_statement#prefix. = prefix;
104
105 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new include statement (%p): path: %p, rx: %p, execute: %s, prefix: %p", (void*) a, (void*) path, (void*) rx, btoacxx . . $ btoa(626eec357d49c77e).(execute), (void*) prefix);
106 return a;
107 }
108
109 astcxx . . $ ast#* new_x_include_setenv_statementcxx . . $ new_x_include_setenv_statement(a348f5be1c63e6a6).(char *variable, string_expressioncxx . . $ string_expression# *value) {
110 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
111
112 a->typecxx . . $ ast#type. = x_include_setenv_statement_typecxx . . $ ast#x_include_setenv_statement_type.;
113 a->statementcxx . . $ ast#statement.._x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv..variablecxx . . $ x_include_setenv_statement#variable. = variable;
114 a->statementcxx . . $ ast#statement.._x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv..valuecxx . . $ x_include_setenv_statement#value. = value;
115 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new x_include_setenv statement (%p): variable: '%s', value: %p", (void*) a, variable, (void*) value);
116 return a;
117 }
118
119 astcxx . . $ ast#* new_define_statementcxx . . $ new_define_statement(a348f5be1c63e6a6).(char *name, string_expressioncxx . . $ string_expression# *value) {
120 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
121
122 a->typecxx . . $ ast#type. = define_statement_typecxx . . $ ast#define_statement_type.;
123 a->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define..namecxx . . $ define_statement#name. = name;
124 a->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define..valuecxx . . $ define_statement#value. = value;
125 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new define statement (%p): name: '%s', value: %p", (void*) a, name, (void*) value);
126 return a;
127 }
128
129 astcxx . . $ ast#* new_undefine_statementcxx . . $ new_undefine_statement(23fbe7ec2b3e63e6).(char *name) {
130 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
131
132 a->typecxx . . $ ast#type. = undefine_statement_typecxx . . $ ast#undefine_statement_type.;
133 a->statementcxx . . $ ast#statement.._undefinecxx . . $ ast#$anonymous_type_4#_undefine..namecxx . . $ undefine_statement#name. = name;
134 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new undefine statement (%p): name: '%s'", (void*) a, name);
135 return a;
136 }
137
138 astcxx . . $ ast#* new_group_statementcxx . . $ new_group_statement(a11f56b714a2867d).(char* name, attribute_expressioncxx . . $ attribute_expression#* expr) {
139 astcxx . . $ ast#* a = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
140
141 a->typecxx . . $ ast#type. = group_statement_typecxx . . $ ast#group_statement_type.;
142 a->statementcxx . . $ ast#statement.._groupcxx . . $ ast#$anonymous_type_4#_group..namecxx . . $ group_statement#name. = name;
143 a->statementcxx . . $ ast#statement.._groupcxx . . $ ast#$anonymous_type_4#_group..exprcxx . . $ group_statement#expr. = expr;
144 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new group statement (%p): name: '%s', expr: %p", (void*) a, name, (void*) expr);
145 return a;
146 }
147
148 bool_expressioncxx . . $ bool_expression#* new_string_bool_expressioncxx . . $ new_string_bool_expression(a52d2e068b39c51e).(bool_operatorcxx . . $ bool_operator# op, string_expressioncxx . . $ string_expression#* left, string_expressioncxx . . $ string_expression#* right) {
149 bool_expressioncxx . . $ bool_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(bool_expressioncxx . . $ bool_expression#));
150 e->opcxx . . $ bool_expression#op. = op;
151 e->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str. = left;
152 e->rightcxx . . $ bool_expression#right.._strcxx . . $ bool_expression#$anonymous_type_2#_str. = right;
153 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new string bool expression (%p): op: %d, left: %p, right: %p", (void*) e, op, (void*) left, (void*) right);
154 return e;
155 }
156
157 bool_expressioncxx . . $ bool_expression#* new_bool_expressioncxx . . $ new_bool_expression(fb49e1ae64d676d0).(bool_operatorcxx . . $ bool_operator# op, bool_expressioncxx . . $ bool_expression#* left, bool_expressioncxx . . $ bool_expression#* right) {
158 bool_expressioncxx . . $ bool_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(bool_expressioncxx . . $ bool_expression#));
159 e->opcxx . . $ bool_expression#op. = op;
160 e->leftcxx . . $ bool_expression#left.._boolcxx . . $ bool_expression#$anonymous_type_1#_bool. = left;
161 e->rightcxx . . $ bool_expression#right.._boolcxx . . $ bool_expression#$anonymous_type_2#_bool. = right;
162 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new bool expression (%p): op: %d, left: %p, right: %p", (void*) e, op, (void*) left, (void*) right);
163 return e;
164 }
165
166 if_conditioncxx . . $ if_condition#* new_if_conditioncxx . . $ new_if_condition(87088a2d4a0be176).(bool_expressioncxx . . $ bool_expression#* expression) {
167 if_conditioncxx . . $ if_condition#* c = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(if_conditioncxx . . $ if_condition#));
168
169 c->linenumbercxx . . $ if_condition#linenumber. = conf_linenumbercxx . . $ conf_linenumber.;
170 c->filenamecxx . . $ if_condition#filename. = conf_filenamecxx . . $ conf_filename.;
171 c->linebufcxx . . $ if_condition#linebuf. = conf_linebufcxx . . $ conf_linebuf.;
172
173 c->expressioncxx . . $ if_condition#expression. = expression;
174
175 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: if condition (%p): expression: %p", (void*) c, (void*) expression);
176 return c;
177 }
178
179 attribute_expressioncxx . . $ attribute_expression#* new_attribute_expressioncxx . . $ new_attribute_expression(5d8da53df85c4fbc).(attribute_operatorcxx . . $ attribute_operator# op, attribute_expressioncxx . . $ attribute_expression#* left, char* right) {
180 attribute_expressioncxx . . $ attribute_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(attribute_expressioncxx . . $ attribute_expression#));
181 e->opcxx . . $ attribute_expression#op. = op;
182 e->leftcxx . . $ attribute_expression#left. = left;
183 e->rightcxx . . $ attribute_expression#right. = right;
184 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new attribute expression (%p): op: %d, left: %p, right: '%s'", (void*) e, op, (void*) left, right);
185 return e;
186 }
187
188 ft_restriction_expressioncxx . . $ ft_restriction_expression#* new_ft_restriction_expressioncxx . . $ new_ft_restriction_expression(84fdc8e190b08d90).(ft_restriction_expressioncxx . . $ ft_restriction_expression#* left, char* right) {
189 ft_restriction_expressioncxx . . $ ft_restriction_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(ft_restriction_expressioncxx . . $ ft_restriction_expression#));
190 e->rightcxx . . $ ft_restriction_expression#right. = right;
191 e->leftcxx . . $ ft_restriction_expression#left. = left;
192 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new file type restriction expression (%p): left: %p, right: '%s'", (void*) e, (void*) left, right);
193 return e;
194 }
195
196 restriction_expressioncxx . . $ restriction_expression#* new_restriction_expressioncxx . . $ new_restriction_expression(dba3b61e2aa5a653).(ft_restriction_expressioncxx . . $ ft_restriction_expression#* f_types, char* fs_type) {
197 restriction_expressioncxx . . $ restriction_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(restriction_expressioncxx . . $ restriction_expression#));
198 e->f_typescxx . . $ restriction_expression#f_types. = f_types;
199 e->fs_typecxx . . $ restriction_expression#fs_type. = fs_type;
200 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new restriction expression (%p): f_types: '%p', fs_type: %s", (void*) e, (void*) f_types, (fs_type != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) ? fs_type : "(null)");
201 return e;
202 }
203
204 astcxx . . $ ast#* new_if_statementcxx . . $ new_if_statement(f8d5e3ceb690fe4e).(struct if_conditioncxx . . $ if_condition#* condition, struct astcxx . . $ ast#* if_branch, struct astcxx . . $ ast#* else_branch) {
205 astcxx . . $ ast#* e = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
206
207 e->typecxx . . $ ast#type. = if_statement_typecxx . . $ ast#if_statement_type.;
208 e->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..conditioncxx . . $ if_statement#condition. = condition;
209 e->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..if_branchcxx . . $ if_statement#if_branch. = if_branch;
210 e->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..else_branchcxx . . $ if_statement#else_branch. = else_branch;
211 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new if statement (%p): condition: %p, if_branch: %p, else_branch: %p", (void*) e, (void*) condition, (void*) if_branch, (void*) else_branch);
212 return e;
213 }
214
215 astcxx . . $ ast#* new_rule_statementcxx . . $ new_rule_statement(d3d78b496cdb2f1e).(AIDE_RULE_TYPEcxx . . $ AIDE_RULE_TYPE# rule_type, string_expressioncxx . . $ string_expression#* path, restriction_expressioncxx . . $ restriction_expression#* restriction, attribute_expressioncxx . . $ attribute_expression#* attrs) {
216 astcxx . . $ ast#* e = new_ast_nodecxx . . $ new_ast_node(dcb6c28fdc31bd3f).();
217
218 e->typecxx . . $ ast#type. = rule_statement_typecxx . . $ ast#rule_statement_type.;
219 e->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..typecxx . . $ rule_statement#type. = rule_type;
220 e->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..pathcxx . . $ rule_statement#path. = path;
221 e->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..restrictioncxx . . $ rule_statement#restriction. = restriction;
222 e->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..attributescxx . . $ rule_statement#attributes. = attrs;
223 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new rule statement (%p): type: %s, path: %p, restriction: %p, attributes: %p", (void*) e, get_rule_type_long_stringcxx . . $ get_rule_type_long_string(10604bca7de90ad2).(rule_type), (void*) path, (void*) restriction, (void*) attrs);
224 return e;
225 }
226
227 string_expressioncxx . . $ string_expression#* new_stringcxx . . $ new_string(1727335c042fc713).(char *str) {
228 string_expressioncxx . . $ string_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(string_expressioncxx . . $ string_expression#));
229
230 e->opcxx . . $ string_expression#op. = STR_OP_STRcxx . . $ STR_OP_STR.;
231 e->strcxx . . $ string_expression#str. = str;
232 e->leftcxx . . $ string_expression#left. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
233 e->rightcxx . . $ string_expression#right. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
234 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new string (%p): str: '%s'", (void*) e, str);
235 return e;
236 }
237 string_expressioncxx . . $ string_expression#* new_variablecxx . . $ new_variable(1727335c042fc713).(char *name) {
238 string_expressioncxx . . $ string_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(string_expressioncxx . . $ string_expression#));
239
240 e->opcxx . . $ string_expression#op. = STR_OP_VARIABLEcxx . . $ STR_OP_VARIABLE.;
241 e->strcxx . . $ string_expression#str. = name;
242 e->leftcxx . . $ string_expression#left. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
243 e->rightcxx . . $ string_expression#right. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
244 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new variable (%p): name: '%s'", (void*) e, name);
245 return e;
246 }
247 string_expressioncxx . . $ string_expression#* new_string_concatcxx . . $ new_string_concat(6d600d85e8f010e2).(string_expressioncxx . . $ string_expression#* left, string_expressioncxx . . $ string_expression#* right) {
248 string_expressioncxx . . $ string_expression#* e = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(string_expressioncxx . . $ string_expression#));
249 e->opcxx . . $ string_expression#op. = STR_OP_CONCATcxx . . $ STR_OP_CONCAT.;
250 e->strcxx . . $ string_expression#str. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
251 e->leftcxx . . $ string_expression#left. = left;
252 e->rightcxx . . $ string_expression#right. = right;
253 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: new string concat (%p): left: %p, right: %p", (void*) e, (void*) left, (void*) right);
254 return e;
255 }
256
257 void free_stringcxx . . $ free_string(fda57c8427c60377).(char * s) {
258 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
259 return;
260 }
261 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free string %p", (void*) s);
262 freecxx . . $ free(5d22bdacc48458e8).(s);
263 }
264
265 void free_attribute_expressioncxx . . $ free_attribute_expression(56e31f9ad270fb09).(attribute_expressioncxx . . $ attribute_expression# *a) {
266 if (a == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
267 return;
268 }
269 free_attribute_expressioncxx . . $ free_attribute_expression(56e31f9ad270fb09).(a->leftcxx . . $ attribute_expression#left.);
270 free_stringcxx . . $ free_string(fda57c8427c60377).(a->rightcxx . . $ attribute_expression#right.);
271 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free attribute expression %p", (void*) a);
272 freecxx . . $ free(5d22bdacc48458e8).(a);
273 }
274
275 void free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(string_expressioncxx . . $ string_expression# *s) {
276 if (s == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
277 return;
278 }
279 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(s->leftcxx . . $ string_expression#left.);
280 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(s->rightcxx . . $ string_expression#right.);
281 free_stringcxx . . $ free_string(fda57c8427c60377).(s->strcxx . . $ string_expression#str.);
282 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free string expression %p", (void*) s);
283 freecxx . . $ free(5d22bdacc48458e8).(s);
284 }
285
286 void free_bool_expressioncxx . . $ free_bool_expression(ca60993f44640c42).(bool_expressioncxx . . $ bool_expression# *b) {
287 if (b == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
288 return;
289 }
290 switch (b->opcxx . . $ bool_expression#op.) {
291 case BOOL_OP_NOTcxx . . $ BOOL_OP_NOT.:
292 free_bool_expressioncxx . . $ free_bool_expression(ca60993f44640c42).(b->leftcxx . . $ bool_expression#left.._boolcxx . . $ bool_expression#$anonymous_type_1#_bool.);
293 break;
294 case BOOL_OP_EXISTScxx . . $ BOOL_OP_EXISTS.:
295 case BOOL_OP_DEFINEDcxx . . $ BOOL_OP_DEFINED.:
296 case BOOL_OP_HOSTNAMEcxx . . $ BOOL_OP_HOSTNAME.:
297 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(b->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str.);
298 break;
299 case BOOL_OP_VERSION_GEcxx . . $ BOOL_OP_VERSION_GE.:
300 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(b->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str.);
301 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(b->rightcxx . . $ bool_expression#right.._strcxx . . $ bool_expression#$anonymous_type_2#_str.);
302 break;
303 }
304 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free bool expression %p", (void*) b);
305 freecxx . . $ free(5d22bdacc48458e8).(b);
306 }
307
308 void free_if_conditioncxx . . $ free_if_condition(ff3bde74f4e61e74).(if_conditioncxx . . $ if_condition# *c) {
309 free_bool_expressioncxx . . $ free_bool_expression(ca60993f44640c42).(c->expressioncxx . . $ if_condition#expression.);
310 free_stringcxx . . $ free_string(fda57c8427c60377).(c->linebufcxx . . $ if_condition#linebuf.);
311 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free if condition %p", (void*) c);
312 freecxx . . $ free(5d22bdacc48458e8).(c);
313 }
314
315 void free_ft_restriction_expressioncxx . . $ free_ft_restriction_expression(f8c6a5b157699afc).(ft_restriction_expressioncxx . . $ ft_restriction_expression# *r) {
316 if (r == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
317 return;
318 }
319 free_ft_restriction_expressioncxx . . $ free_ft_restriction_expression(f8c6a5b157699afc).(r->leftcxx . . $ ft_restriction_expression#left.);
320 free_stringcxx . . $ free_string(fda57c8427c60377).(r->rightcxx . . $ ft_restriction_expression#right.);
321 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free file type restriction expression %p", (void*) r);
322 freecxx . . $ free(5d22bdacc48458e8).(r);
323 }
324
325 void free_restriction_expressioncxx . . $ free_restriction_expression(928b42ff20970a8b).(restriction_expressioncxx . . $ restriction_expression# *r) {
326 if (r == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
327 return;
328 }
329 #ifdef HAVE_FSTYPEcxx . . $ `include/config.h:53:9`!
330 free_stringcxx . . $ free_string(fda57c8427c60377).(r->fs_typecxx . . $ restriction_expression#fs_type.);
331 #endif
332 free_ft_restriction_expressioncxx . . $ free_ft_restriction_expression(f8c6a5b157699afc).(r->f_typescxx . . $ restriction_expression#f_types.);
333 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free restriction expression %p", (void*) r);
334 freecxx . . $ free(5d22bdacc48458e8).(r);
335 }
336
337 void deep_freecxx . . $ deep_free(888ed87a56794581).(astcxx . . $ ast#* config_ast) {
338 if (config_ast == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
339 return;
340 }
341 astcxx . . $ ast#* node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
342 for(node = config_ast; node != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; ) {
343 switch (node->typecxx . . $ ast#type.) {
344 case config_option_typecxx . . $ ast#config_option_type.:
345 free_attribute_expressioncxx . . $ free_attribute_expression(56e31f9ad270fb09).(node->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..acxx . . $ config_option_statement#a.);
346 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config..ecxx . . $ config_option_statement#e.);
347 break;
348 case define_statement_typecxx . . $ ast#define_statement_type.:
349 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define..valuecxx . . $ define_statement#value.);
350 free_stringcxx . . $ free_string(fda57c8427c60377).(node->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define..namecxx . . $ define_statement#name.);
351 break;
352 case group_statement_typecxx . . $ ast#group_statement_type.:
353 free_attribute_expressioncxx . . $ free_attribute_expression(56e31f9ad270fb09).(node->statementcxx . . $ ast#statement.._groupcxx . . $ ast#$anonymous_type_4#_group..exprcxx . . $ group_statement#expr.);
354 free_stringcxx . . $ free_string(fda57c8427c60377).(node->statementcxx . . $ ast#statement.._groupcxx . . $ ast#$anonymous_type_4#_group..namecxx . . $ group_statement#name.);
355 break;
356 case if_statement_typecxx . . $ ast#if_statement_type.:
357 free_if_conditioncxx . . $ free_if_condition(ff3bde74f4e61e74).(node->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..conditioncxx . . $ if_statement#condition.);
358 deep_freecxx . . $ deep_free(888ed87a56794581).(node->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..if_branchcxx . . $ if_statement#if_branch.);
359 deep_freecxx . . $ deep_free(888ed87a56794581).(node->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if..else_branchcxx . . $ if_statement#else_branch.);
360 break;
361 case include_statement_typecxx . . $ ast#include_statement_type.:
362 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..pathcxx . . $ include_statement#path.);
363 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..rxcxx . . $ include_statement#rx.);
364 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include..prefixcxx . . $ include_statement#prefix.);
365 break;
366 case x_include_setenv_statement_typecxx . . $ ast#x_include_setenv_statement_type.:
367 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv..valuecxx . . $ x_include_setenv_statement#value.);
368 free_stringcxx . . $ free_string(fda57c8427c60377).(node->statementcxx . . $ ast#statement.._x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv..variablecxx . . $ x_include_setenv_statement#variable.);
369 break;
370 case rule_statement_typecxx . . $ ast#rule_statement_type.:
371 free_string_expressioncxx . . $ free_string_expression(fcfcaca73b69406b).(node->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..pathcxx . . $ rule_statement#path.);
372 free_restriction_expressioncxx . . $ free_restriction_expression(928b42ff20970a8b).(node->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..restrictioncxx . . $ rule_statement#restriction.);
373 free_attribute_expressioncxx . . $ free_attribute_expression(56e31f9ad270fb09).(node->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule..attributescxx . . $ rule_statement#attributes.);
374 break;
375 case undefine_statement_typecxx . . $ ast#undefine_statement_type.:
376 free_stringcxx . . $ free_string(fda57c8427c60377).(node->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define..namecxx . . $ define_statement#name.);
377 break;
378 }
379 freecxx . . $ free(5d22bdacc48458e8).(node->linebufcxx . . $ ast#linebuf.);
380 astcxx . . $ ast#* to_be_freed = node;
381 node = node->nextcxx . . $ ast#next.;
382 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(ast_log_levelcxx . . $ ast_log_level., "ast: free ast node %p (next: %p)", (void*) to_be_freed, (void*) node);
383 freecxx . . $ free(5d22bdacc48458e8).(to_be_freed);
384 }
385 }