| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 1999-2006, 2010-2011, 2013, 2015-2016, 2019-2025 Rami Lehti, |
| 5 | * Pablo Virolainen, Richard van den Berg, Hannes von Haugwitz |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of the |
| 10 | * License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | */ |
| 21 | |
| 22 | #include "aide.h"cxx . . $ `<file>/include/aide.h`/ |
| 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <string.h> |
| 26 | #include <unistd.h> |
| 27 | #include <stdbool.h> |
| 28 | #include <zlib.h> |
| 29 | #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/ |
| 30 | #include "conf_ast.h"cxx . . $ `<file>/include/conf_ast.h`/ |
| 31 | #include "config.h"cxx . . $ `<file>/include/config.h`/ |
| 32 | #include "errorcodes.h"cxx . . $ `<file>/include/errorcodes.h`/ |
| 33 | #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/ |
| 34 | #include "list.h"cxx . . $ `<file>/include/list.h`/ |
| 35 | #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/ |
| 36 | #include "url.h"cxx . . $ `<file>/include/url.h`/ |
| 37 | #include "commandconf.h"cxx . . $ `<file>/include/commandconf.h`/ |
| 38 | #include "conf_lex.h"cxx . . $ `<file>/include/conf_lex.h`/ |
| 39 | #include "log.h"cxx . . $ `<file>/include/log.h`/ |
| 40 | #include "conf_yacc.h"cxx . . $ `<file>/src/conf_yacc.h`/ |
| 41 | #include "db.h"cxx . . $ `<file>/include/db.h`/ |
| 42 | #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/ |
| 43 | #include "report.h"cxx . . $ `<file>/include/report.h`/ |
| 44 | #include "symboltable.h"cxx . . $ `<file>/include/symboltable.h`/ |
| 45 | #include "md.h"cxx . . $ `<file>/include/md.h`/ |
| 46 | #include "util.h"cxx . . $ `<file>/include/util.h`/ |
| 47 | #include "conf_eval.h"cxx . . $ `<file>/include/conf_eval.h`/ |
| 48 | #include "seltree.h"cxx . . $ `<file>/include/seltree.h`/ |
| 49 | /*for locale support*/ |
| 50 | #include "locale-aide.h"cxx . . $ `<file>/include/locale-aide.h`/ |
| 51 | /*for locale support*/ |
| 52 | #ifdef WITH_CURL |
| 53 | #include "fopen.h" |
| 54 | #endif |
| 55 | #ifdef WITH_E2FSATTRS |
| 56 | #include "e2fsattrs.h" |
| 57 | #endif |
| 58 | #include <math.h> |
| 59 | #include <errno.h> |
| 60 | #include <unistd.h> |
| 61 | |
| 62 | #define BUFSIZEcxx . . $ `src/commandconf.c:62:9`! 4096 |
| 63 | #define ZBUFSIZEcxx . . $ `src/commandconf.c:63:9`! 16384 |
| 64 | |
| 65 | url_tcxx . . $ url_t#* parse_urlcxx . . $ parse_url(903425acac5a95de).(char* val, int linenumber, char* filename, char* linebuf) |
| 66 | { |
| 67 | url_tcxx . . $ url_t#* u=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 68 | char* r=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 69 | char* val_copy=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 70 | int i=0; |
| 71 | |
| 72 | u=checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(url_tcxx . . $ url_t#)); |
| 73 | |
| 74 | /* We don't want to modify the original hence strdup(val) */ |
| 75 | val_copy=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(val); |
| 76 | for(r=val_copy;r[0]!=':'&&r[0]!='\0';r++); |
| 77 | |
| 78 | if(r[0]!='\0'){ |
| 79 | r[0]='\0'; |
| 80 | r++; |
| 81 | } |
| 82 | |
| 83 | u->typecxx . . $ url_t#type. = get_url_typecxx . . $ get_url_type(f5c03b637e4e739e).(val_copy); |
| 84 | if (u->typecxx . . $ url_t#type.) { |
| 85 | switch (u->typecxx . . $ url_t#type.) { |
| 86 | case url_filecxx . . $ url_file. : { |
| 87 | if(r[0]=='/'&&(r+1)[0]=='/'&&(r+2)[0]=='/'){ |
| 88 | u->valuecxx . . $ url_t#value.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(r+2); |
| 89 | break; |
| 90 | } |
| 91 | if(r[0]=='/'&&(r+1)[0]=='/'&&(r+2)[0]!='/'){ |
| 92 | char* t=r+2; |
| 93 | r+=2; |
| 94 | for(i=0;r[0]!='/'&&r[0]!='\0';r++,i++); |
| 95 | if(r[0]=='\0'){ |
| 96 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid file-URL '%s': no path after hostname", val) |
| 97 | freecxx . . $ free(5d22bdacc48458e8).(val_copy); |
| 98 | freecxx . . $ free(5d22bdacc48458e8).(u); |
| 99 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 100 | } |
| 101 | if( (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(t,"localhost") != 0) && !( confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname. && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(t,confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.)==0)){ |
| 102 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid file-URL '%s': cannot use hostname other than 'localhost' or '%s'", val, conf->hostname); |
| 103 | freecxx . . $ free(5d22bdacc48458e8).(u); |
| 104 | freecxx . . $ free(5d22bdacc48458e8).(val_copy); |
| 105 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 106 | } |
| 107 | u->valuecxx . . $ url_t#value.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(r); |
| 108 | r[0]='\0'; |
| 109 | |
| 110 | break; |
| 111 | } |
| 112 | u->valuecxx . . $ url_t#value.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(r); |
| 113 | break; |
| 114 | } |
| 115 | case url_ftpcxx . . $ url_ftp. : |
| 116 | case url_httpscxx . . $ url_https. : |
| 117 | case url_httpcxx . . $ url_http. : { |
| 118 | #ifdef WITH_CURL |
| 119 | u->value=checked_strdup(val); |
| 120 | #else |
| 121 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "%s", "http, https and ftp URL support not compiled in, recompile AIDE with '--with-curl'") |
| 122 | freecxx . . $ free(5d22bdacc48458e8).(val_copy); |
| 123 | freecxx . . $ free(5d22bdacc48458e8).(u); |
| 124 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 125 | #endif /* WITH CURL */ |
| 126 | break; |
| 127 | } |
| 128 | case url_fdcxx . . $ url_fd.: |
| 129 | case url_stdincxx . . $ url_stdin.: |
| 130 | case url_stdoutcxx . . $ url_stdout.: |
| 131 | case url_stderrcxx . . $ url_stderr.: { |
| 132 | u->valuecxx . . $ url_t#value.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(r); |
| 133 | break; |
| 134 | } |
| 135 | case url_syslogcxx . . $ url_syslog. : { |
| 136 | #ifdef HAVE_SYSLOGcxx . . $ `./include/config.h:110:9`! |
| 137 | u->valuecxx . . $ url_t#value.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(r); |
| 138 | #else |
| 139 | LOG_CONFIG_FORMAT_LINE(LOG_LEVEL_ERROR, "%s", "syslog url support not compiled in, recompile AIDE with syslog support") |
| 140 | free(val_copy); |
| 141 | free(u); |
| 142 | return NULL; |
| 143 | #endif |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | } else { |
| 148 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "unknown URL-type: '%s'", val_copy); |
| 149 | freecxx . . $ free(5d22bdacc48458e8).(val_copy); |
| 150 | freecxx . . $ free(5d22bdacc48458e8).(u); |
| 151 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 152 | } |
| 153 | |
| 154 | freecxx . . $ free(5d22bdacc48458e8).(val_copy); |
| 155 | |
| 156 | u->rawcxx . . $ url_t#raw. = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(val); |
| 157 | |
| 158 | return u; |
| 159 | } |
| 160 | |
| 161 | int parse_configcxx . . $ parse_config(874486713660bbc7).(char *before, char *config, char* after) { |
| 162 | if(before==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && after==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && (config==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!||strcmpcxx . . $ strcmp(5ae29d726ae57f88).(config,"")==0)){ |
| 163 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("missing configuration (use '--config' '--before' or '--after' command line parameter)")); |
| 164 | return RETFAILcxx . . $ `include/db_config.h:46:9`!; |
| 165 | } |
| 166 | |
| 167 | astcxx . . $ ast#* config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 168 | if (before) { |
| 169 | conf_lex_stringcxx . . $ conf_lex_string(2fa786934fe80e24).("(--before)", before); |
| 170 | if(confparsecxx . . $ confparse(2292d3dea3e4c376).(&config_ast)){ |
| 171 | return RETFAILcxx . . $ `include/db_config.h:46:9`!; |
| 172 | } |
| 173 | conf_lex_delete_buffercxx . . $ conf_lex_delete_buffer(49f6e7a06ebc5aa8).(); |
| 174 | eval_configcxx . . $ eval_config(e724537fafad80a4).(config_ast, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 175 | deep_freecxx . . $ deep_free(888ed87a56794581).(config_ast); |
| 176 | config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 177 | } |
| 178 | if (config) { |
| 179 | conf_lex_filecxx . . $ conf_lex_file(85c52e162fed56f9).(config); |
| 180 | if(confparsecxx . . $ confparse(2292d3dea3e4c376).(&config_ast)){ |
| 181 | return RETFAILcxx . . $ `include/db_config.h:46:9`!; |
| 182 | } |
| 183 | conf_lex_delete_buffercxx . . $ conf_lex_delete_buffer(49f6e7a06ebc5aa8).(); |
| 184 | eval_configcxx . . $ eval_config(e724537fafad80a4).(config_ast, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 185 | deep_freecxx . . $ deep_free(888ed87a56794581).(config_ast); |
| 186 | config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 187 | } |
| 188 | if (after) { |
| 189 | conf_lex_stringcxx . . $ conf_lex_string(2fa786934fe80e24).("(--after)", after); |
| 190 | if(confparsecxx . . $ confparse(2292d3dea3e4c376).(&config_ast)){ |
| 191 | return RETFAILcxx . . $ `include/db_config.h:46:9`!; |
| 192 | } |
| 193 | conf_lex_delete_buffercxx . . $ conf_lex_delete_buffer(49f6e7a06ebc5aa8).(); |
| 194 | eval_configcxx . . $ eval_config(e724537fafad80a4).(config_ast, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 195 | deep_freecxx . . $ deep_free(888ed87a56794581).(config_ast); |
| 196 | config_ast = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 197 | } |
| 198 | return RETOKcxx . . $ `include/db_config.h:45:9`!; |
| 199 | } |
| 200 | |
| 201 | int conf_input_wrappercxx . . $ conf_input_wrapper(e41d332e68e0823d).(char* buf, int max_size, FILEcxx . . $ FILE#* in) |
| 202 | { |
| 203 | int retval=0; |
| 204 | retval=freadcxx . . $ fread(738fc8ac1d711e58).(buf,1,max_size,in); |
| 205 | return retval; |
| 206 | } |
| 207 | |
| 208 | void do_definecxx . . $ do_define(2e05f45e14b1fbf7).(char* name, char* value, int linenumber, char* filename, char* linebuf) |
| 209 | { |
| 210 | symbacxx . . $ symba#* s=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 211 | listcxx . . $ list#* l=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 212 | |
| 213 | if(!(l=list_findcxx . . $ list_find(51b945d76bf7eacf).(name,confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.))){ |
| 214 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "define '%s' with value '%s'", name, value) |
| 215 | s=(symbacxx . . $ symba#*)checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(symbacxx . . $ symba#)); |
| 216 | s->namecxx . . $ symba#name.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(name); |
| 217 | s->valuecxx . . $ symba#value.=value; |
| 218 | confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.=list_appendcxx . . $ list_append(6224ec1eaf824d25).(confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.,(void*)s); |
| 219 | } |
| 220 | else { |
| 221 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "redefine '%s' with value '%s' (previous value: '%s')", name, value, ((symba*)l->data)->value) |
| 222 | freecxx . . $ free(5d22bdacc48458e8).(((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.); |
| 223 | ((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 224 | ((symbacxx . . $ symba#*)l->datacxx . . $ list#data.)->valuecxx . . $ symba#value.=value; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | void do_undefinecxx . . $ do_undefine(f4a6a4b786ef4e0b).(char* name, int linenumber, char* filename, char* linebuf) |
| 229 | { |
| 230 | listcxx . . $ list#*r=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 231 | |
| 232 | if((r=list_findcxx . . $ list_find(51b945d76bf7eacf).(name,confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.))){ |
| 233 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "undefine '%s' (value: '%s')", name, ((symba*)r->data)->value) |
| 234 | freecxx . . $ free(5d22bdacc48458e8).(((symbacxx . . $ symba#*)r->datacxx . . $ list#data.)->namecxx . . $ symba#name.); |
| 235 | freecxx . . $ free(5d22bdacc48458e8).(((symbacxx . . $ symba#*)r->datacxx . . $ list#data.)->valuecxx . . $ symba#value.); |
| 236 | freecxx . . $ free(5d22bdacc48458e8).((symbacxx . . $ symba#*)r->datacxx . . $ list#data.); |
| 237 | r->datacxx . . $ list#data.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 238 | confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.=list_delete_itemcxx . . $ list_delete_item(348de0bf91c85cd4).(r); |
| 239 | } else { |
| 240 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "variable '%s' to be undefined not found", name); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! add_rx_rule_to_treecxx . . $ add_rx_rule_to_tree(2c61bf0a04a95e55).(char* rx, char* rule_prefix, rx_restriction_tcxx . . $ rx_restriction_t# restriction, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr, int type, seltreecxx . . $ seltree# *tree, int linenumber, char* filename, char* linebuf) { |
| 245 | |
| 246 | rx_rulecxx . . $ rx_rule#* r=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 247 | |
| 248 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! retval = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 249 | |
| 250 | char *attr_str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 251 | char *rs_str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 252 | |
| 253 | char *regex; |
| 254 | char *node_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 255 | if (rule_prefix) { |
| 256 | int length = strlencxx . . $ strlen(751346f8406fd082).(rule_prefix)+strlencxx . . $ strlen(751346f8406fd082).(rx); |
| 257 | regex = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(length+1); |
| 258 | strncpycxx . . $ strncpy(255158a415b673b0).(regex, rule_prefix, length+1); |
| 259 | strncatcxx . . $ strncat(255158a415b673b0).(regex, rx, length-strlencxx . . $ strlen(751346f8406fd082).(rule_prefix)+1); |
| 260 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "prepend regex '%s' with prefix '%s': '%s'", rx, rule_prefix, regex); |
| 261 | } else { |
| 262 | regex = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(rx); |
| 263 | } |
| 264 | |
| 265 | if ((r = add_rx_to_treecxx . . $ add_rx_to_tree(fa81f7bbcf0f6ec9).(regex, restriction, type, tree, linenumber, filename, linebuf, &node_path)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 266 | retval = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 267 | }else { |
| 268 | r->prefixcxx . . $ rx_rule#prefix. = rule_prefix; |
| 269 | |
| 270 | attr &= validate_hashescxx . . $ validate_hashes(ee42c3dd4b883080).(attr, linenumber, filename, linebuf); |
| 271 | |
| 272 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! unsupported_attrs = attr& |
| 273 | (0 |
| 274 | #ifndef WITH_ACL |
| 275 | |ATTRcxx . . $ `include/attributes.h:28:9`!(attr_acl) |
| 276 | #endif |
| 277 | #ifndef WITH_SELINUX |
| 278 | |ATTRcxx . . $ `include/attributes.h:28:9`!(attr_selinux) |
| 279 | #endif |
| 280 | #ifndef WITH_XATTR |
| 281 | |ATTRcxx . . $ `include/attributes.h:28:9`!(attr_xattrs) |
| 282 | #endif |
| 283 | #ifndef WITH_E2FSATTRS |
| 284 | |ATTRcxx . . $ `include/attributes.h:28:9`!(attr_e2fsattrs) |
| 285 | #endif |
| 286 | #ifndef WITH_CAPABILITIES |
| 287 | |ATTRcxx . . $ `include/attributes.h:28:9`!(attr_capabilities) |
| 288 | #endif |
| 289 | #ifndef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 290 | |ATTR(attr_fs_type) |
| 291 | #endif |
| 292 | ) |
| 293 | ; |
| 294 | if (unsupported_attrs) { |
| 295 | char *str; |
| 296 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_WARNING, "ignoring not compiiled-in attribute(s): %s", str = diff_attributes(0, unsupported_attrs)); |
| 297 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 298 | attr &= ~unsupported_attrs; |
| 299 | } |
| 300 | |
| 301 | r->attrcxx . . $ rx_rule#attr.=attr; |
| 302 | if (attr&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)) { |
| 303 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING., "%s:%d: Using 'S' attribute is DEPRECATED and will be removed in the release after next. Update your config and use 'growing+s' instead (line: '%s')", filename, linenumber, linebuf); |
| 304 | } |
| 305 | if (attr&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_compressed) && !(attr&get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!))) { |
| 306 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING., "%s:%d: ignore 'comprressed' attribute (no hashsum attributes are set) (line: '%s')", filename, linenumber, linebuf); |
| 307 | } |
| 308 | confcxx . . $ conf.->db_out_attrscxx . . $ db_config#db_out_attrs. |= attr; |
| 309 | |
| 310 | LOG_CONFIG_FORMAT_LINE_PREFIXcxx . . $ `include/log.h:66:9`!(LOG_LEVEL_CONFIG, "add %s '%s%s %s %s' to node '%s'", get_rule_type_long_string(type), get_rule_type_char(type), r->rx, rs_str = get_restriction_string(r->restriction), attr_str = diff_attributes(0, r->attr), node_path) |
| 311 | freecxx . . $ free(5d22bdacc48458e8).(rs_str); |
| 312 | freecxx . . $ free(5d22bdacc48458e8).(attr_str); |
| 313 | |
| 314 | retval = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 315 | } |
| 316 | return retval; |
| 317 | } |
| 318 | |
| 319 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).(char* group,DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! value) |
| 320 | { |
| 321 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "define attribute group '%s' with value %llu", group, value); |
| 322 | listcxx . . $ list#* r=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 323 | symbacxx . . $ symba#* s=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 324 | |
| 325 | if((r=list_findcxx . . $ list_find(51b945d76bf7eacf).(group,confcxx . . $ conf.->groupsymscxx . . $ db_config#groupsyms.))){ |
| 326 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! prev_value = ((symbacxx . . $ symba#*)r->datacxx . . $ list#data.)->ivalcxx . . $ symba#ival.; |
| 327 | ((symbacxx . . $ symba#*)r->datacxx . . $ list#data.)->ivalcxx . . $ symba#ival.=value; |
| 328 | return prev_value; |
| 329 | } |
| 330 | /* This is a new group */ |
| 331 | s=checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(symbacxx . . $ symba#)); |
| 332 | s->namecxx . . $ symba#name.=checked_strdupcxx . . $ checked_strdup(42228c1987407501).(group); |
| 333 | s->ivalcxx . . $ symba#ival.=value; |
| 334 | confcxx . . $ conf.->groupsymscxx . . $ db_config#groupsyms.=list_appendcxx . . $ list_append(6224ec1eaf824d25).(confcxx . . $ conf.->groupsymscxx . . $ db_config#groupsyms.,(void*)s); |
| 335 | return 0; |
| 336 | } |
| 337 | |
| 338 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_groupvalcxx . . $ get_groupval(38032e09955527d5).(char* group) |
| 339 | { |
| 340 | listcxx . . $ list#* r=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 341 | |
| 342 | if((r=list_findcxx . . $ list_find(51b945d76bf7eacf).(group,confcxx . . $ conf.->groupsymscxx . . $ db_config#groupsyms.))){ |
| 343 | return (((symbacxx . . $ symba#*)r->datacxx . . $ list#data.)->ivalcxx . . $ symba#ival.); |
| 344 | } |
| 345 | return DB_ATTR_UNDEFcxx . . $ `include/attributes.h:26:9`!; |
| 346 | } |
| 347 | |
| 348 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! do_dbdefcxx . . $ do_dbdef(ea3cba43a1df0463).(DB_TYPEcxx . . $ DB_TYPE# dbtype ,char* val, int linenumber, char* filename, char* linebuf) |
| 349 | { |
| 350 | url_tcxx . . $ url_t#* u=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 351 | databasecxx . . $ database# *db = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 352 | char *db_option_name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 353 | |
| 354 | switch(dbtype) { |
| 355 | case DB_TYPE_INcxx . . $ DB_TYPE_IN.: { |
| 356 | db_option_name = "database_in"; |
| 357 | db = &(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.); |
| 358 | break; |
| 359 | } |
| 360 | case DB_TYPE_OUTcxx . . $ DB_TYPE_OUT.: { |
| 361 | db_option_name = "database_out"; |
| 362 | db = &(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out.); |
| 363 | break; |
| 364 | } |
| 365 | case DB_TYPE_NEWcxx . . $ DB_TYPE_NEW.: { |
| 366 | db_option_name = "database_new"; |
| 367 | db = &(confcxx . . $ conf.->database_newcxx . . $ db_config#database_new.); |
| 368 | break; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | if(db->urlcxx . . $ database#url. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){ |
| 373 | if ((u=parse_urlcxx . . $ parse_url(903425acac5a95de).(val, linenumber, filename, linebuf)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 374 | /* FIXME Check the URL if you add support for databases that cannot be |
| 375 | * both input and output urls */ |
| 376 | switch (dbtype) { |
| 377 | case DB_TYPE_INcxx . . $ DB_TYPE_IN.: |
| 378 | case DB_TYPE_NEWcxx . . $ DB_TYPE_NEW.:{ |
| 379 | switch (u->typecxx . . $ url_t#type.) { |
| 380 | case url_stdoutcxx . . $ url_stdout.: |
| 381 | case url_stderrcxx . . $ url_stderr.: |
| 382 | case url_syslogcxx . . $ url_syslog.: { |
| 383 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': unsupported URL-type: '%s'", db_option_name, get_url_type_string(u->type)) |
| 384 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 385 | } |
| 386 | case url_stdincxx . . $ url_stdin.: |
| 387 | case url_ftpcxx . . $ url_ftp.: |
| 388 | case url_httpcxx . . $ url_http.: |
| 389 | case url_httpscxx . . $ url_https.: |
| 390 | case url_fdcxx . . $ url_fd.: |
| 391 | case url_filecxx . . $ url_file.: |
| 392 | /* url type is supported */ |
| 393 | break; |
| 394 | } |
| 395 | break; |
| 396 | } |
| 397 | case DB_TYPE_OUTcxx . . $ DB_TYPE_OUT.: { |
| 398 | switch (u->typecxx . . $ url_t#type.) { |
| 399 | case url_stdincxx . . $ url_stdin.: |
| 400 | case url_stderrcxx . . $ url_stderr.: |
| 401 | case url_syslogcxx . . $ url_syslog.: { |
| 402 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "'%s': unsupported URL-type: '%s'", db_option_name, get_url_type_string(u->type)) |
| 403 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 404 | } |
| 405 | case url_stdoutcxx . . $ url_stdout.: |
| 406 | case url_ftpcxx . . $ url_ftp.: |
| 407 | case url_httpcxx . . $ url_http.: |
| 408 | case url_httpscxx . . $ url_https.: |
| 409 | case url_fdcxx . . $ url_fd.: |
| 410 | case url_filecxx . . $ url_file.: |
| 411 | /* url type is supported */ |
| 412 | break; |
| 413 | } |
| 414 | break; |
| 415 | } |
| 416 | } |
| 417 | db->urlcxx . . $ database#url. = u; |
| 418 | db->linenumbercxx . . $ database#linenumber. = linenumber; |
| 419 | db->filenamecxx . . $ database#filename. = filename; |
| 420 | db->linebufcxx . . $ database#linebuf. = linebuf?checked_strdupcxx . . $ checked_strdup(42228c1987407501).(linebuf):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 421 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set '%s' option to '%s'", db_option_name, u->raw) |
| 422 | } else { |
| 423 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 424 | } |
| 425 | } else { |
| 426 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "'%s' option already set to '%s' (ignore new value '%s')", db_option_name, (db->url)->raw, val); |
| 427 | } |
| 428 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 429 | } |
| 430 | |
| 431 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! do_repurldefcxx . . $ do_repurldef(b34c553c1300b937).(char* val, int linenumber, char* filename, char* linebuf) { |
| 432 | url_tcxx . . $ url_t#* u = parse_urlcxx . . $ parse_url(903425acac5a95de).(val, linenumber, filename, linebuf); |
| 433 | return add_report_urlcxx . . $ add_report_url(b6d92bad158dd3b).(u, linenumber, filename, linebuf); |
| 434 | } |
| 435 | |
| 436 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! do_reportlevelcxx . . $ do_reportlevel(b34c553c1300b937).(char* val, int linenumber, char* filename, char* linebuf) { |
| 437 | REPORT_LEVELcxx . . $ REPORT_LEVEL# report_level = REPORT_LEVEL_UNKNOWNcxx . . $ REPORT_LEVEL_UNKNOWN.; |
| 438 | |
| 439 | report_level = get_report_levelcxx . . $ get_report_level(5aff053b5fa218f3).(val); |
| 440 | if (report_level) { |
| 441 | confcxx . . $ conf.->report_levelcxx . . $ db_config#report_level. = report_level; |
| 442 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'report_level' option to '%s' (raw: %d)", val, report_level) |
| 443 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 444 | } else { |
| 445 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "invalid report level: '%s'", val); |
| 446 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! do_rootprefixcxx . . $ do_rootprefix(b34c553c1300b937).(char* val, int linenumber, char* filename, char* linebuf) { |
| 451 | if (confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 452 | confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.=val; |
| 453 | confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length.=strlencxx . . $ strlen(751346f8406fd082).(confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.); |
| 454 | if (confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length. && confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.[confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length.-1] == '/') { |
| 455 | confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.[--confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length.] = '\0'; |
| 456 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "removed trailing '/' from root prefix: '%s'", conf->root_prefix); |
| 457 | } |
| 458 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'root_prefix' option to '%s'", conf->root_prefix) |
| 459 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 460 | } else { |
| 461 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_NOTICE, "'root_prefix' option already set to '%s' (ignore new value '%s')", conf->root_prefix, val); |
| 462 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | long do_num_workerscxx . . $ do_num_workers(3c95bd14d5d5d286).(const char *str) { |
| 467 | char *err; |
| 468 | long number = strtolcxx . . $ strtol(44bbb87609b212fc).(str,&err,10); |
| 469 | if (err[0] == '%' && err[1] == '\0') { |
| 470 | if (number >= 0 && number <= 100) { |
| 471 | long num_of_processors = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_ONLNcxx . . $ `<external>/6393649343499073842/confname.h:253:9`!); |
| 472 | return ceill(num_of_processors * number / 100.0); |
| 473 | } else { |
| 474 | return -1; |
| 475 | } |
| 476 | } else if(*err != '\0' || number < 0 || errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == ERANGEcxx . . $ `<external>/8987895939074593727/errno-base.h:38:9`!) { |
| 477 | return -1; |
| 478 | } |
| 479 | return number; |
| 480 | } |
| 481 | |
| 482 | #ifdef WITH_E2FSATTRS |
| 483 | void do_report_ignore_e2fsattrs(char* val, int linenumber, char* filename, char* linebuf) { |
| 484 | conf->report_ignore_e2fsattrs = 0UL; |
| 485 | if (strcmp(val, "0") != 0) { |
| 486 | while (*val) { |
| 487 | unsigned long flag = e2fsattrs_get_flag(*val); |
| 488 | if (flag) { |
| 489 | conf->report_ignore_e2fsattrs |= flag; |
| 490 | } else { |
| 491 | LOG_CONFIG_FORMAT_LINE(LOG_LEVEL_NOTICE, "ignore invalid ext2 file attribute: '%c'", *val) |
| 492 | } |
| 493 | val++; |
| 494 | } |
| 495 | } |
| 496 | } |
| 497 | #endif |