| 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 | #ifndef _CONF_AST_H_INCLUDED |
| 22 | #define _CONF_AST_H_INCLUDEDcxx . . $ `include/conf_ast.h:22:10`! |
| 23 | |
| 24 | #include <stdbool.h> |
| 25 | #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/ |
| 26 | |
| 27 | typedef enum config_optioncxx . . $ config_option# { |
| 28 | ACL_NO_SYMLINK_FOLLOW_OPTIONcxx . . $ ACL_NO_SYMLINK_FOLLOW_OPTION., |
| 29 | DATABASE_ADD_METADATA_OPTIONcxx . . $ DATABASE_ADD_METADATA_OPTION., |
| 30 | DATABASE_ATTRIBUTES_OPTIONcxx . . $ DATABASE_ATTRIBUTES_OPTION., |
| 31 | DATABASE_GZIP_OPTIONcxx . . $ DATABASE_GZIP_OPTION., |
| 32 | DATABASE_IN_OPTIONcxx . . $ DATABASE_IN_OPTION., |
| 33 | DATABASE_OUT_OPTIONcxx . . $ DATABASE_OUT_OPTION., |
| 34 | DATABASE_NEW_OPTIONcxx . . $ DATABASE_NEW_OPTION., |
| 35 | LOG_LEVEL_OPTIONcxx . . $ LOG_LEVEL_OPTION., |
| 36 | REPORT_BASE16_OPTIONcxx . . $ REPORT_BASE16_OPTION., |
| 37 | REPORT_DETAILED_INIT_OPTIONcxx . . $ REPORT_DETAILED_INIT_OPTION., |
| 38 | REPORT_FORCE_ATTRS_OPTIONcxx . . $ REPORT_FORCE_ATTRS_OPTION., |
| 39 | REPORT_GROUPED_OPTIONcxx . . $ REPORT_GROUPED_OPTION., |
| 40 | REPORT_IGNORE_ADDED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_ADDED_ATTRS_OPTION., |
| 41 | REPORT_IGNORE_REMOVED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_REMOVED_ATTRS_OPTION., |
| 42 | REPORT_IGNORE_CHANGED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_CHANGED_ATTRS_OPTION., |
| 43 | REPORT_IGNORE_E2FSATTRS_OPTIONcxx . . $ REPORT_IGNORE_E2FSATTRS_OPTION., |
| 44 | REPORT_LEVEL_OPTIONcxx . . $ REPORT_LEVEL_OPTION., |
| 45 | REPORT_QUIET_OPTIONcxx . . $ REPORT_QUIET_OPTION., |
| 46 | REPORT_APPEND_OPTIONcxx . . $ REPORT_APPEND_OPTION., |
| 47 | REPORT_SUMMARIZE_CHANGES_OPTIONcxx . . $ REPORT_SUMMARIZE_CHANGES_OPTION., |
| 48 | REPORT_URL_OPTIONcxx . . $ REPORT_URL_OPTION., |
| 49 | ROOT_PREFIX_OPTIONcxx . . $ ROOT_PREFIX_OPTION., |
| 50 | WARN_DEAD_SYMLINKS_OPTIONcxx . . $ WARN_DEAD_SYMLINKS_OPTION., |
| 51 | CONFIG_VERSIONcxx . . $ CONFIG_VERSION., |
| 52 | CONFIG_CHECK_WARN_UNRESTRICTED_RULEScxx . . $ CONFIG_CHECK_WARN_UNRESTRICTED_RULES., |
| 53 | REPORT_FORMAT_OPTIONcxx . . $ REPORT_FORMAT_OPTION., |
| 54 | LIMIT_CMDLINE_OPTIONcxx . . $ LIMIT_CMDLINE_OPTION., |
| 55 | NUM_WORKERScxx . . $ NUM_WORKERS., |
| 56 | } config_optioncxx . . $ config_option#; |
| 57 | |
| 58 | typedef structcxx . . $ $anonymous_type_f4816c30b1564b4_0# { |
| 59 | config_optioncxx . . $ config_option# optioncxx . . $ $anonymous_type_f4816c30b1564b4_0#option.; |
| 60 | char *config_namecxx . . $ $anonymous_type_f4816c30b1564b4_0#config_name.; |
| 61 | char *report_stringcxx . . $ $anonymous_type_f4816c30b1564b4_0#report_string.; |
| 62 | } config_option_tcxx . . $ config_option_t#; |
| 63 | |
| 64 | extern config_option_tcxx . . $ config_option_t# config_optionscxx . . $ config_options.[]; |
| 65 | |
| 66 | typedef enum attribute_operatorcxx . . $ attribute_operator# { |
| 67 | ATTR_OP_PLUScxx . . $ ATTR_OP_PLUS. = 0, |
| 68 | ATTR_OP_MINUScxx . . $ ATTR_OP_MINUS., |
| 69 | ATTR_OP_GROUPcxx . . $ ATTR_OP_GROUP., |
| 70 | } attribute_operatorcxx . . $ attribute_operator#; |
| 71 | |
| 72 | typedef struct attribute_expressioncxx . . $ attribute_expression# { |
| 73 | attribute_operatorcxx . . $ attribute_operator# opcxx . . $ attribute_expression#op.; |
| 74 | |
| 75 | struct attribute_expressioncxx . . $ attribute_expression#* leftcxx . . $ attribute_expression#left.; |
| 76 | char* rightcxx . . $ attribute_expression#right.; |
| 77 | } attribute_expressioncxx . . $ attribute_expression#; |
| 78 | |
| 79 | typedef enum string_operatorcxx . . $ string_operator# { |
| 80 | STR_OP_STRcxx . . $ STR_OP_STR., |
| 81 | STR_OP_VARIABLEcxx . . $ STR_OP_VARIABLE., |
| 82 | STR_OP_CONCATcxx . . $ STR_OP_CONCAT., |
| 83 | } string_operatorcxx . . $ string_operator#; |
| 84 | typedef struct string_expressioncxx . . $ string_expression# { |
| 85 | string_operatorcxx . . $ string_operator# opcxx . . $ string_expression#op.; |
| 86 | |
| 87 | char* strcxx . . $ string_expression#str.; |
| 88 | struct string_expressioncxx . . $ string_expression#* leftcxx . . $ string_expression#left.; |
| 89 | struct string_expressioncxx . . $ string_expression#* rightcxx . . $ string_expression#right.; |
| 90 | } string_expressioncxx . . $ string_expression#; |
| 91 | |
| 92 | typedef struct config_option_statementcxx . . $ config_option_statement# { |
| 93 | config_optioncxx . . $ config_option# optioncxx . . $ config_option_statement#option.; |
| 94 | attribute_expressioncxx . . $ attribute_expression# *acxx . . $ config_option_statement#a.; |
| 95 | string_expressioncxx . . $ string_expression#* ecxx . . $ config_option_statement#e.; |
| 96 | } config_option_statementcxx . . $ config_option_statement#; |
| 97 | |
| 98 | typedef enum bool_operatorcxx . . $ bool_operator# { |
| 99 | BOOL_OP_NOTcxx . . $ BOOL_OP_NOT., |
| 100 | BOOL_OP_DEFINEDcxx . . $ BOOL_OP_DEFINED., |
| 101 | BOOL_OP_HOSTNAMEcxx . . $ BOOL_OP_HOSTNAME., |
| 102 | BOOL_OP_EXISTScxx . . $ BOOL_OP_EXISTS., |
| 103 | BOOL_OP_VERSION_GEcxx . . $ BOOL_OP_VERSION_GE., |
| 104 | } bool_operatorcxx . . $ bool_operator#; |
| 105 | |
| 106 | typedef struct bool_expressioncxx . . $ bool_expression# { |
| 107 | bool_operatorcxx . . $ bool_operator# opcxx . . $ bool_expression#op.; |
| 108 | |
| 109 | unioncxx . . $ bool_expression#$anonymous_type_1# { |
| 110 | string_expressioncxx . . $ string_expression#* _strcxx . . $ bool_expression#$anonymous_type_1#_str.; |
| 111 | struct bool_expressioncxx . . $ bool_expression#* _boolcxx . . $ bool_expression#$anonymous_type_1#_bool.; |
| 112 | } leftcxx . . $ bool_expression#left.; |
| 113 | unioncxx . . $ bool_expression#$anonymous_type_2# { |
| 114 | string_expressioncxx . . $ string_expression#* _strcxx . . $ bool_expression#$anonymous_type_2#_str.; |
| 115 | struct bool_expressioncxx . . $ bool_expression#* _boolcxx . . $ bool_expression#$anonymous_type_2#_bool.; |
| 116 | } rightcxx . . $ bool_expression#right.; |
| 117 | |
| 118 | } bool_expressioncxx . . $ bool_expression#; |
| 119 | |
| 120 | typedef struct if_conditioncxx . . $ if_condition# { |
| 121 | bool_expressioncxx . . $ bool_expression#* expressioncxx . . $ if_condition#expression.; |
| 122 | |
| 123 | int linenumbercxx . . $ if_condition#linenumber.; |
| 124 | char *filenamecxx . . $ if_condition#filename.; |
| 125 | char* linebufcxx . . $ if_condition#linebuf.; |
| 126 | } if_conditioncxx . . $ if_condition#; |
| 127 | |
| 128 | typedef struct if_statementcxx . . $ if_statement# { |
| 129 | struct if_conditioncxx . . $ if_condition#* conditioncxx . . $ if_statement#condition.; |
| 130 | |
| 131 | struct astcxx . . $ ast#* if_branchcxx . . $ if_statement#if_branch.; |
| 132 | struct astcxx . . $ ast#* else_branchcxx . . $ if_statement#else_branch.; |
| 133 | } if_statementcxx . . $ if_statement#; |
| 134 | |
| 135 | typedef struct define_statementcxx . . $ define_statement# { |
| 136 | char *namecxx . . $ define_statement#name.; |
| 137 | string_expressioncxx . . $ string_expression# *valuecxx . . $ define_statement#value.; |
| 138 | } define_statementcxx . . $ define_statement#; |
| 139 | |
| 140 | typedef struct include_statementcxx . . $ include_statement# { |
| 141 | string_expressioncxx . . $ string_expression# *pathcxx . . $ include_statement#path.; |
| 142 | string_expressioncxx . . $ string_expression# *rxcxx . . $ include_statement#rx.; |
| 143 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! executecxx . . $ include_statement#execute.; |
| 144 | string_expressioncxx . . $ string_expression# *prefixcxx . . $ include_statement#prefix.; |
| 145 | } include_statementcxx . . $ include_statement#; |
| 146 | |
| 147 | typedef struct x_include_setenv_statementcxx . . $ x_include_setenv_statement# { |
| 148 | char *variablecxx . . $ x_include_setenv_statement#variable.; |
| 149 | string_expressioncxx . . $ string_expression# *valuecxx . . $ x_include_setenv_statement#value.; |
| 150 | } x_include_setenv_statementcxx . . $ x_include_setenv_statement#; |
| 151 | |
| 152 | typedef struct undefine_statementcxx . . $ undefine_statement# { |
| 153 | char *namecxx . . $ undefine_statement#name.; |
| 154 | } undefine_statementcxx . . $ undefine_statement#; |
| 155 | |
| 156 | typedef struct group_statementcxx . . $ group_statement# { |
| 157 | char *namecxx . . $ group_statement#name.; |
| 158 | attribute_expressioncxx . . $ attribute_expression# *exprcxx . . $ group_statement#expr.; |
| 159 | } group_statementcxx . . $ group_statement#; |
| 160 | |
| 161 | typedef struct ft_restriction_expressioncxx . . $ ft_restriction_expression# { |
| 162 | char* rightcxx . . $ ft_restriction_expression#right.; |
| 163 | struct ft_restriction_expressioncxx . . $ ft_restriction_expression#* leftcxx . . $ ft_restriction_expression#left.; |
| 164 | } ft_restriction_expressioncxx . . $ ft_restriction_expression#; |
| 165 | |
| 166 | typedef struct restriction_expressioncxx . . $ restriction_expression# { |
| 167 | struct ft_restriction_expressioncxx . . $ ft_restriction_expression#* f_typescxx . . $ restriction_expression#f_types.; |
| 168 | char* fs_typecxx . . $ restriction_expression#fs_type.; |
| 169 | } restriction_expressioncxx . . $ restriction_expression#; |
| 170 | |
| 171 | typedef struct rule_statementcxx . . $ rule_statement# { |
| 172 | AIDE_RULE_TYPEcxx . . $ AIDE_RULE_TYPE# typecxx . . $ rule_statement#type.; |
| 173 | |
| 174 | string_expressioncxx . . $ string_expression# *pathcxx . . $ rule_statement#path.; |
| 175 | restriction_expressioncxx . . $ restriction_expression# *restrictioncxx . . $ rule_statement#restriction.; |
| 176 | attribute_expressioncxx . . $ attribute_expression# *attributescxx . . $ rule_statement#attributes.; |
| 177 | } rule_statementcxx . . $ rule_statement#; |
| 178 | |
| 179 | typedef struct astcxx . . $ ast# { |
| 180 | enumcxx . . $ ast#$anonymous_type_3# { |
| 181 | config_option_typecxx . . $ ast#config_option_type., |
| 182 | |
| 183 | include_statement_typecxx . . $ ast#include_statement_type., |
| 184 | x_include_setenv_statement_typecxx . . $ ast#x_include_setenv_statement_type., |
| 185 | define_statement_typecxx . . $ ast#define_statement_type., |
| 186 | undefine_statement_typecxx . . $ ast#undefine_statement_type., |
| 187 | |
| 188 | group_statement_typecxx . . $ ast#group_statement_type., |
| 189 | |
| 190 | if_statement_typecxx . . $ ast#if_statement_type., |
| 191 | |
| 192 | rule_statement_typecxx . . $ ast#rule_statement_type., |
| 193 | } typecxx . . $ ast#type.; |
| 194 | |
| 195 | unioncxx . . $ ast#$anonymous_type_4# { |
| 196 | config_option_statementcxx . . $ config_option_statement# _configcxx . . $ ast#$anonymous_type_4#_config.; |
| 197 | include_statementcxx . . $ include_statement# _includecxx . . $ ast#$anonymous_type_4#_include.; |
| 198 | x_include_setenv_statementcxx . . $ x_include_setenv_statement# _x_include_setenvcxx . . $ ast#$anonymous_type_4#_x_include_setenv.; |
| 199 | define_statementcxx . . $ define_statement# _definecxx . . $ ast#$anonymous_type_4#_define.; |
| 200 | undefine_statementcxx . . $ undefine_statement# _undefinecxx . . $ ast#$anonymous_type_4#_undefine.; |
| 201 | group_statementcxx . . $ group_statement# _groupcxx . . $ ast#$anonymous_type_4#_group.; |
| 202 | if_statementcxx . . $ if_statement# _ifcxx . . $ ast#$anonymous_type_4#_if.; |
| 203 | rule_statementcxx . . $ rule_statement# _rulecxx . . $ ast#$anonymous_type_4#_rule.; |
| 204 | } statementcxx . . $ ast#statement.; |
| 205 | |
| 206 | int linenumbercxx . . $ ast#linenumber.; |
| 207 | char *filenamecxx . . $ ast#filename.; |
| 208 | char* linebufcxx . . $ ast#linebuf.; |
| 209 | |
| 210 | struct astcxx . . $ ast#* nextcxx . . $ ast#next.; |
| 211 | } astcxx . . $ ast#; |
| 212 | |
| 213 | string_expressioncxx . . $ string_expression#* new_stringcxx . . $ new_string(1727335c042fc713).(char*); |
| 214 | string_expressioncxx . . $ string_expression#* new_variablecxx . . $ new_variable(1727335c042fc713).(char*); |
| 215 | string_expressioncxx . . $ string_expression#* new_string_concatcxx . . $ new_string_concat(6d600d85e8f010e2).(string_expressioncxx . . $ string_expression#*, string_expressioncxx . . $ string_expression#*); |
| 216 | |
| 217 | astcxx . . $ ast#* new_string_option_statementcxx . . $ new_string_option_statement(f830a405ae9ddcd8).(config_optioncxx . . $ config_option#, string_expressioncxx . . $ string_expression#*); |
| 218 | astcxx . . $ ast#* new_attribute_option_statementcxx . . $ new_attribute_option_statement(fd58fac2666ca7f5).(config_optioncxx . . $ config_option#, attribute_expressioncxx . . $ attribute_expression#*); |
| 219 | |
| 220 | astcxx . . $ ast#* new_define_statementcxx . . $ new_define_statement(a348f5be1c63e6a6).(char*, string_expressioncxx . . $ string_expression#*); |
| 221 | astcxx . . $ ast#* new_undefine_statementcxx . . $ new_undefine_statement(23fbe7ec2b3e63e6).(char*); |
| 222 | |
| 223 | astcxx . . $ ast#* new_group_statementcxx . . $ new_group_statement(a11f56b714a2867d).(char*, attribute_expressioncxx . . $ attribute_expression#*); |
| 224 | |
| 225 | astcxx . . $ ast#* new_include_statementcxx . . $ new_include_statement(ac1ef1c05cb212cc).(string_expressioncxx . . $ string_expression#*, string_expressioncxx . . $ string_expression#*, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!, string_expressioncxx . . $ string_expression#*); |
| 226 | astcxx . . $ ast#* new_x_include_setenv_statementcxx . . $ new_x_include_setenv_statement(a348f5be1c63e6a6).(char*, string_expressioncxx . . $ string_expression#*); |
| 227 | |
| 228 | astcxx . . $ ast#* new_if_statementcxx . . $ new_if_statement(f8d5e3ceb690fe4e).(struct if_conditioncxx . . $ if_condition#*, struct astcxx . . $ ast#*, struct astcxx . . $ ast#*); |
| 229 | |
| 230 | astcxx . . $ ast#* new_rule_statementcxx . . $ new_rule_statement(d3d78b496cdb2f1e).(AIDE_RULE_TYPEcxx . . $ AIDE_RULE_TYPE#, string_expressioncxx . . $ string_expression#*, restriction_expressioncxx . . $ restriction_expression#*, attribute_expressioncxx . . $ attribute_expression#*); |
| 231 | |
| 232 | if_conditioncxx . . $ if_condition#* new_if_conditioncxx . . $ new_if_condition(87088a2d4a0be176).(struct bool_expressioncxx . . $ bool_expression#*); |
| 233 | |
| 234 | bool_expressioncxx . . $ bool_expression#* new_string_bool_expressioncxx . . $ new_string_bool_expression(a52d2e068b39c51e).(bool_operatorcxx . . $ bool_operator#, string_expressioncxx . . $ string_expression#*, string_expressioncxx . . $ string_expression#*); |
| 235 | bool_expressioncxx . . $ bool_expression#* new_bool_expressioncxx . . $ new_bool_expression(fb49e1ae64d676d0).(bool_operatorcxx . . $ bool_operator#, bool_expressioncxx . . $ bool_expression#*, bool_expressioncxx . . $ bool_expression#*); |
| 236 | |
| 237 | attribute_expressioncxx . . $ attribute_expression#* new_attribute_expressioncxx . . $ new_attribute_expression(5d8da53df85c4fbc).(attribute_operatorcxx . . $ attribute_operator#, attribute_expressioncxx . . $ attribute_expression#*, char*); |
| 238 | |
| 239 | ft_restriction_expressioncxx . . $ ft_restriction_expression#* new_ft_restriction_expressioncxx . . $ new_ft_restriction_expression(84fdc8e190b08d90).(ft_restriction_expressioncxx . . $ ft_restriction_expression#*, char*); |
| 240 | restriction_expressioncxx . . $ restriction_expression#* new_restriction_expressioncxx . . $ new_restriction_expression(dba3b61e2aa5a653).(ft_restriction_expressioncxx . . $ ft_restriction_expression#*, char*); |
| 241 | |
| 242 | void deep_freecxx . . $ deep_free(888ed87a56794581).(astcxx . . $ ast#*); |
| 243 | |
| 244 | #endif |