| 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 "config.h"cxx . . $ `<file>/include/config.h`/ |
| 22 | #include "aide.h"cxx . . $ `<file>/include/aide.h`/ |
| 23 | |
| 24 | #include <stdbool.h> |
| 25 | #include <stdio.h> |
| 26 | #include <string.h> |
| 27 | #include <sys/stat.h> |
| 28 | #define PCRE2_CODE_UNIT_WIDTHcxx . . $ `src/conf_eval.c:28:9`! 8 |
| 29 | #include <pcre2.h> |
| 30 | #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/ |
| 31 | #include "conf_ast.h"cxx . . $ `<file>/include/conf_ast.h`/ |
| 32 | #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/ |
| 33 | #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/ |
| 34 | #include "list.h"cxx . . $ `<file>/include/list.h`/ |
| 35 | #include "report.h"cxx . . $ `<file>/include/report.h`/ |
| 36 | |
| 37 | #include "conf_eval.h"cxx . . $ `<file>/include/conf_eval.h`/ |
| 38 | #include "conf_yacc.h"cxx . . $ `<file>/src/conf_yacc.h`/ |
| 39 | #include "conf_lex.h"cxx . . $ `<file>/include/conf_lex.h`/ |
| 40 | |
| 41 | #include "log.h"cxx . . $ `<file>/include/log.h`/ |
| 42 | #include "errorcodes.h"cxx . . $ `<file>/include/errorcodes.h`/ |
| 43 | #include "db.h"cxx . . $ `<file>/include/db.h`/ |
| 44 | #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/ |
| 45 | #include "util.h"cxx . . $ `<file>/include/util.h`/ |
| 46 | |
| 47 | #include "commandconf.h"cxx . . $ `<file>/include/commandconf.h`/ |
| 48 | |
| 49 | #include "symboltable.h"cxx . . $ `<file>/include/symboltable.h`/ |
| 50 | |
| 51 | #include <stdlib.h> |
| 52 | #include <stddef.h> |
| 53 | #include <sys/wait.h> |
| 54 | #include <dirent.h> |
| 55 | #include <errno.h> |
| 56 | #include <unistd.h> |
| 57 | |
| 58 | LOG_LEVELcxx . . $ LOG_LEVEL# eval_log_levelcxx . . $ eval_log_level. = LOG_LEVEL_TRACEcxx . . $ LOG_LEVEL_TRACE.; |
| 59 | |
| 60 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! log_level_set_in_configcxx . . $ log_level_set_in_config. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 61 | |
| 62 | listcxx . . $ list#* x_include_environmentcxx . . $ x_include_environment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 63 | |
| 64 | #define BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(id, option) \ |
| 65 | case id: \ |
| 66 | b = string_expression_to_bool(statement.e, linenumber, filename, linebuf); \ |
| 67 | conf->option = b; \ |
| 68 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set '%s' to '%s'", #option, btoa(conf->option)) \ |
| 69 | break; |
| 70 | |
| 71 | #define ATTRIBUTE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:71:9`!(id, option) \ |
| 72 | case id: \ |
| 73 | attr = eval_attribute_expression(statement.a, linenumber, filename, linebuf); \ |
| 74 | conf->option=attr; \ |
| 75 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set '%s' to '%s'", #option, str = diff_attributes(0, attr) ) \ |
| 76 | free(str); \ |
| 77 | break; |
| 78 | |
| 79 | #define DATABASE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:79:9`!(id, dbtype) \ |
| 80 | case id: \ |
| 81 | str = eval_string_expression(statement.e, linenumber, filename, linebuf); \ |
| 82 | if (!do_dbdef(dbtype, str, linenumber, filename, linebuf)) { \ |
| 83 | exit(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); \ |
| 84 | } \ |
| 85 | free(str); \ |
| 86 | break; |
| 87 | |
| 88 | static char* eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(struct string_expressioncxx . . $ string_expression#* expression, int linenumber, char *filename, char* linebuf) { |
| 89 | char *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *right, *left; |
| 90 | int length = 0; |
| 91 | listcxx . . $ list# *entry; |
| 92 | switch (expression->opcxx . . $ string_expression#op.) { |
| 93 | case STR_OP_STRcxx . . $ STR_OP_STR.: |
| 94 | str = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(expression->strcxx . . $ string_expression#str.); |
| 95 | break; |
| 96 | case STR_OP_VARIABLEcxx . . $ STR_OP_VARIABLE.: |
| 97 | entry = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 98 | if ((entry = list_findcxx . . $ list_find(51b945d76bf7eacf).(expression->strcxx . . $ string_expression#str., confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.))) { |
| 99 | str = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(((symbacxx . . $ symba#*)entry->datacxx . . $ list#data.)->valuecxx . . $ symba#value.?((symbacxx . . $ symba#*)entry->datacxx . . $ list#data.)->valuecxx . . $ symba#value.:""); |
| 100 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "variable substitution: replace '@@%c%s%c' with '%s'", '{', expression->str, '}', str) |
| 101 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(expression->strcxx . . $ string_expression#str., "AIDE_VERSION") == 0) { |
| 102 | str = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(confcxx . . $ conf.->aide_versioncxx . . $ db_config#aide_version.); |
| 103 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "variable substitution: replace '@@%c%s%c' with '%s'", '{', expression->str, '}', str) |
| 104 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(expression->strcxx . . $ string_expression#str., "HOSTNAME") == 0 && confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.) { |
| 105 | str = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.); |
| 106 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "variable substitution: replace '@@%c%s%c' with '%s'", '{', expression->str, '}', str) |
| 107 | } else { |
| 108 | str = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(""); |
| 109 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "variable substitution: variable '%s' not defined (use empty string)", expression->str) |
| 110 | } |
| 111 | break; |
| 112 | case STR_OP_CONCATcxx . . $ STR_OP_CONCAT.: |
| 113 | left = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->leftcxx . . $ string_expression#left., linenumber, filename, linebuf); |
| 114 | right = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->rightcxx . . $ string_expression#right., linenumber, filename, linebuf); |
| 115 | length = strlencxx . . $ strlen(751346f8406fd082).(left)+strlencxx . . $ strlen(751346f8406fd082).(right); |
| 116 | str = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(length+1); |
| 117 | strncpycxx . . $ strncpy(255158a415b673b0).(str, left, length+1); |
| 118 | strncatcxx . . $ strncat(255158a415b673b0).(str, right, length-strlencxx . . $ strlen(751346f8406fd082).(left)+1); |
| 119 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): string concat '%s' + '%s' evaluates to %s", (void*) expression, left, right, str); |
| 120 | freecxx . . $ free(5d22bdacc48458e8).(left); |
| 121 | freecxx . . $ free(5d22bdacc48458e8).(right); |
| 122 | break; |
| 123 | } |
| 124 | return str; |
| 125 | } |
| 126 | |
| 127 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! string_expression_to_boolcxx . . $ string_expression_to_bool(36119fd5e7485863).(string_expressioncxx . . $ string_expression# *e, int linenumber, char *filename, char* linebuf) { |
| 128 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! b = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 129 | char *str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(e, linenumber, filename, linebuf); |
| 130 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, "true") == 0 || strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, "yes") == 0) { |
| 131 | b = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 132 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, "false") != 0 && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, "no") != 0) { |
| 133 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "unrecognized bool value: '%s' (expecting %s)", str, "'true', 'yes','false' or 'no'") |
| 134 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 135 | } |
| 136 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 137 | return b; |
| 138 | } |
| 139 | |
| 140 | static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! eval_attribute_expressioncxx . . $ eval_attribute_expression(210695e08291b4).(struct attribute_expressioncxx . . $ attribute_expression#* expression, int linenumber, char *filename, char* linebuf) { |
| 141 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr = 0, attr_r; |
| 142 | |
| 143 | if (expression != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 144 | if (expression->leftcxx . . $ attribute_expression#left.) { |
| 145 | attr = eval_attribute_expressioncxx . . $ eval_attribute_expression(210695e08291b4).(expression->leftcxx . . $ attribute_expression#left., linenumber, filename, linebuf); |
| 146 | } |
| 147 | |
| 148 | attr_r = get_groupvalcxx . . $ get_groupval(38032e09955527d5).(expression->rightcxx . . $ attribute_expression#right.); |
| 149 | if(attr_r == DB_ATTR_UNDEFcxx . . $ `include/attributes.h:26:9`!) { |
| 150 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "group '%s' is not defined", expression->right) |
| 151 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 152 | } |
| 153 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): attribute group '%s' evaluates to %llu", (void*) expression, expression->rightcxx . . $ attribute_expression#right., attr_r); |
| 154 | switch (expression->opcxx . . $ attribute_expression#op.) { |
| 155 | case ATTR_OP_GROUPcxx . . $ ATTR_OP_GROUP.: |
| 156 | attr = attr_r; |
| 157 | break; |
| 158 | case ATTR_OP_PLUScxx . . $ ATTR_OP_PLUS.: |
| 159 | attr |= attr_r; |
| 160 | break; |
| 161 | case ATTR_OP_MINUScxx . . $ ATTR_OP_MINUS.: |
| 162 | attr &= (~attr_r); |
| 163 | break; |
| 164 | } |
| 165 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): attribute expression (op: %d, left: %p, right: '%s') evaluates to %llu", (void*) expression, expression->opcxx . . $ attribute_expression#op., (void*) expression->leftcxx . . $ attribute_expression#left., expression->rightcxx . . $ attribute_expression#right., attr); |
| 166 | } else { |
| 167 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): attribute expression is NULL and evaluates to %llu", (void*) expression, attr); |
| 168 | } |
| 169 | return attr; |
| 170 | } |
| 171 | |
| 172 | static void set_database_attr_optioncxx . . $ set_database_attr_option(ded06b9fe6229572).(DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr, int linenumber, char *filename, char* linebuf) { |
| 173 | char *str; |
| 174 | |
| 175 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! hashes = get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 176 | if (attr&(~hashes)) { |
| 177 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid attribute(s): %s", str = diff_attributes(0, attr&(~hashes))); |
| 178 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 179 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 180 | } |
| 181 | attr &= validate_hashescxx . . $ validate_hashes(ee42c3dd4b883080).(attr, linenumber, filename, linebuf); |
| 182 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'database_attrs' option to: %s", str = diff_attributes(0, attr)); |
| 183 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 184 | confcxx . . $ conf.->db_attrscxx . . $ db_config#db_attrs. = attr; |
| 185 | } |
| 186 | |
| 187 | static void eval_config_statementcxx . . $ eval_config_statement(cf67d3806d6bf79c).(config_option_statementcxx . . $ config_option_statement# statement, int linenumber, char *filename, char* linebuf) { |
| 188 | char *str; |
| 189 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! b; |
| 190 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr; |
| 191 | switch (statement.optioncxx . . $ config_option_statement#option.) { |
| 192 | ATTRIBUTE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:71:9`!(REPORT_IGNORE_ADDED_ATTRS_OPTION, report_ignore_added_attrs) |
| 193 | ATTRIBUTE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:71:9`!(REPORT_IGNORE_REMOVED_ATTRS_OPTION, report_ignore_removed_attrs) |
| 194 | ATTRIBUTE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:71:9`!(REPORT_IGNORE_CHANGED_ATTRS_OPTION, report_ignore_changed_attrs) |
| 195 | ATTRIBUTE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:71:9`!(REPORT_FORCE_ATTRS_OPTION, report_force_attrs) |
| 196 | case REPORT_URL_OPTIONcxx . . $ REPORT_URL_OPTION.: |
| 197 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 198 | if (!do_repurldefcxx . . $ do_repurldef(b34c553c1300b937).(str, linenumber, filename, linebuf)) { |
| 199 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 200 | } |
| 201 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 202 | break; |
| 203 | case ROOT_PREFIX_OPTIONcxx . . $ ROOT_PREFIX_OPTION.: |
| 204 | /* not to be freed, reused in do_rootprefix */ |
| 205 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 206 | if(do_rootprefixcxx . . $ do_rootprefix(b34c553c1300b937).(str, linenumber, filename, linebuf) == falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) { |
| 207 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 208 | } |
| 209 | break; |
| 210 | DATABASE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:79:9`!(DATABASE_IN_OPTION, DB_TYPE_IN) |
| 211 | DATABASE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:79:9`!(DATABASE_OUT_OPTION, DB_TYPE_OUT) |
| 212 | DATABASE_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:79:9`!(DATABASE_NEW_OPTION, DB_TYPE_NEW) |
| 213 | case DATABASE_ATTRIBUTES_OPTIONcxx . . $ DATABASE_ATTRIBUTES_OPTION.: |
| 214 | set_database_attr_optioncxx . . $ set_database_attr_option(ded06b9fe6229572).( |
| 215 | eval_attribute_expressioncxx . . $ eval_attribute_expression(210695e08291b4).(statement.acxx . . $ config_option_statement#a., linenumber, filename, linebuf), |
| 216 | linenumber, filename, linebuf); |
| 217 | break; |
| 218 | case DATABASE_GZIP_OPTIONcxx . . $ DATABASE_GZIP_OPTION.: |
| 219 | #ifdef WITH_ZLIBcxx . . $ `./include/config.h:266:9`! |
| 220 | b = string_expression_to_boolcxx . . $ string_expression_to_bool(36119fd5e7485863).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 221 | confcxx . . $ conf.->gzip_dboutcxx . . $ db_config#gzip_dbout.=b; |
| 222 | #else |
| 223 | LOG_CONFIG_FORMAT_LINE(LOG_LEVEL_ERROR, "%s", "gzip support not compiled in, recompile AIDE with '--with-zlib'") |
| 224 | exit(INVALID_CONFIGURELINE_ERROR); |
| 225 | #endif |
| 226 | break; |
| 227 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(DATABASE_ADD_METADATA_OPTION, database_add_metadata) |
| 228 | case ACL_NO_SYMLINK_FOLLOW_OPTIONcxx . . $ ACL_NO_SYMLINK_FOLLOW_OPTION.: |
| 229 | #ifdef WITH_ACL |
| 230 | b = string_expression_to_bool(statement.e, linenumber, filename, linebuf); |
| 231 | conf->no_acl_on_symlinks=b; |
| 232 | #else |
| 233 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "%s", "acl support not compiled in, recompile AIDE with '--with-posix-acl'") |
| 234 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 235 | #endif |
| 236 | break; |
| 237 | case REPORT_IGNORE_E2FSATTRS_OPTIONcxx . . $ REPORT_IGNORE_E2FSATTRS_OPTION.: |
| 238 | #ifdef WITH_E2FSATTRS |
| 239 | str = eval_string_expression(statement.e, linenumber, filename, linebuf); |
| 240 | do_report_ignore_e2fsattrs(str, linenumber, filename, linebuf); |
| 241 | free(str); |
| 242 | #else |
| 243 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "%s", "e2fsattrs support not compiled in, recompile AIDE with '--with-e2fsattrs'") |
| 244 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 245 | #endif |
| 246 | break; |
| 247 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_BASE16_OPTION, report_base16) |
| 248 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_DETAILED_INIT_OPTION, report_detailed_init) |
| 249 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_GROUPED_OPTION, report_grouped) |
| 250 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_QUIET_OPTION, report_quiet) |
| 251 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_APPEND_OPTION, report_append) |
| 252 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(REPORT_SUMMARIZE_CHANGES_OPTION, report_summarize_changes) |
| 253 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(WARN_DEAD_SYMLINKS_OPTION, warn_dead_symlinks) |
| 254 | BOOL_CONFIG_OPTION_CASEcxx . . $ `src/conf_eval.c:64:9`!(CONFIG_CHECK_WARN_UNRESTRICTED_RULES, config_check_warn_unrestricted_rules) |
| 255 | case REPORT_LEVEL_OPTIONcxx . . $ REPORT_LEVEL_OPTION.: |
| 256 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 257 | if(!do_reportlevelcxx . . $ do_reportlevel(b34c553c1300b937).(str, linenumber, filename, linebuf)) { |
| 258 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 259 | } |
| 260 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 261 | break; |
| 262 | case REPORT_FORMAT_OPTIONcxx . . $ REPORT_FORMAT_OPTION.: |
| 263 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 264 | REPORT_FORMATcxx . . $ REPORT_FORMAT# report_format = get_report_formatcxx . . $ get_report_format(286e75ce408cac52).(str); |
| 265 | if (report_format != REPORT_FORMAT_UNKNOWNcxx . . $ REPORT_FORMAT_UNKNOWN.) { |
| 266 | confcxx . . $ conf.->report_formatcxx . . $ db_config#report_format. = report_format; |
| 267 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'report_format' option to '%s' (raw: %d)", str, report_format) |
| 268 | } else { |
| 269 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid report format: '%s'", str); |
| 270 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 271 | } |
| 272 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 273 | break; |
| 274 | case LOG_LEVEL_OPTIONcxx . . $ LOG_LEVEL_OPTION.: |
| 275 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 276 | LOG_LEVELcxx . . $ LOG_LEVEL# level = get_log_level_from_stringcxx . . $ get_log_level_from_string(1c46f449ef604568).(str); |
| 277 | if (level == LOG_LEVEL_UNSETcxx . . $ LOG_LEVEL_UNSET.) { |
| 278 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid log level: '%s'", str); |
| 279 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 280 | } else { |
| 281 | if (is_log_level_unsetcxx . . $ is_log_level_unset(c9857a73d68e59ba).() || ( confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`! && !log_level_set_in_configcxx . . $ log_level_set_in_config. )) { |
| 282 | if (!(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!)) { |
| 283 | set_log_levelcxx . . $ set_log_level(acc15b7e06406d4e).(level); |
| 284 | } else { |
| 285 | log_level_set_in_configcxx . . $ log_level_set_in_config. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 286 | } |
| 287 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'log_level' option to '%s'", str) |
| 288 | } else { |
| 289 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "'log_level' option already set (ignore new value '%s')", str) |
| 290 | } |
| 291 | } |
| 292 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 293 | break; |
| 294 | case CONFIG_VERSIONcxx . . $ CONFIG_VERSION.: |
| 295 | /* not to be freed, used directly for config_version */ |
| 296 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 297 | confcxx . . $ conf.->config_versioncxx . . $ db_config#config_version. = str; |
| 298 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'config_version' option to '%s'", str) |
| 299 | break; |
| 300 | case LIMIT_CMDLINE_OPTIONcxx . . $ LIMIT_CMDLINE_OPTION.: |
| 301 | /* command-line options are ignored here */ |
| 302 | break; |
| 303 | case NUM_WORKERScxx . . $ NUM_WORKERS.: |
| 304 | str = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.ecxx . . $ config_option_statement#e., linenumber, filename, linebuf); |
| 305 | |
| 306 | if (confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. < 0) { |
| 307 | long num_workers = do_num_workerscxx . . $ do_num_workers(3c95bd14d5d5d286).(str); |
| 308 | if (num_workers < 0) { |
| 309 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid number of workers: '%s'", str); |
| 310 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 311 | } |
| 312 | confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. = num_workers; |
| 313 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'num_workers' option to %ld (config value: '%s')", conf->num_workers, str) |
| 314 | } else { |
| 315 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "'num_workers' option already set (ignore new value '%s')", str) |
| 316 | } |
| 317 | break; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | static void parse_versioncxx . . $ parse_version(e7ed02553f74b0e7).(const char * version_str, long version[3], int linenumber, char *filename, char* linebuf) { |
| 322 | char * endptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 323 | int i = 0; |
| 324 | |
| 325 | const char *ptr = version_str; |
| 326 | while (*ptr && i < 3) { |
| 327 | version[i] = strtolcxx . . $ strtol(44bbb87609b212fc).(ptr, &endptr, 10); |
| 328 | if ( ptr == endptr || errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!==ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`! || version[i] < 0) { |
| 329 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid version string: '%s', expected MAJOR.MINOR.PATCH", version_str); |
| 330 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 331 | } |
| 332 | if (*endptr != '.') { |
| 333 | break; |
| 334 | } |
| 335 | ptr = endptr + 1; |
| 336 | i++; |
| 337 | } |
| 338 | if (endptr && *endptr) { |
| 339 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_DEBUG, "ignore suffix '%s' of version string '%s'", endptr, version_str); |
| 340 | } |
| 341 | |
| 342 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_DEBUG, "parse version string '%s' to major: %ld, minor: %ld, patch: %ld version", version_str, version[0], version[1], version[2] ); |
| 343 | } |
| 344 | |
| 345 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_version_gecxx . . $ compare_version_ge(f58d2d875a6c6ca8).(const char *left_version_str, const char *right_version_str, int linenumber, char *filename, char* linebuf) { |
| 346 | long left_version[3] = { 0 }; |
| 347 | long right_version[3] = { 0 }; |
| 348 | parse_versioncxx . . $ parse_version(e7ed02553f74b0e7).(left_version_str, left_version, linenumber, filename, linebuf); |
| 349 | parse_versioncxx . . $ parse_version(e7ed02553f74b0e7).(right_version_str, right_version, linenumber, filename, linebuf); |
| 350 | |
| 351 | for (int i = 0 ; i <= 2 ; ++i) { |
| 352 | if (left_version[i] < right_version[i]) { |
| 353 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 354 | } else if (left_version[i] > right_version[i]) { |
| 355 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 356 | } |
| 357 | } |
| 358 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 359 | } |
| 360 | |
| 361 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! eval_bool_expressioncxx . . $ eval_bool_expression(95b14849be33866a).(struct bool_expressioncxx . . $ bool_expression#* expression, int linenumber, char *filename, char* linebuf) { |
| 362 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! result = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 363 | unioncxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0# { |
| 364 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! _boolcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_bool.; |
| 365 | char *_strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str.; |
| 366 | } left; |
| 367 | unioncxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1# { |
| 368 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! _boolcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_bool.; |
| 369 | char *_strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_str.; |
| 370 | } right; |
| 371 | |
| 372 | switch (expression->opcxx . . $ bool_expression#op.) { |
| 373 | case BOOL_OP_EXISTScxx . . $ BOOL_OP_EXISTS.: |
| 374 | left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str. = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str., linenumber, filename, linebuf); |
| 375 | int retval = accesscxx . . $ access(cb7559238bb26814).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., F_OKcxx . . $ `<external>/12628407106812493757/unistd.h:284:9`!); |
| 376 | result = (retval == 0); |
| 377 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "access('%s', F_OK) returns %d: (%s)", left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., retval, result?"Success":strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 378 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): bool exists '%s': %s", (void*) expression, left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., btoacxx . . $ btoa(626eec357d49c77e).(result)); |
| 379 | freecxx . . $ free(5d22bdacc48458e8).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str.); |
| 380 | break; |
| 381 | case BOOL_OP_DEFINEDcxx . . $ BOOL_OP_DEFINED.: |
| 382 | left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str. = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str., linenumber, filename, linebuf); |
| 383 | result = list_findcxx . . $ list_find(51b945d76bf7eacf).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 384 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): bool defined '%s': %s", (void*) expression, left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., btoacxx . . $ btoa(626eec357d49c77e).(result)); |
| 385 | freecxx . . $ free(5d22bdacc48458e8).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str.); |
| 386 | break; |
| 387 | case BOOL_OP_HOSTNAMEcxx . . $ BOOL_OP_HOSTNAME.: |
| 388 | left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str. = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str., linenumber, filename, linebuf); |
| 389 | if (confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.) { |
| 390 | result = strcmpcxx . . $ strcmp(5ae29d726ae57f88).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.) == 0; |
| 391 | } else { |
| 392 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_WARNING, "%s", "hostname not available; ifhost and ifnhost always evaluate to 'false'") |
| 393 | } |
| 394 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): bool hostname '%s' (hostname: '%s'): %s", (void*) expression, left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname., btoacxx . . $ btoa(626eec357d49c77e).(result)); |
| 395 | freecxx . . $ free(5d22bdacc48458e8).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str.); |
| 396 | break; |
| 397 | case BOOL_OP_NOTcxx . . $ BOOL_OP_NOT.: |
| 398 | left._boolcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_bool. = eval_bool_expressioncxx . . $ eval_bool_expression(95b14849be33866a).(expression->leftcxx . . $ bool_expression#left.._boolcxx . . $ bool_expression#$anonymous_type_1#_bool., linenumber, filename, linebuf); |
| 399 | result = !left._boolcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_bool.; |
| 400 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): bool !%s: %s", (void*) expression, btoacxx . . $ btoa(626eec357d49c77e).(left._boolcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_bool.), btoacxx . . $ btoa(626eec357d49c77e).(result)); |
| 401 | break; |
| 402 | case BOOL_OP_VERSION_GEcxx . . $ BOOL_OP_VERSION_GE.: |
| 403 | left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str. = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->leftcxx . . $ bool_expression#left.._strcxx . . $ bool_expression#$anonymous_type_1#_str., linenumber, filename, linebuf); |
| 404 | right._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_str. = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(expression->rightcxx . . $ bool_expression#right.._strcxx . . $ bool_expression#$anonymous_type_2#_str., linenumber, filename, linebuf); |
| 405 | result = compare_version_gecxx . . $ compare_version_ge(f58d2d875a6c6ca8).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., right._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_str., linenumber, filename, linebuf); |
| 406 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): bool %s version_ge %s: %s", (void*) expression, left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str., right._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_str., btoacxx . . $ btoa(626eec357d49c77e).(result)); |
| 407 | freecxx . . $ free(5d22bdacc48458e8).(left._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_0#_str.); |
| 408 | freecxx . . $ free(5d22bdacc48458e8).(right._strcxx . . $ eval_bool_expression(95b14849be33866a).$anonymous_type_1#_str.); |
| 409 | break; |
| 410 | } |
| 411 | return result; |
| 412 | } |
| 413 | |
| 414 | static void eval_group_statementcxx . . $ eval_group_statement(89f2b69b130639ac).(group_statementcxx . . $ group_statement# statement, int linenumber, char *filename, char* linebuf) { |
| 415 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr, prev_attr; |
| 416 | char *str; |
| 417 | attr = eval_attribute_expressioncxx . . $ eval_attribute_expression(210695e08291b4).(statement.exprcxx . . $ group_statement#expr., linenumber, filename, linebuf); |
| 418 | if ((prev_attr = do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).(statement.namecxx . . $ group_statement#name., attr))) { |
| 419 | char *str2; |
| 420 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "redefine group '%s' with value '%s' (previous value: '%s')", statement.name, str = diff_attributes(0, attr), str2 = diff_attributes(0, prev_attr)) |
| 421 | freecxx . . $ free(5d22bdacc48458e8).(str2); |
| 422 | } else { |
| 423 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "define group '%s' with value '%s'", statement.name, str = diff_attributes(0, attr)) |
| 424 | } |
| 425 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 426 | } |
| 427 | |
| 428 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! evaL_if_conditioncxx . . $ evaL_if_condition(8e21b1857781f8f5).(if_conditioncxx . . $ if_condition#* c) { |
| 429 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): if condition", (void*) c); |
| 430 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! cond_result = eval_bool_expressioncxx . . $ eval_bool_expression(95b14849be33866a).(c->expressioncxx . . $ if_condition#expression., c->linenumbercxx . . $ if_condition#linenumber., c->filenamecxx . . $ if_condition#filename., c->linebufcxx . . $ if_condition#linebuf.); |
| 431 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_CONFIGcxx . . $ LOG_LEVEL_CONFIG.,"%s:%d: if condition results to '%s' (line: '%s')", c->filenamecxx . . $ if_condition#filename., c->linenumbercxx . . $ if_condition#linenumber., btoacxx . . $ btoa(626eec357d49c77e).(cond_result), c->linebufcxx . . $ if_condition#linebuf.); |
| 432 | return cond_result; |
| 433 | } |
| 434 | |
| 435 | static void eval_if_statementcxx . . $ eval_if_statement(89a98f2b0b0ea133).(if_statementcxx . . $ if_statement# statement, int include_depth, char* rule_prefix, int linenumber, char *filename, char* linebuf) { |
| 436 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! condition = evaL_if_conditioncxx . . $ evaL_if_condition(8e21b1857781f8f5).(statement.conditioncxx . . $ if_statement#condition.); |
| 437 | |
| 438 | if (condition) { |
| 439 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): if branch", (void*) statement.if_branchcxx . . $ if_statement#if_branch.); |
| 440 | if (statement.if_branchcxx . . $ if_statement#if_branch.) { |
| 441 | eval_configcxx . . $ eval_config(e724537fafad80a4).(statement.if_branchcxx . . $ if_statement#if_branch., include_depth, rule_prefix); |
| 442 | } |
| 443 | } else { |
| 444 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): else branch", (void*) statement.else_branchcxx . . $ if_statement#else_branch.); |
| 445 | if (statement.else_branchcxx . . $ if_statement#else_branch.) { |
| 446 | eval_configcxx . . $ eval_config(e724537fafad80a4).(statement.else_branchcxx . . $ if_statement#else_branch., include_depth, rule_prefix); |
| 447 | } |
| 448 | } |
| 449 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "%s", "endif") |
| 450 | } |
| 451 | |
| 452 | static void eval_define_statementcxx . . $ eval_define_statement(8912bb488f8b9512).(define_statementcxx . . $ define_statement# statement, int linenumber, char *filename, char* linebuf) { |
| 453 | do_definecxx . . $ do_define(2e05f45e14b1fbf7).(statement.namecxx . . $ define_statement#name., |
| 454 | /* not to be freed, reused in do_define */ |
| 455 | statement.valuecxx . . $ define_statement#value.?eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.valuecxx . . $ define_statement#value., linenumber, filename, linebuf):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 456 | linenumber, filename, linebuf); |
| 457 | } |
| 458 | |
| 459 | static void eval_undefine_statementcxx . . $ eval_undefine_statement(f199249bafd9cb20).(undefine_statementcxx . . $ undefine_statement# statement, int linenumber, char *filename, char* linebuf) { |
| 460 | do_undefinecxx . . $ do_undefine(f4a6a4b786ef4e0b).(statement.namecxx . . $ undefine_statement#name., linenumber, filename, linebuf); |
| 461 | } |
| 462 | |
| 463 | static int dirfiltercxx . . $ dirfilter(39071f79bcec8c).(const struct direntcxx . . $ dirent# *d) { |
| 464 | return (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(d->d_namecxx . . $ dirent#d_name., ".") != 0 && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(d->d_namecxx . . $ dirent#d_name., "..") != 0); |
| 465 | } |
| 466 | |
| 467 | static void eval_x_include_setenv_statementcxx . . $ eval_x_include_setenv_statement(e0d74717215b45b0).(x_include_setenv_statementcxx . . $ x_include_setenv_statement# statement, int linenumber, char *filename, char* linebuf) { |
| 468 | symbacxx . . $ symba#* s=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 469 | listcxx . . $ list#* l=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 470 | |
| 471 | char* value = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.valuecxx . . $ x_include_setenv_statement#value., linenumber, filename, linebuf); |
| 472 | |
| 473 | if(!(l=list_findcxx . . $ list_find(51b945d76bf7eacf).(statement.variablecxx . . $ x_include_setenv_statement#variable.,x_include_environmentcxx . . $ x_include_environment.))) { |
| 474 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "add '%s' with value '%s' to @@x_include environment", statement.variable, value) |
| 475 | s=(symbacxx . . $ symba#*)checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(symbacxx . . $ symba#)); |
| 476 | s->namecxx . . $ symba#name.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(statement.variablecxx . . $ x_include_setenv_statement#variable.); |
| 477 | s->valuecxx . . $ symba#value.=value; |
| 478 | x_include_environmentcxx . . $ x_include_environment.=list_appendcxx . . $ list_append(6224ec1eaf824d25).(x_include_environmentcxx . . $ x_include_environment.,(void*)s); |
| 479 | } else { |
| 480 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "overwrite '%s' variable with value '%s' in @@x_include environment (previous value: '%s')", statement.variable, value, ((symba*)l->data)->value) |
| 481 | freecxx . . $ free(5d22bdacc48458e8).(((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.); |
| 482 | ((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 483 | ((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.=value; |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | static void include_filecxx . . $ include_file(296f645c3af370c1).(const char* file, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! execute, int include_depth, char* rule_prefix) { |
| 488 | if (execute) { |
| 489 | int p_stdout[2]; |
| 490 | int p_stderr[2]; |
| 491 | pid_tcxx . . $ pid_t# pid; |
| 492 | |
| 493 | if (pipecxx . . $ pipe(a5f7824ee4986326).(p_stdout)==-1) { |
| 494 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: pipe stdout failed: %s", file, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 495 | exitcxx . . $ exit(3ca292c338df9bb3).(EXEC_ERRORcxx . . $ `include/errorcodes.h:31:9`!); |
| 496 | } |
| 497 | if (pipecxx . . $ pipe(a5f7824ee4986326).(p_stderr)==-1) { |
| 498 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: pipe stderr failed: %s", file, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 499 | exitcxx . . $ exit(3ca292c338df9bb3).(EXEC_ERRORcxx . . $ `include/errorcodes.h:31:9`!); |
| 500 | } |
| 501 | if ((pid = forkcxx . . $ fork(b126dc7c1de90089).()) == -1) { |
| 502 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: fork failed: %s", file, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 503 | exitcxx . . $ exit(3ca292c338df9bb3).(EXEC_ERRORcxx . . $ `include/errorcodes.h:31:9`!); |
| 504 | } |
| 505 | |
| 506 | if(pid == 0) { |
| 507 | /* child */ |
| 508 | closecxx . . $ close(7864480464b09eea).(p_stdout[0]); |
| 509 | dup2cxx . . $ dup2(9b79fb6aee4c0440). (p_stdout[1], STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!); |
| 510 | closecxx . . $ close(7864480464b09eea).(p_stdout[1]); |
| 511 | closecxx . . $ close(7864480464b09eea).(p_stderr[0]); |
| 512 | dup2cxx . . $ dup2(9b79fb6aee4c0440). (p_stderr[1], STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!); |
| 513 | closecxx . . $ close(7864480464b09eea).(p_stderr[1]); |
| 514 | |
| 515 | listcxx . . $ list# *entry; |
| 516 | for(entry = x_include_environmentcxx . . $ x_include_environment. ; entry != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; entry = entry->nextcxx . . $ list#next.) { |
| 517 | char* name = ((symbacxx . . $ symba#*)entry->datacxx . . $ list#data.)->namecxx . . $ symba#name.; |
| 518 | char* value = ((symbacxx . . $ symba#*)entry->datacxx . . $ list#data.)->valuecxx . . $ symba#value.; |
| 519 | if (setenvcxx . . $ setenv(f0be30763a490cce).(name, value, 0) < 0) { |
| 520 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "aide: @@x_include: setenv for '%s' failed: %s\n", name, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 521 | exitcxx . . $ exit(3ca292c338df9bb3).(EXEC_ERRORcxx . . $ `include/errorcodes.h:31:9`!); |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | execlcxx . . $ execl(5e8a2c12db2ea735).(file, file, (char*) NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 526 | } else { |
| 527 | /* parent */ |
| 528 | closecxx . . $ close(7864480464b09eea).(p_stdout[1]); |
| 529 | closecxx . . $ close(7864480464b09eea).(p_stderr[1]); |
| 530 | |
| 531 | char* config_str = pipe2stringcxx . . $ pipe2string(ff224f080444ee45).(p_stdout[0]); |
| 532 | closecxx . . $ close(7864480464b09eea).(p_stdout[0]); |
| 533 | char* child_stderr = pipe2stringcxx . . $ pipe2string(ff224f080444ee45).(p_stderr[0]); |
| 534 | closecxx . . $ close(7864480464b09eea).(p_stderr[0]); |
| 535 | |
| 536 | int wstatus; |
| 537 | waitpidcxx . . $ waitpid(1df93256b606fe1f).(pid, &wstatus, 0); |
| 538 | if (child_stderr || !WIFEXITEDcxx . . $ `<external>/10696550936717951914/stdlib.h:51:10`!(wstatus) || WEXITSTATUScxx . . $ `<external>/10696550936717951914/stdlib.h:48:10`!(wstatus)) { |
| 539 | char* newline; |
| 540 | |
| 541 | while (child_stderr && *child_stderr != '\0') { |
| 542 | newline = strchrcxx . . $ `<external>/13506128340496143423/string.h:264:11`!(child_stderr, '\n'); |
| 543 | if (newline != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 544 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: stderr> %.*s", file, (int)(newline-child_stderr), child_stderr); |
| 545 | child_stderr = newline+1; |
| 546 | } else { |
| 547 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: stderr> %s", file, child_stderr); |
| 548 | break; |
| 549 | } |
| 550 | } |
| 551 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "%s: execution failed (exit status: %d)", file, WEXITSTATUScxx . . $ `<external>/10696550936717951914/stdlib.h:48:10`!(wstatus)); |
| 552 | exitcxx . . $ exit(3ca292c338df9bb3).(EXEC_ERRORcxx . . $ `include/errorcodes.h:31:9`!); |
| 553 | } |
| 554 | |
| 555 | if (config_str) { |
| 556 | astcxx . . $ ast#* config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 557 | int len = (strlencxx . . $ strlen(751346f8406fd082).(file) + 10) * sizeof(char); |
| 558 | char * source_name = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len); |
| 559 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(source_name, len, "%s (stdout)", file); |
| 560 | conf_lex_stringcxx . . $ conf_lex_string(2fa786934fe80e24).(source_name, config_str); |
| 561 | if(confparsecxx . . $ confparse(2292d3dea3e4c376).(&config_ast)){ |
| 562 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 563 | } |
| 564 | conf_lex_delete_buffercxx . . $ conf_lex_delete_buffer(49f6e7a06ebc5aa8).(); |
| 565 | freecxx . . $ free(5d22bdacc48458e8).(source_name); |
| 566 | eval_configcxx . . $ eval_config(e724537fafad80a4).(config_ast, include_depth, rule_prefix); |
| 567 | deep_freecxx . . $ deep_free(888ed87a56794581).(config_ast); |
| 568 | } |
| 569 | freecxx . . $ free(5d22bdacc48458e8).(config_str); |
| 570 | } |
| 571 | } else { |
| 572 | astcxx . . $ ast#* config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 573 | conf_lex_filecxx . . $ conf_lex_file(85c52e162fed56f9).(file); |
| 574 | if(confparsecxx . . $ confparse(2292d3dea3e4c376).(&config_ast)){ |
| 575 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 576 | } |
| 577 | conf_lex_delete_buffercxx . . $ conf_lex_delete_buffer(49f6e7a06ebc5aa8).(); |
| 578 | eval_configcxx . . $ eval_config(e724537fafad80a4).(config_ast, include_depth, rule_prefix); |
| 579 | deep_freecxx . . $ deep_free(888ed87a56794581).(config_ast); |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | void check_permissionscxx . . $ check_permissions(7a1938f3c75987a4).(const char* path, struct statcxx . . $ stat# *st, int linenumber, char *filename, char* linebuf) { |
| 584 | if ((st->st_uidcxx . . $ stat#st_uid. != geteuidcxx . . $ geteuid(db52760e79bf9054).() && st->st_uidcxx . . $ stat#st_uid. != 0) || (st->st_modecxx . . $ stat#st_mode. & 002) != 0 || (st->st_modecxx . . $ stat#st_mode. & 020) != 0) { |
| 585 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'@@x_include': bad ownership or modes for '%s' (please ensure it is neither group- nor world-writable and owned by the current user or root)", path) |
| 586 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | static void include_directorycxx . . $ include_directory(adbb561a0beeb79b).(const char* dir, const char* rx, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! execute, char* new_rule_prefix, int include_depth, char* rule_prefix, int linenumber, char *filename, char* linebuf) { |
| 591 | LOG_CONFIG_FORMAT_LINE_PREFIXcxx . . $ `include/log.h:66:9`!(LOG_LEVEL_CONFIG, "include directory '%s' (regex: '%s', execute: %s , prefix: '%s', depth: %d)", dir, rx, btoa(execute), new_rule_prefix?new_rule_prefix:"", include_depth) |
| 592 | |
| 593 | struct direntcxx . . $ dirent# **namelist; |
| 594 | int n; |
| 595 | |
| 596 | int pcre2_errorcode; |
| 597 | PCRE2_SIZEcxx . . $ `<external>/9988290459910441303/pcre2.h:528:9`! pcre2_erroffset; |
| 598 | pcre2_codecxx . . $ `<external>/9988290459910441303/pcre2.h:879:9`!* crx; |
| 599 | |
| 600 | if((crx = pcre2_compilecxx . . $ `<external>/9988290459910441303/pcre2.h:910:9`!((PCRE2_SPTRcxx . . $ `<external>/9988290459910441303/pcre2.h:877:9`!) rx, PCRE2_ZERO_TERMINATEDcxx . . $ `<external>/9988290459910441303/pcre2.h:530:9`!, PCRE2_UTFcxx . . $ `<external>/9988290459910441303/pcre2.h:138:9`!, &pcre2_errorcode, &pcre2_erroffset, 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`!) { |
| 601 | PCRE2_UCHARcxx . . $ `<external>/9988290459910441303/pcre2.h:876:9`! pcre2_error[128]; |
| 602 | pcre2_get_error_messagecxx . . $ `<external>/9988290459910441303/pcre2.h:923:9`!(pcre2_errorcode, pcre2_error, 128); |
| 603 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': error in regular expression '%s' at %zu: %s", execute?"@@x_include":"@@include", rx, pcre2_erroffset, pcre2_error) |
| 604 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 605 | } |
| 606 | pcre2_match_datacxx . . $ `<external>/9988290459910441303/pcre2.h:901:9`! *match_data = pcre2_match_data_create_from_patterncxx . . $ `<external>/9988290459910441303/pcre2.h:943:9`!(crx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 607 | if (match_data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 608 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "pcre2_match_data_create_from_pattern: failed to allocate memory"); |
| 609 | exitcxx . . $ exit(3ca292c338df9bb3).(MEMORY_ALLOCATION_FAILUREcxx . . $ `include/errorcodes.h:33:9`!); |
| 610 | } |
| 611 | |
| 612 | struct statcxx . . $ stat# fs; |
| 613 | |
| 614 | if (execute) { |
| 615 | if (statcxx . . $ stat(a9cd1e23e96f423c).(dir,&fs) == -1) { |
| 616 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'@@x_include': stat for '%s' failed: %s", dir, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)) |
| 617 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 618 | } |
| 619 | check_permissionscxx . . $ check_permissions(7a1938f3c75987a4).(dir, &fs, linenumber, filename, linebuf); |
| 620 | } |
| 621 | |
| 622 | n = scandircxx . . $ scandir(80db5f6f22a33983).(dir, &namelist, dirfiltercxx . . $ dirfilter(39071f79bcec8c)., alphasortcxx . . $ alphasort(8ee30c382224a01).); |
| 623 | if (n == -1) { |
| 624 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': failed to open directory '%s': %s", execute?"@@x_include":"@@include", dir, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)) |
| 625 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 626 | } |
| 627 | |
| 628 | if (new_rule_prefix && *new_rule_prefix != '/') { |
| 629 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': invalid rule prefix '%s': unexpected first character '%c', expected '/'", execute?"@@x_include":"@@include", new_rule_prefix, *new_rule_prefix) |
| 630 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 631 | } |
| 632 | /* not to be freed, reused in add_rx_rule_to_tree */ |
| 633 | char* nested_rule_prefix = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 634 | if (rule_prefix && new_rule_prefix) { |
| 635 | int length = strlencxx . . $ strlen(751346f8406fd082).(rule_prefix)+strlencxx . . $ strlen(751346f8406fd082).(new_rule_prefix); |
| 636 | nested_rule_prefix = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(length+1); |
| 637 | strncpycxx . . $ strncpy(255158a415b673b0).(nested_rule_prefix, rule_prefix, length+1); |
| 638 | strncatcxx . . $ strncat(255158a415b673b0).(nested_rule_prefix, new_rule_prefix, length-strlencxx . . $ strlen(751346f8406fd082).(rule_prefix)+1); |
| 639 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "concatenate current prefix '%s' and new prefix '%s': '%s'", rule_prefix, new_rule_prefix, nested_rule_prefix); |
| 640 | freecxx . . $ free(5d22bdacc48458e8).(new_rule_prefix); |
| 641 | } else if (rule_prefix) { |
| 642 | nested_rule_prefix = rule_prefix; |
| 643 | } else if (new_rule_prefix) { |
| 644 | nested_rule_prefix = new_rule_prefix; |
| 645 | } |
| 646 | |
| 647 | int dir_len = strlencxx . . $ strlen(751346f8406fd082).(dir); |
| 648 | for (int i = 0 ; i < n ; ++i) { |
| 649 | |
| 650 | int len = (dir_len+strlencxx . . $ strlen(751346f8406fd082).(namelist[i]->d_namecxx . . $ dirent#d_name.)+2)*sizeof(char); |
| 651 | char * filepath = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len); |
| 652 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(filepath, len, "%s/%s", dir, namelist[i]->d_namecxx . . $ dirent#d_name.); |
| 653 | if (statcxx . . $ stat(a9cd1e23e96f423c).(filepath,&fs) == -1) { |
| 654 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': stat for '%s' failed: %s", execute?"@@x_include":"@@include", filepath, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)) |
| 655 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 656 | } |
| 657 | if (S_ISREGcxx . . $ `<external>/531885356569766532/stat.h:128:9`!(fs.st_mode)) { |
| 658 | int match=pcre2_matchcxx . . $ `<external>/9988290459910441303/pcre2.h:938:9`!(crx, (PCRE2_SPTRcxx . . $ `<external>/9988290459910441303/pcre2.h:877:9`!) namelist[i]->d_namecxx . . $ dirent#d_name., PCRE2_ZERO_TERMINATEDcxx . . $ `<external>/9988290459910441303/pcre2.h:530:9`!, 0, 0, match_data, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 659 | if(match < 0) { |
| 660 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG.,"%s: skip '%s' (reason: file name does not match regex '%s')", dir, namelist[i]->d_namecxx . . $ dirent#d_name., rx); |
| 661 | } else { |
| 662 | int exec = execute && S_IXUSRcxx . . $ `<external>/531885356569766532/stat.h:170:9`!&fs.st_modecxx . . $ stat#st_mode.; |
| 663 | if (exec) { |
| 664 | check_permissionscxx . . $ check_permissions(7a1938f3c75987a4).(filepath, &fs, linenumber, filename, linebuf); |
| 665 | } |
| 666 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_CONFIGcxx . . $ LOG_LEVEL_CONFIG.,"%s: %s '%s'", dir, exec?"execute":"include", namelist[i]->d_namecxx . . $ dirent#d_name.); |
| 667 | include_filecxx . . $ include_file(296f645c3af370c1).(filepath, exec, include_depth, nested_rule_prefix); |
| 668 | } |
| 669 | } else { |
| 670 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG.,"%s: skip '%s' (reason: file is not a regular file)", dir, namelist[i]->d_namecxx . . $ dirent#d_name.); |
| 671 | } |
| 672 | |
| 673 | freecxx . . $ free(5d22bdacc48458e8).(filepath); |
| 674 | freecxx . . $ free(5d22bdacc48458e8).(namelist[i]); |
| 675 | } |
| 676 | freecxx . . $ free(5d22bdacc48458e8).(namelist); |
| 677 | pcre2_match_data_freecxx . . $ `<external>/9988290459910441303/pcre2.h:944:9`!(match_data); |
| 678 | pcre2_code_freecxx . . $ `<external>/9988290459910441303/pcre2.h:909:9`!(crx); |
| 679 | } |
| 680 | |
| 681 | static void eval_include_statementcxx . . $ eval_include_statement(6c69af9c561f1a7).(include_statementcxx . . $ include_statement# statement, int include_depth, char* rule_prefix, int linenumber, char *filename, char* linebuf) { |
| 682 | if (include_depth >= 16) { |
| 683 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "%s", "include files are nested too deeply") |
| 684 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 685 | } |
| 686 | char* path = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.pathcxx . . $ include_statement#path., linenumber, filename, linebuf); |
| 687 | char* rx = statement.rxcxx . . $ include_statement#rx.?eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.rxcxx . . $ include_statement#rx., linenumber, filename, linebuf):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 688 | |
| 689 | if (rx) { |
| 690 | char* new_rule_prefix = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 691 | if (statement.prefixcxx . . $ include_statement#prefix.) { |
| 692 | new_rule_prefix = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.prefixcxx . . $ include_statement#prefix., linenumber, filename, linebuf); |
| 693 | int prefix_length = strlencxx . . $ strlen(751346f8406fd082).(new_rule_prefix); |
| 694 | if (prefix_length && new_rule_prefix[prefix_length-1] == '/') { |
| 695 | new_rule_prefix[prefix_length-1] = '\0'; |
| 696 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "%s: removed trailing '/' from prefix: '%s'", statement.execute?"@@x_include":"@@include", new_rule_prefix); |
| 697 | } |
| 698 | } |
| 699 | include_directorycxx . . $ include_directory(adbb561a0beeb79b).(path, rx, statement.executecxx . . $ include_statement#execute., new_rule_prefix, include_depth, rule_prefix, linenumber, filename, linebuf); |
| 700 | freecxx . . $ free(5d22bdacc48458e8).(rx); |
| 701 | } else { |
| 702 | struct statcxx . . $ stat# fs; |
| 703 | if (lstatcxx . . $ lstat(a9cd1e23e96f423c).(path,&fs) == -1) { |
| 704 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'@@include': lstat for '%s' failed: %s", path, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)) |
| 705 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 706 | } |
| 707 | if (S_ISREGcxx . . $ `<external>/531885356569766532/stat.h:128:9`!(fs.st_mode)) { |
| 708 | LOG_CONFIG_FORMAT_LINE_PREFIXcxx . . $ `include/log.h:66:9`!(LOG_LEVEL_CONFIG, "include file '%s' (depth: %d)", path, include_depth) |
| 709 | include_filecxx . . $ include_file(296f645c3af370c1).(path, statement.executecxx . . $ include_statement#execute. && S_IXUSRcxx . . $ `<external>/531885356569766532/stat.h:170:9`!&fs.st_modecxx . . $ stat#st_mode., include_depth, rule_prefix); |
| 710 | } else { |
| 711 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'@@include': '%s' is not a regular file", path); |
| 712 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 713 | } |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | static FT_TYPEcxx . . $ `include/file.h:28:9`! eval_ft_restriction_expressioncxx . . $ eval_ft_restriction_expression(c83eabb626e42458).(ft_restriction_expressioncxx . . $ ft_restriction_expression# *expression, int linenumber, char *filename, char* linebuf) { |
| 718 | FT_TYPEcxx . . $ `include/file.h:28:9`! rs = FT_NULLcxx . . $ `include/file.h:29:9`!, rs_r; |
| 719 | |
| 720 | if (expression) { |
| 721 | rs_r = (strlencxx . . $ strlen(751346f8406fd082).(expression->rightcxx . . $ ft_restriction_expression#right.) == 1)?get_f_type_from_charcxx . . $ get_f_type_from_char(f1d64ee6cf94df31).(*(expression->rightcxx . . $ ft_restriction_expression#right.)):FT_NULLcxx . . $ `include/file.h:29:9`!; |
| 722 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): file type restriction '%s' evaluates to %u", (void*) expression, expression->rightcxx . . $ ft_restriction_expression#right., rs_r); |
| 723 | if (rs_r == FT_NULLcxx . . $ `include/file.h:29:9`!) { |
| 724 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid restriction '%s'", expression->right) |
| 725 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 726 | } |
| 727 | if (expression->leftcxx . . $ ft_restriction_expression#left. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 728 | rs = rs_r; |
| 729 | } else { |
| 730 | rs = eval_ft_restriction_expressioncxx . . $ eval_ft_restriction_expression(c83eabb626e42458).(expression->leftcxx . . $ ft_restriction_expression#left., linenumber, filename, linebuf) | rs_r; |
| 731 | } |
| 732 | } else { |
| 733 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): file type restriction is NULL, returning %u", (void*) expression, rs); |
| 734 | } |
| 735 | return rs; |
| 736 | } |
| 737 | |
| 738 | static rx_restriction_tcxx . . $ rx_restriction_t# eval_restriction_expressioncxx . . $ eval_restriction_expression(4a29fed54261f081).(restriction_expressioncxx . . $ restriction_expression# *expression, int linenumber, char *filename, char* linebuf) { |
| 739 | rx_restriction_tcxx . . $ rx_restriction_t# rs = { .f_type = FT_NULLcxx . . $ `include/file.h:29:9`!, |
| 740 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 741 | .fs_type = 0 |
| 742 | #endif |
| 743 | }; |
| 744 | |
| 745 | if (expression) { |
| 746 | if ( |
| 747 | expression->fs_typecxx . . $ restriction_expression#fs_type. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && |
| 748 | expression->f_typescxx . . $ restriction_expression#f_types. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 749 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): restriction is '0', returning {" |
| 750 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 751 | "fs_type 0x%lx, " |
| 752 | #endif |
| 753 | "file type: %u)", (void*) expression, |
| 754 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 755 | rs.fs_typecxx . . $ rx_restriction_t#fs_type., |
| 756 | #endif |
| 757 | rs.f_typecxx . . $ rx_restriction_t#f_type.); |
| 758 | } else { |
| 759 | rs.f_typecxx . . $ rx_restriction_t#f_type. = eval_ft_restriction_expressioncxx . . $ eval_ft_restriction_expression(c83eabb626e42458).(expression->f_typescxx . . $ restriction_expression#f_types., linenumber, filename, linebuf); |
| 760 | if (expression->fs_typecxx . . $ restriction_expression#fs_type. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 761 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 762 | rs.fs_typecxx . . $ rx_restriction_t#fs_type. = get_fs_type_from_stringcxx . . $ get_fs_type_from_string(751346f8406fd082).(expression->fs_typecxx . . $ restriction_expression#fs_type.); |
| 763 | if (rs.fs_typecxx . . $ rx_restriction_t#fs_type. == 0) { |
| 764 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid file system restriction '%s'", expression->fs_type) |
| 765 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 766 | } |
| 767 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): file system restriction '%s' evaluates to 0x%lx", (void*) expression, expression->fs_typecxx . . $ restriction_expression#fs_type., rs.fs_typecxx . . $ rx_restriction_t#fs_type.); |
| 768 | #else |
| 769 | LOG_CONFIG_FORMAT_LINE(LOG_LEVEL_ERROR, "%s", "file system type restriction is not supported on non-Linux platforms") |
| 770 | exit(INVALID_CONFIGURELINE_ERROR); |
| 771 | #endif |
| 772 | } |
| 773 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): restriction {" |
| 774 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 775 | "fs_type 0x%lx, " |
| 776 | #endif |
| 777 | "file type: %u)", (void*) expression, |
| 778 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 779 | rs.fs_typecxx . . $ rx_restriction_t#fs_type., |
| 780 | #endif |
| 781 | rs.f_typecxx . . $ rx_restriction_t#f_type.); |
| 782 | } |
| 783 | } else { |
| 784 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): restriction is NULL, returning {" |
| 785 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 786 | "fs_type 0x%lx, " |
| 787 | #endif |
| 788 | "file type: %u)", (void*) expression, |
| 789 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 790 | rs.fs_typecxx . . $ rx_restriction_t#fs_type., |
| 791 | #endif |
| 792 | rs.f_typecxx . . $ rx_restriction_t#f_type.); |
| 793 | } |
| 794 | return rs; |
| 795 | } |
| 796 | |
| 797 | static void eval_rule_statementcxx . . $ eval_rule_statement(d1f048145f51d993).(rule_statementcxx . . $ rule_statement# statement, char* rule_prefix, int linenumber, char *filename, char* linebuf) { |
| 798 | char *rx = eval_string_expressioncxx . . $ eval_string_expression(c5831b9840798e9).(statement.pathcxx . . $ rule_statement#path., linenumber, filename, linebuf); |
| 799 | if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`! && confcxx . . $ conf.->config_check_warn_unrestricted_rulescxx . . $ db_config#config_check_warn_unrestricted_rules. && !statement.restrictioncxx . . $ rule_statement#restriction.) { |
| 800 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_WARNING, "%s '%s' is unrestricted", get_rule_type_long_string(statement.type), rx) |
| 801 | } |
| 802 | if(!add_rx_rule_to_treecxx . . $ add_rx_rule_to_tree(2c61bf0a04a95e55).( |
| 803 | rx, |
| 804 | rule_prefix, |
| 805 | eval_restriction_expressioncxx . . $ eval_restriction_expression(4a29fed54261f081).(statement.restrictioncxx . . $ rule_statement#restriction., linenumber, filename, linebuf), |
| 806 | eval_attribute_expressioncxx . . $ eval_attribute_expression(210695e08291b4).(statement.attributescxx . . $ rule_statement#attributes., linenumber, filename, linebuf), |
| 807 | statement.typecxx . . $ rule_statement#type., |
| 808 | confcxx . . $ conf.->treecxx . . $ db_config#tree., |
| 809 | linenumber, filename, linebuf)) { |
| 810 | exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!); |
| 811 | } |
| 812 | freecxx . . $ free(5d22bdacc48458e8).(rx); |
| 813 | } |
| 814 | |
| 815 | void eval_configcxx . . $ eval_config(e724537fafad80a4).(astcxx . . $ ast#* config_ast, int include_depth, char *rule_prefix) { |
| 816 | astcxx . . $ ast#* node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 817 | for(node = config_ast; node != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; node = node->nextcxx . . $ ast#next.) { |
| 818 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(eval_log_levelcxx . . $ eval_log_level., "eval(%p): ast node (next: %p)", (void*) node, (void*) node->nextcxx . . $ ast#next.); |
| 819 | switch (node->typecxx . . $ ast#type.) { |
| 820 | case config_option_typecxx . . $ ast#config_option_type.: |
| 821 | eval_config_statementcxx . . $ eval_config_statement(cf67d3806d6bf79c).(node->statementcxx . . $ ast#statement.._configcxx . . $ ast#$anonymous_type_4#_config., node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 822 | break; |
| 823 | case include_statement_typecxx . . $ ast#include_statement_type.: |
| 824 | eval_include_statementcxx . . $ eval_include_statement(6c69af9c561f1a7).(node->statementcxx . . $ ast#statement.._includecxx . . $ ast#$anonymous_type_4#_include., include_depth+1, rule_prefix, node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 825 | break; |
| 826 | case x_include_setenv_statement_typecxx . . $ ast#x_include_setenv_statement_type.: |
| 827 | eval_x_include_setenv_statementcxx . . $ eval_x_include_setenv_statement(e0d74717215b45b0).(node->statementcxx . . $ ast#statement.._x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv., node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 828 | break; |
| 829 | case if_statement_typecxx . . $ ast#if_statement_type.: |
| 830 | eval_if_statementcxx . . $ eval_if_statement(89a98f2b0b0ea133).(node->statementcxx . . $ ast#statement.._ifcxx . . $ ast#$anonymous_type_4#_if., include_depth, rule_prefix, node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 831 | break; |
| 832 | case define_statement_typecxx . . $ ast#define_statement_type.: |
| 833 | eval_define_statementcxx . . $ eval_define_statement(8912bb488f8b9512).(node->statementcxx . . $ ast#statement.._definecxx . . $ ast#$anonymous_type_4#_define., node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 834 | break; |
| 835 | case undefine_statement_typecxx . . $ ast#undefine_statement_type.: |
| 836 | eval_undefine_statementcxx . . $ eval_undefine_statement(f199249bafd9cb20).(node->statementcxx . . $ ast#statement.._undefinecxx . . $ ast#$anonymous_type_4#_undefine., node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 837 | break; |
| 838 | case group_statement_typecxx . . $ ast#group_statement_type.: |
| 839 | eval_group_statementcxx . . $ eval_group_statement(89f2b69b130639ac).(node->statementcxx . . $ ast#statement.._groupcxx . . $ ast#$anonymous_type_4#_group., node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 840 | break; |
| 841 | case rule_statement_typecxx . . $ ast#rule_statement_type.: |
| 842 | eval_rule_statementcxx . . $ eval_rule_statement(d1f048145f51d993).(node->statementcxx . . $ ast#statement.._rulecxx . . $ ast#$anonymous_type_4#_rule., rule_prefix, node->linenumbercxx . . $ ast#linenumber., node->filenamecxx . . $ ast#filename., node->linebufcxx . . $ ast#linebuf.); |
| 843 | break; |
| 844 | } |
| 845 | } |
| 846 | } |