Debian Codegraph @

src/aide.c

raw symbols SCIP
1 /*
2 * AIDE (Advanced Intrusion Detection Environment)
3 *
4 * Copyright (C) 1999-2006, 2010-2013, 2015-2017, 2019-2025 Rami Lehti,
5 * Pablo Virolainen, Mike Markley, Richard van den Berg,
6 * Hannes von Haugwitz
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #include "config.h"cxx . . $ `<file>/include/config.h`/
24
25 #include <sys/stat.h>
26 #include <sys/ioctl.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <errno.h>
30 #include <signal.h>
31 #include <dirent.h>
32 #include <time.h>
33 #include <stdbool.h>
34 #include <string.h>
35 #define PCRE2_CODE_UNIT_WIDTHcxx . . $ `src/aide.c:35:9`! 8
36 #include <pcre2.h>
37
38 #include <unistd.h>
39
40 #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/
41 #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/
42 #include "file.h"cxx . . $ `<file>/include/file.h`/
43 #include "url.h"cxx . . $ `<file>/include/url.h`/
44 #include "commandconf.h"cxx . . $ `<file>/include/commandconf.h`/
45 #include "report.h"cxx . . $ `<file>/include/report.h`/
46 #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/
47 #include "db_disk.h"cxx . . $ `<file>/include/db_disk.h`/
48 #include "db.h"cxx . . $ `<file>/include/db.h`/
49 #include "log.h"cxx . . $ `<file>/include/log.h`/
50 #include "progress.h"cxx . . $ `<file>/include/progress.h`/
51 #include "seltree.h"cxx . . $ `<file>/include/seltree.h`/
52 #include "errorcodes.h"cxx . . $ `<file>/include/errorcodes.h`/
53 #include "gen_list.h"cxx . . $ `<file>/include/gen_list.h`/
54 #include "getopt.h"
55 #include "util.h"cxx . . $ `<file>/include/util.h`/
56 /*for locale support*/
57 #include "locale-aide.h"cxx . . $ `<file>/include/locale-aide.h`/
58 /*for locale support*/
59 db_configcxx . . $ db_config#* confcxx . . $ conf.;
60 char* beforecxx . . $ before. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
61 char* aftercxx . . $ after. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
62
63 #ifndef MAXHOSTNAMELEN
64 #define MAXHOSTNAMELENcxx . . $ `src/aide.c:64:9`! 256
65 #endif
66
67 static void usagecxx . . $ usage(d4f767463ce0a6b3).(int exitvalue)
68 {
69 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!,
70 _cxx . . $ `include/locale-aide.h:33:9`!("AIDE %s \n\n"
71 "Usage: aide [options] command\n\n"
72 "Commands:\n"
73 " -i, --init\t\tInitialize the database\n"
74 " -n, --dry-init\tTraverse the file system and match each file against rule tree\n"
75 " -C, --check\t\tCheck the database\n"
76 " -u, --update\t\tCheck and update the database non-interactively\n"
77 " -E, --compare\t\tCompare two databases\n"
78 " --list\t\tList the entries of the database in human readable format\n"
79 "\nMiscellaneous:\n"
80 " -D,\t\t\t--config-check\t\t\tTest the configuration file\n"
81 " -p FILE_TYPE:PATH\t--path-check=FILE_TYPE:PATH\tMatch file type and path against rule tree\n"
82 " -v,\t\t\t--version\t\t\tShow version of AIDE and compilation options\n"
83 " -h,\t\t\t--help\t\t\t\tShow this help message\n\n"
84 "Options:\n"
85 " -c CFGFILE\t--config=CFGFILE\tGet config options from CFGFILE\n"
86 " -l REGEX\t--limit=REGEX\t\tLimit command to entries matching REGEX\n"
87 " -B \"OPTION\"\t--before=\"OPTION\"\tBefore configuration file is read define OPTION\n"
88 " -A \"OPTION\"\t--after=\"OPTION\"\tAfter configuration file is read define OPTION\n"
89 " -L LEVEL\t--log-level=LEVEL\tSet log message level to LEVEL\n"
90 " -W WORKERS\t--workers=WORKERS\tNumber of simultaneous workers (threads) for file attribute processing (i.a. hashsum calculation)\n"
91 " \t\t--no-progress\t\tTurn progress off explicitly\n"
92 " \t\t--no-color\t\tTUrn color off explicitly\n"
93 ), confcxx . . $ conf.->aide_versioncxx . . $ db_config#aide_version.
94 );
95
96 exitcxx . . $ exit(3ca292c338df9bb3).(exitvalue);
97 }
98
99 static void sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).(int);
100
101 static void init_db_sighandlercxx . . $ init_db_sighandler(49f6e7a06ebc5aa8).(void)
102 {
103 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "initialize signal handler for SIGINT");
104 signalcxx . . $ signal(c2d516773f91faf8).(SIGINTcxx . . $ `<external>/11773118241360591791/signum-generic.h:48:9`!,sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).);
105 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "initialize signal handler for SIGTERM");
106 signalcxx . . $ signal(c2d516773f91faf8).(SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`!,sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).);
107 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "initialize signal handler for SIGHUP");
108 signalcxx . . $ signal(c2d516773f91faf8).(SIGHUPcxx . . $ `<external>/11773118241360591791/signum-generic.h:56:9`!,sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).);
109 }
110
111 static void sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).(int signum)
112 {
113 struct winsizecxx . . $ winsize# winsize;
114 char *str;
115 switch(signum){
116 case SIGINTcxx . . $ `<external>/11773118241360591791/signum-generic.h:48:9`! :
117 case SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`! :
118 case SIGHUPcxx . . $ `<external>/11773118241360591791/signum-generic.h:56:9`! :
119 str = "\naide: received SIGINT, SIGTERM or SIGHUP. cleaning up...\n";
120 (void) !writecxx . . $ write(41184a59d38b4f65).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`! ,str, strlencxx . . $ strlen(751346f8406fd082).(str));
121 if (confcxx . . $ conf. && (confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..fpcxx . . $ database#fp. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!
122 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
123 || confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..gzpcxx . . $ database#gzp. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!
124 #endif
125 )) {
126 if (confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.->typecxx . . $ url_t#type. == url_filecxx . . $ url_file. && confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..flagscxx . . $ database#flags.&DB_FLAG_CREATEDcxx . . $ DB_FLAG_CREATED.) {
127 str = "remove database_out: file:";
128 (void) !writecxx . . $ write(41184a59d38b4f65).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!, str, strlencxx . . $ strlen(751346f8406fd082).(str));
129 (void) !writecxx . . $ write(41184a59d38b4f65).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!, confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.->valuecxx . . $ url_t#value., strlencxx . . $ strlen(751346f8406fd082).(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.->valuecxx . . $ url_t#value.));
130 str = "\n";
131 (void) !writecxx . . $ write(41184a59d38b4f65).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`! ,str, strlencxx . . $ strlen(751346f8406fd082).(str));
132 unlinkcxx . . $ unlink(5c4306d8553b3696).(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.->valuecxx . . $ url_t#value.);
133 }
134 }
135 _exitcxx . . $ _exit(3ca292c338df9bb3).(SIGNAL_INTERRUPT_ERRORcxx . . $ `include/errorcodes.h:37:9`!);
136 break;
137 case SIGUSR1cxx . . $ `<external>/1457673850468744829/signum-arch.h:49:9`! :
138 str = "\naide: received SIGUSR1, toggle debug level\n";
139 (void) !writecxx . . $ write(41184a59d38b4f65).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`! ,str, strlencxx . . $ strlen(751346f8406fd082).(str));
140 toogle_log_levelcxx . . $ toogle_log_level(e02209862df775c8).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG.);
141 break;
142 case SIGWINCHcxx . . $ `<external>/1457673850468744829/signum-arch.h:54:9`! :
143 if(ioctlcxx . . $ ioctl(67fa1c773b05068c).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!, TIOCGWINSZcxx . . $ `<external>/123502480044527469/ioctls.h:38:9`!, &winsize) == -1) {
144 confcxx . . $ conf.->progresscxx . . $ db_config#progress. = 80;
145 } else {
146 confcxx . . $ conf.->progresscxx . . $ db_config#progress. = winsize.ws_colcxx . . $ winsize#ws_col.;
147 }
148 break;
149 }
150 }
151
152 #define EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attribute) fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "%s: %s\n", attributes[attribute].config_name, extra_attributes&ATTRcxx . . $ `include/attributes.h:28:9`!(attribute)?"yes":"no");
153
154 static void print_versioncxx . . $ print_version(49f6e7a06ebc5aa8).(void)
155 {
156 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "AIDE %s\n\n", confcxx . . $ conf.->aide_versioncxx . . $ db_config#aide_version. );
157 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "Compile-time options:\n%s\n", AIDECOMPILEOPTIONScxx . . $ `include/config.h:8:9`!);
158 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "Default config values:\n");
159 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "config file: %s\n", confcxx . . $ conf.->config_filecxx . . $ db_config#config_file.?confcxx . . $ conf.->config_filecxx . . $ db_config#config_file.:"<none>");
160 #ifdef DEFAULT_DBcxx . . $ `include/config.h:32:9`!
161 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "database_in: %s\n", DEFAULT_DBcxx . . $ `include/config.h:32:9`!);
162 #else
163 fprintf(stdout, "database_in: <none>\n");
164 #endif
165 #ifdef DEFAULT_DB_OUTcxx . . $ `include/config.h:35:9`!
166 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "database_out: %s\n", DEFAULT_DB_OUTcxx . . $ `include/config.h:35:9`!),
167 #else
168 fprintf(stdout, "database_out: <none>\n"),
169 #endif
170
171 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\nAvailable compiled-in attributes:\n");
172 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! extra_attributes = get_groupvalcxx . . $ get_groupval(38032e09955527d5).("X");
173 EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attr_acl)
174 EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attr_xattrs)
175 EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attr_selinux)
176 EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attr_e2fsattrs)
177 EXTRA_ATTRcxx . . $ `src/aide.c:152:9`!(attr_capabilities)
178
179 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\nAvailable hashsum attributes:\n");
180 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! available_hashsums = get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
181 for (int i = 0; i < num_hashescxx . . $ num_hashes.; ++i) {
182 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "%s: %s\n", attributescxx . . $ attributes.[hashsumscxx . . $ hashsums.[i].attributecxx . . $ $anonymous_type_76c4ad3622101c33_0#attribute.].config_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#config_name., ATTRcxx . . $ `include/attributes.h:28:9`!(hashsums[i].attribute)&available_hashsums?"yes":"no");
183 }
184
185 #ifdef HAVE_FSTYPEcxx . . $ `include/config.h:53:9`!
186 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\nAvailable file system type names:\n");
187 for (int i = 0 ; i < num_filesystemscxx . . $ num_filesystems.; ++i) {
188 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "%-20s%s", filesystemscxx . . $ filesystems.[i].strcxx . . $ $anonymous_type_865fa0d4a79f80f3_0#str., i%4 == 3 || i+1 == num_filesystemscxx . . $ num_filesystems.?"\n":"");
189 }
190 #endif
191
192 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\nDefault compound groups:\n");
193 char* predefined_groups[] = { "R", "L", ">", "H", "X" };
194 for (unsigned long i = 0 ; i < sizeof(predefined_groups)/sizeof(char*); ++i) {
195 char* str;
196 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "%s: %s\n", predefined_groups[i], str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, get_groupvalcxx . . $ get_groupval(38032e09955527d5).(predefined_groups[i])));
197 freecxx . . $ free(5d22bdacc48458e8).(str);
198 }
199
200 exitcxx . . $ exit(3ca292c338df9bb3).(0);
201 }
202
203 static char *append_line_to_configcxx . . $ append_line_to_config(5bd1a890f71b1efd).(char *config, char *line) {
204 size_t line_length = strlencxx . . $ strlen(751346f8406fd082).(line);
205 if (config == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
206 int len = (line_length + 2)*sizeof(char);
207 config = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len);
208 snprintfcxx . . $ snprintf(ea502d73e74c754c).(config, len, "%s\n", line);
209 } else {
210 int len = (strlencxx . . $ strlen(751346f8406fd082).(config) + line_length + 2) * sizeof(char);
211 char *tmp = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len);
212 snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmp, len, "%s%s\n", config, line);
213 freecxx . . $ free(5d22bdacc48458e8).(config);
214 config=tmp;
215 }
216 return config;
217 }
218
219 #define INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!(option, format, ...) \
220 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: (%s): " #format "\n", argv[0], option, __VA_ARGS__); \
221 exit(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
222
223 #define ACTION_CASEcxx . . $ `src/aide.c:223:9`!(longopt, option, _action, desc) \
224 case option: { \
225 if(conf->action==0){ \
226 conf->action=_action; \
227 log_msg(LOG_LEVEL_INFO,"(%s): %s command", longopt, desc); \
228 } else { \
229 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!(longopt, %s, "cannot have multiple commands on a single commandline") \
230 } \
231 break; \
232 }
233
234 static void read_paramcxx . . $ read_param(c759356ac01a31e7).(int argc,char**argv)
235 {
236 int i=0;
237
238 enum cmdline_argscxx . . $ read_param(c759356ac01a31e7).cmdline_args# {
239 ARG_NO_PROGRESScxx . . $ read_param(c759356ac01a31e7).ARG_NO_PROGRESS. = 1,
240 ARG_LISTcxx . . $ read_param(c759356ac01a31e7).ARG_LIST. = 2,
241 ARG_NO_COLORcxx . . $ read_param(c759356ac01a31e7).ARG_NO_COLOR. = 3,
242 };
243
244 static struct optioncxx . . $ option# options[] =
245 {
246 { "help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'h' },
247 { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'v'},
248 { "config", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'c'},
249 { "before", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'B'},
250 { "after", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'A'},
251 { "init", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'i'},
252 { "dry-init", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'n'},
253 { "check", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'C'},
254 { "update", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'u'},
255 { "config-check", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'D'},
256 { "path-check", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'p'},
257 { "limit", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'l'},
258 { "log-level", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'L'},
259 { "workers", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'W'},
260 { "no-progress", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ARG_NO_PROGRESScxx . . $ read_param(c759356ac01a31e7).ARG_NO_PROGRESS.},
261 { "no-color", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ARG_NO_COLORcxx . . $ read_param(c759356ac01a31e7).ARG_NO_COLOR.},
262 { "compare", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 'E'},
263 { "list", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ARG_LISTcxx . . $ read_param(c759356ac01a31e7).ARG_LIST.},
264 { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,0,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,0 }
265 };
266
267 while(1){
268 int option = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "hL:V::vc:l:p:B:A:W:riCuDEn", options, &i);
269 if(option==-1)
270 break;
271 switch(option)
272 {
273 case 'h':{
274 usagecxx . . $ usage(d4f767463ce0a6b3).(0);
275 break;
276 }
277 case 'v':{
278 print_versioncxx . . $ print_version(49f6e7a06ebc5aa8).();
279 break;
280 }
281 case 'c':{
282 confcxx . . $ conf.->config_filecxx . . $ db_config#config_file.=optargcxx . . $ optarg.;
283 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,_cxx . . $ `include/locale-aide.h:33:9`!("(--config): set config file to '%s'"), confcxx . . $ conf.->config_filecxx . . $ db_config#config_file.);
284 break;
285 }
286 case 'B': {
287 beforecxx . . $ before. = append_line_to_configcxx . . $ append_line_to_config(5bd1a890f71b1efd).(beforecxx . . $ before., optargcxx . . $ optarg.);
288 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,_cxx . . $ `include/locale-aide.h:33:9`!("(--before): append '%s' to before config"), optargcxx . . $ optarg.);
289 break;
290 }
291 case 'A': {
292 aftercxx . . $ after. = append_line_to_configcxx . . $ append_line_to_config(5bd1a890f71b1efd).(aftercxx . . $ after., optargcxx . . $ optarg.);
293 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,_cxx . . $ `include/locale-aide.h:33:9`!("(--after): append '%s' to after config"), optargcxx . . $ optarg.);
294 break;
295 }
296 case 'l': {
297 int pcre2_errorcode;
298 PCRE2_SIZEcxx . . $ `<external>/9988290459910441303/pcre2.h:528:9`! pcre2_erroffset;
299 int len = (strlencxx . . $ strlen(751346f8406fd082).(optargcxx . . $ optarg.)+1) * sizeof(char);
300 confcxx . . $ conf.->limitcxx . . $ db_config#limit.=checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len);
301 strncpycxx . . $ strncpy(255158a415b673b0).(confcxx . . $ conf.->limitcxx . . $ db_config#limit., optargcxx . . $ optarg., len);
302 if((confcxx . . $ conf.->limit_crxcxx . . $ db_config#limit_crx.=pcre2_compilecxx . . $ `<external>/9988290459910441303/pcre2.h:910:9`!((PCRE2_SPTRcxx . . $ `<external>/9988290459910441303/pcre2.h:877:9`!) confcxx . . $ conf.->limitcxx . . $ db_config#limit., PCRE2_ZERO_TERMINATEDcxx . . $ `<external>/9988290459910441303/pcre2.h:530:9`!, PCRE2_UTFcxx . . $ `<external>/9988290459910441303/pcre2.h:138:9`!|PCRE2_ANCHOREDcxx . . $ `<external>/9988290459910441303/pcre2.h:105: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`!) {
303 PCRE2_UCHARcxx . . $ `<external>/9988290459910441303/pcre2.h:876:9`! pcre2_error[128];
304 pcre2_get_error_messagecxx . . $ `<external>/9988290459910441303/pcre2.h:923:9`!(pcre2_errorcode, pcre2_error, 128);
305 char * limit_safe = stresccxx . . $ stresc(a8b8e32347182212).(confcxx . . $ conf.->limitcxx . . $ db_config#limit.);
306 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--limit", error in regular expression '%s' at %zu: %s, limit_safe, pcre2_erroffset, pcre2_error)
307
308 }
309 confcxx . . $ conf.->limit_mdcxx . . $ db_config#limit_md. = pcre2_match_data_create_from_patterncxx . . $ `<external>/9988290459910441303/pcre2.h:943:9`!(confcxx . . $ conf.->limit_crxcxx . . $ db_config#limit_crx., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
310 if (confcxx . . $ conf.->limit_mdcxx . . $ db_config#limit_md. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
311 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: (%s) pcre2_match_data_create_from_pattern: failed to allocate memory\n", argv[0], "--limit");
312 exitcxx . . $ exit(3ca292c338df9bb3).(MEMORY_ALLOCATION_FAILUREcxx . . $ `include/errorcodes.h:33:9`!);
313 }
314
315 int pcre2_jit = pcre2_jit_compilecxx . . $ `<external>/9988290459910441303/pcre2.h:930:9`!(confcxx . . $ conf.->limit_crxcxx . . $ db_config#limit_crx., PCRE2_JIT_PARTIAL_SOFTcxx . . $ `<external>/9988290459910441303/pcre2.h:171:9`!);
316 if (pcre2_jit < 0) {
317 PCRE2_UCHARcxx . . $ `<external>/9988290459910441303/pcre2.h:876:9`! pcre2_error[128];
318 pcre2_get_error_messagecxx . . $ `<external>/9988290459910441303/pcre2.h:923:9`!(pcre2_jit, pcre2_error, 128);
319 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "JIT compilation for limit '%s' failed: %s (fall back to interpreted matching)", confcxx . . $ conf.->limitcxx . . $ db_config#limit., pcre2_error);
320 } else {
321 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "JIT compilation for limit '%s' successful", confcxx . . $ conf.->limitcxx . . $ db_config#limit.);
322 }
323
324 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,_cxx . . $ `include/locale-aide.h:33:9`!("(--limit): set limit to '%s'"), confcxx . . $ conf.->limitcxx . . $ db_config#limit.);
325 break;
326 }
327 case 'L':{
328 LOG_LEVELcxx . . $ LOG_LEVEL# level = get_log_level_from_stringcxx . . $ get_log_level_from_string(1c46f449ef604568).(optargcxx . . $ optarg.);
329 if (level == LOG_LEVEL_UNSETcxx . . $ LOG_LEVEL_UNSET.) {
330 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--log-level", invalid log level '%s' (see man aide.conf for details), optarg)
331 } else {
332 set_log_levelcxx . . $ set_log_level(acc15b7e06406d4e).(level);
333 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--log-level): set log level to '%s'", optargcxx . . $ optarg.);
334 }
335 break;
336 }
337 case 'W':{
338 long num_workers = do_num_workerscxx . . $ do_num_workers(3c95bd14d5d5d286).(optargcxx . . $ optarg.);
339 if (num_workers < 0) {
340 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--workers", invalid number of workers '%s', optarg)
341 }
342 confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. = num_workers;
343 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--workers): set number of workers to %ld (argument value: '%s')", confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers., optargcxx . . $ optarg.);
344 break;
345 }
346 case ARG_NO_PROGRESScxx . . $ read_param(c759356ac01a31e7).ARG_NO_PROGRESS.:{
347 confcxx . . $ conf.->progresscxx . . $ db_config#progress. = -1;
348 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--no-progress): disable progress bar");
349 break;
350 }
351 case ARG_NO_COLORcxx . . $ read_param(c759356ac01a31e7).ARG_NO_COLOR.:{
352 confcxx . . $ conf.->no_colorcxx . . $ db_config#no_color. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
353 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--no-color): disable colored log output");
354 break;
355 }
356 case 'p':{
357 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.==0){
358 confcxx . . $ conf.->actioncxx . . $ db_config#action.=DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!;
359 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--path-check): path check command");
360 if (optargcxx . . $ optarg. && *optargcxx . . $ optarg.) {
361 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..typecxx . . $ file_t#type. = get_f_type_from_charcxx . . $ get_f_type_from_char(f1d64ee6cf94df31).(*optargcxx . . $ optarg.);
362 if (confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..typecxx . . $ file_t#type. == FT_NULLcxx . . $ `include/file.h:29:9`!) {
363 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", invalid file type '%c' (see man aide for details), *optarg)
364 } else {
365 char * tmp = optargcxx . . $ optarg.+1;
366 #ifdef HAVE_FSTYPEcxx . . $ `include/config.h:53:9`!
367 if (optargcxx . . $ optarg.[1] == '=') {
368 char* colon = strchrcxx . . $ `<external>/13506128340496143423/string.h:264:11`!(optarg+2, ':');
369 if (colon) {
370 char* fs_type_str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
371 fs_type_str = checked_strndupcxx . . $ checked_strndup(4fa1592a5e6de496).(optargcxx . . $ optarg.+2, colon-(optargcxx . . $ optarg.+2));
372 if (*fs_type_str) {
373 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..fs_typecxx . . $ file_t#fs_type. = get_fs_type_from_stringcxx . . $ get_fs_type_from_string(751346f8406fd082).(fs_type_str);
374 if (confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..fs_typecxx . . $ file_t#fs_type. == 0) {
375 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", invalid file system type '%s' (see man aide for details), fs_type_str)
376 }
377 freecxx . . $ free(5d22bdacc48458e8).(fs_type_str);
378 tmp = colon;
379 } else {
380 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "missing file system type (see man aide for details)")
381 }
382 } else {
383 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "missing ':' (see man aide for details)")
384 }
385 }
386 #endif
387 if (*tmp == ':') {
388 char* path = tmp+1;
389 if (*path) {
390 if (*path == '/') {
391 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..namecxx . . $ file_t#name. = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(path);
392 #ifdef HAVE_FSTYPEcxx . . $ `include/config.h:53:9`!
393 char* fs_type_str = get_fs_type_string_from_magiccxx . . $ get_fs_type_string_from_magic(4b58d6ff543a4736).(confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..fs_typecxx . . $ file_t#fs_type.);
394 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO.,"(--path-check): set path to '%s' (f_type: %c, fs_type: '%s')", path, get_f_type_char_from_f_typecxx . . $ get_f_type_char_from_f_type(1cb8f0426fc6e5a2).(confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..typecxx . . $ file_t#type.), fs_type_str);
395 freecxx . . $ free(5d22bdacc48458e8).(fs_type_str);
396 #else
397 log_msg(LOG_LEVEL_INFO,"(--path-check): set path to '%s' (filetype: %c)", path , get_f_type_char_from_f_type(conf->check_file.type));
398 #endif
399 } else {
400 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", '%s' needs to be an absolute path, path)
401 }
402 } else {
403 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "missing path")
404 }
405 } else {
406 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "missing ':' (see man aide for details)")
407 }
408 }
409 } else {
410 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "missing file type (see man aide for details)")
411 }
412 } else {
413 INVALID_ARGUMENTcxx . . $ `src/aide.c:219:9`!("--path-check", %s, "cannot have multiple commands on a single commandline")
414 }
415 break;
416 }
417 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--init", 'i', DO_INITcxx . . $ `include/db_config.h:48:9`!, "database init")
418 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--dry-init", 'n', DO_INITcxx . . $ `include/db_config.h:48:9`!|DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!, "dry init")
419 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--check", 'C', DO_COMPAREcxx . . $ `include/db_config.h:49:9`!, "database check")
420 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--update", 'u', DO_INITcxx . . $ `include/db_config.h:48:9`!|DO_COMPAREcxx . . $ `include/db_config.h:49:9`!, "database update")
421 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--compare", 'E', DO_DIFFcxx . . $ `include/db_config.h:50:9`!, "database compare")
422 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--config-check", 'D', DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!, "config check")
423 ACTION_CASEcxx . . $ `src/aide.c:223:9`!("--list", ARG_LIST, DO_LISTcxx . . $ `include/db_config.h:52:9`!, "list")
424 default: /* '?' */
425 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
426 }
427 }
428
429 if(optindcxx . . $ optind.<argc){
430 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s: extra parameter: '%s'\n", argv[0], argv[optindcxx . . $ optind.]);
431 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
432 }
433 }
434
435 static void setdefaults_before_configcxx . . $ setdefaults_before_config(49f6e7a06ebc5aa8).(void)
436 {
437 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! X;
438
439 confcxx . . $ conf.=(db_configcxx . . $ db_config#*)checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(db_configcxx . . $ db_config#));
440 confcxx . . $ conf.->defsymscxx . . $ db_config#defsyms.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
441
442 /* Setting some defaults */
443
444 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "initialize rule tree");
445 confcxx . . $ conf.->treecxx . . $ db_config#tree.=init_treecxx . . $ init_tree(b0d239dcd5721ff6).();
446 confcxx . . $ conf.->database_add_metadatacxx . . $ db_config#database_add_metadata.=1;
447 confcxx . . $ conf.->report_detailed_initcxx . . $ db_config#report_detailed_init.=0;
448 confcxx . . $ conf.->report_base16cxx . . $ db_config#report_base16.=0;
449 confcxx . . $ conf.->report_quietcxx . . $ db_config#report_quiet.=0;
450 confcxx . . $ conf.->report_appendcxx . . $ db_config#report_append.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
451 confcxx . . $ conf.->report_ignore_added_attrscxx . . $ db_config#report_ignore_added_attrs. = 0;
452 confcxx . . $ conf.->report_ignore_removed_attrscxx . . $ db_config#report_ignore_removed_attrs. = 0;
453 confcxx . . $ conf.->report_ignore_changed_attrscxx . . $ db_config#report_ignore_changed_attrs. = 0;
454 confcxx . . $ conf.->report_force_attrscxx . . $ db_config#report_force_attrs. = 0;
455 #ifdef WITH_E2FSATTRS
456 conf->report_ignore_e2fsattrs = 0UL;
457 #endif
458
459 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..namecxx . . $ file_t#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
460 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..typecxx . . $ file_t#type. = FT_NULLcxx . . $ `include/file.h:29:9`!;
461 #ifdef HAVE_FSTYPEcxx . . $ `include/config.h:53:9`!
462 confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..fs_typecxx . . $ file_t#fs_type. = 0;
463 #endif
464
465 confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
466 confcxx . . $ conf.->report_levelcxx . . $ db_config#report_level.=default_report_optionscxx . . $ default_report_options..levelcxx . . $ report_options#level.;
467 confcxx . . $ conf.->report_formatcxx . . $ db_config#report_format.=default_report_optionscxx . . $ default_report_options..formatcxx . . $ report_options#format.;
468
469 confcxx . . $ conf.->config_filecxx . . $ db_config#config_file.=
470 #ifdef CONFIG_FILEcxx . . $ `include/config.h:29:9`!
471 CONFIG_FILEcxx . . $ `include/config.h:29:9`!
472 #else
473 NULL
474 #endif
475 ;
476 confcxx . . $ conf.->config_versioncxx . . $ db_config#config_version.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
477 confcxx . . $ conf.->aide_versioncxx . . $ db_config#aide_version. = AIDEVERSIONcxx . . $ `include/config.h:11:9`!;
478 confcxx . . $ conf.->config_check_warn_unrestricted_rulescxx . . $ db_config#config_check_warn_unrestricted_rules. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
479
480 #ifdef WITH_ACL
481 conf->no_acl_on_symlinks=0; /* zero means don't do ACLs on symlinks */
482 #endif
483 confcxx . . $ conf.->db_out_attrscxx . . $ db_config#db_out_attrs. = ATTRcxx . . $ `include/attributes.h:28:9`!(attr_filename)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_attr)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_perm)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_inode);
484
485 confcxx . . $ conf.->symlinks_foundcxx . . $ db_config#symlinks_found.=0;
486
487 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
488 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..filenamecxx . . $ database#filename.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
489 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..linenumbercxx . . $ database#linenumber.=0;
490 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..linebufcxx . . $ database#linebuf.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
491 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..fpcxx . . $ database#fp.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
492 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
493 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..gzpcxx . . $ database#gzp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
494 #endif
495 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..linenocxx . . $ database#lineno. = 0;
496 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..fieldscxx . . $ database#fields. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
497 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..num_fieldscxx . . $ database#num_fields. = 0;
498 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..mdccxx . . $ database#mdc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
499 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..db_linecxx . . $ database#db_line. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
500 confcxx . . $ conf.->database_incxx . . $ db_config#database_in..flagscxx . . $ database#flags. = DB_FLAG_NONEcxx . . $ DB_FLAG_NONE.;
501
502 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
503 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..filenamecxx . . $ database#filename.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
504 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..linenumbercxx . . $ database#linenumber.=0;
505 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..linebufcxx . . $ database#linebuf.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
506 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..fpcxx . . $ database#fp.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
507 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
508 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..gzpcxx . . $ database#gzp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
509 #endif
510 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..linenocxx . . $ database#lineno. = 0;
511 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..fieldscxx . . $ database#fields. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
512 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..num_fieldscxx . . $ database#num_fields. = 0;
513 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..mdccxx . . $ database#mdc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
514 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..db_linecxx . . $ database#db_line. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
515 confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..flagscxx . . $ database#flags. = DB_FLAG_NONEcxx . . $ DB_FLAG_NONE.;
516
517 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..urlcxx . . $ database#url. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
518 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..filenamecxx . . $ database#filename.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
519 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..linenumbercxx . . $ database#linenumber.=0;
520 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..linebufcxx . . $ database#linebuf.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
521 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..fpcxx . . $ database#fp.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
522 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
523 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..gzpcxx . . $ database#gzp. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
524 #endif
525 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..linenocxx . . $ database#lineno. = 0;
526 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..fieldscxx . . $ database#fields. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
527 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..num_fieldscxx . . $ database#num_fields. = 0;
528 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..mdccxx . . $ database#mdc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
529 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..db_linecxx . . $ database#db_line. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
530 confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..flagscxx . . $ database#flags. = DB_FLAG_NONEcxx . . $ DB_FLAG_NONE.;
531
532 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
533 confcxx . . $ conf.->gzip_dboutcxx . . $ db_config#gzip_dbout.=0;
534 #endif
535
536 confcxx . . $ conf.->actioncxx . . $ db_config#action.=0;
537
538 confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. = -1;
539
540 confcxx . . $ conf.->warn_dead_symlinkscxx . . $ db_config#warn_dead_symlinks.=0;
541
542 confcxx . . $ conf.->report_groupedcxx . . $ db_config#report_grouped.=1;
543
544 confcxx . . $ conf.->report_summarize_changescxx . . $ db_config#report_summarize_changes.=1;
545
546 confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
547 confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length.=0;
548
549 confcxx . . $ conf.->limitcxx . . $ db_config#limit.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
550 confcxx . . $ conf.->limit_crxcxx . . $ db_config#limit_crx.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
551
552 confcxx . . $ conf.->groupsymscxx . . $ db_config#groupsyms.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
553
554 confcxx . . $ conf.->start_timecxx . . $ db_config#start_time.=timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
555
556 confcxx . . $ conf.->progresscxx . . $ db_config#progress. = 0;
557 confcxx . . $ conf.->no_colorcxx . . $ db_config#no_color. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
558
559 confcxx . . $ conf.->print_details_widthcxx . . $ db_config#print_details_width. = 80;
560
561 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "define default attribute definitions");
562
563 for (ATTRIBUTEcxx . . $ ATTRIBUTE# i = 0 ; i < num_attrscxx . . $ num_attrs. ; ++i) {
564 if (attributescxx . . $ attributes.[i].config_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#config_name.) {
565 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).(attributescxx . . $ attributes.[i].config_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#config_name., attributescxx . . $ attributes.[i].attrcxx . . $ $anonymous_type_bb8296fff58edf70_1#attr.);
566 }
567 }
568
569 X=0LLU;
570 #ifdef WITH_ACL
571 X|=ATTR(attr_acl);
572 #endif
573 #ifdef WITH_SELINUX
574 X|=ATTR(attr_selinux);
575 #endif
576 #ifdef WITH_XATTR
577 X|=ATTR(attr_xattrs);
578 #endif
579 #ifdef WITH_E2FSATTRS
580 X|=ATTR(attr_e2fsattrs);
581 #endif
582 #ifdef WITH_CAPABILITIES
583 X|=ATTR(attr_capabilities);
584 #endif
585
586 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! common_attrs = ATTRcxx . . $ `include/attributes.h:28:9`!(attr_perm)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ftype)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_inode)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkcount)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_uid)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_gid);
587
588 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! GROUP_R_HASHES=0LLU;
589
590 GROUP_R_HASHES=ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sha3_256);
591
592 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "define default groups definitions");
593 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).("R",common_attrs|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_mtime)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ctime)|GROUP_R_HASHES|X);
594 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).("L",common_attrs|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname)|X);
595 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).(">",common_attrs|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname)|X);
596 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).("H",get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)&~DEPRECATED_HASHEScxx . . $ DEPRECATED_HASHES.);
597 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).("X",X);
598 do_groupdefcxx . . $ do_groupdef(ccc4af74baea44e9).("E",0);
599
600 confcxx . . $ conf.->db_attrscxx . . $ db_config#db_attrs. = get_groupvalcxx . . $ get_groupval(38032e09955527d5).("H");
601
602 }
603
604 static void setdefaults_after_configcxx . . $ setdefaults_after_config(49f6e7a06ebc5aa8).(void)
605 {
606 int linenumber=1;
607
608 #ifdef DEFAULT_DBcxx . . $ `include/config.h:32:9`!
609 if(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
610 do_dbdefcxx . . $ do_dbdef(ea3cba43a1df0463).(DB_TYPE_INcxx . . $ DB_TYPE_IN., DEFAULT_DBcxx . . $ `include/config.h:32:9`!, linenumber++, "(default)", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
611 }
612 #endif
613 #ifdef DEFAULT_DB_OUTcxx . . $ `include/config.h:35:9`!
614 if(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
615 do_dbdefcxx . . $ do_dbdef(ea3cba43a1df0463).(DB_TYPE_OUTcxx . . $ DB_TYPE_OUT., DEFAULT_DB_OUTcxx . . $ `include/config.h:35:9`!, linenumber++, "(default)", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
616 }
617 #endif
618
619 if(confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
620 do_rootprefixcxx . . $ do_rootprefix(b34c553c1300b937).("" , linenumber++, "(default)", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
621 }
622
623 if(confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!){
624 do_repurldefcxx . . $ do_repurldef(b34c553c1300b937).("stdout" , linenumber++, "(default)", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
625 }
626
627 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.==0){
628 confcxx . . $ conf.->actioncxx . . $ db_config#action.=DO_COMPAREcxx . . $ `include/db_config.h:49:9`!;
629 }
630
631 if(confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. < 0) {
632 confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers. = 1;
633 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_CONFIGcxx . . $ LOG_LEVEL_CONFIG., "(default): set 'num_workers' option to %lu", confcxx . . $ conf.->num_workerscxx . . $ db_config#num_workers.);
634 }
635
636 if (is_log_level_unsetcxx . . $ is_log_level_unset(c9857a73d68e59ba).()) {
637 set_log_levelcxx . . $ set_log_level(acc15b7e06406d4e).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING.);
638 };
639 }
640
641 static void list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).(db_linecxx . . $ db_line#* entry, ATTRIBUTEcxx . . $ ATTRIBUTE# attribute) {
642 char **value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
643 int num, i, c;
644 int p = confcxx . . $ conf.->print_details_widthcxx . . $ db_config#print_details_width.-5-MAX_WIDTH_DETAILS_STRINGcxx . . $ `include/attributes.h:89:9`!;
645
646 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr = ATTRcxx . . $ `include/attributes.h:28:9`!(attribute);
647 const char* name = attributescxx . . $ attributes.[attribute].details_stringcxx . . $ $anonymous_type_bb8296fff58edf70_1#details_string.;
648
649 num=get_attribute_valuescxx . . $ get_attribute_values(daa3275b1ddcb9d1).(attr, entry, &value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
650
651 i = 0;
652 while (i<num) {
653 char *ovalue = stresccxx . . $ stresc(a8b8e32347182212).(value[i]);
654 int olen = strlencxx . . $ strlen(751346f8406fd082).(ovalue);
655 int k = 0;
656 while (olen-p*k >= 0) {
657 c = k*(p-1);
658 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!," %-*s%c %.*s\n", MAX_WIDTH_DETAILS_STRINGcxx . . $ `include/attributes.h:89:9`!, (i+k)?"":name, (i+k)?' ':':', p-1, olen-c>0?&ovalue[c]:"");
659 k++;
660 }
661 ++i;
662 freecxx . . $ free(5d22bdacc48458e8).(ovalue);
663 }
664 for(i=0; i < num; ++i) { freecxx . . $ free(5d22bdacc48458e8).(value[i]); value[i]=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; } freecxx . . $ free(5d22bdacc48458e8).(value); value=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
665 }
666
667 int maincxx . . $ main(afcd3168fc1188a4).(int argc,char**argv)
668 {
669 int errorno=0;
670
671 #ifdef WITH_LOCALE
672 setlocale(LC_ALL,"");
673 bindtextdomain(PACKAGE,LOCALEDIR);
674 textdomain(PACKAGE);
675 #endif
676 umaskcxx . . $ umask(2141b656ce2cc063).(0177);
677
678 init_db_sighandlercxx . . $ init_db_sighandler(49f6e7a06ebc5aa8).();
679
680 init_hashsum_libcxx . . $ init_hashsum_lib(49f6e7a06ebc5aa8).();
681
682 setdefaults_before_configcxx . . $ setdefaults_before_config(49f6e7a06ebc5aa8).();
683
684 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "read command line parameters");
685 read_paramcxx . . $ read_param(c759356ac01a31e7).(argc,argv);
686
687 int stderr_isatty = isattycxx . . $ isatty(7864480464b09eea).(STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!);
688 if (stderr_isatty == 0) {
689 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "isatty() failed for 'STDERR_FILENO': %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
690 }
691
692 if (confcxx . . $ conf.->no_colorcxx . . $ db_config#no_color.) {
693 if (stderr_isatty) {
694 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "enable colored log output (stderr refers to a terminal)");
695 } else {
696 confcxx . . $ conf.->no_colorcxx . . $ db_config#no_color. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
697 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "disable colored log output (stderr does not refer to a terminal)");
698 }
699 }
700 set_colored_logcxx . . $ set_colored_log(b45ddcbc8423892c).(confcxx . . $ conf.->no_colorcxx . . $ db_config#no_color.);
701
702 if (!(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!) && !(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_LISTcxx . . $ `include/db_config.h:52:9`!)) {
703 if (confcxx . . $ conf.->progresscxx . . $ db_config#progress. >= 0) {
704 if (stderr_isatty) {
705 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "enable progress bar (stderr refers to a terminal)");
706 if (progress_startcxx . . $ progress_start(c9857a73d68e59ba).()) {
707 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "initialize signal handler for SIGWINCH");
708 signalcxx . . $ signal(c2d516773f91faf8).(SIGWINCHcxx . . $ `<external>/1457673850468744829/signum-arch.h:54:9`!,sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).);
709 }
710 } else {
711 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "disable progress bar (stderr does not refer to a terminal)");
712 }
713 }
714 }
715
716 /* get hostname */
717 confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname. = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(char) * MAXHOSTNAMELENcxx . . $ `src/aide.c:64:9`! + 1);
718 if (gethostnamecxx . . $ gethostname(b6d9217c5e0a83f0).(confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.,MAXHOSTNAMELENcxx . . $ `src/aide.c:64:9`!) == -1) {
719 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING.,"gethostname failed: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
720 freecxx . . $ free(5d22bdacc48458e8).(confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.);
721 confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
722 } else {
723 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "hostname: '%s'", confcxx . . $ conf.->hostnamecxx . . $ db_config#hostname.);
724 }
725
726 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "parse configuration");
727 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_CONFIGcxx . . $ PROGRESS_CONFIG., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
728 errorno=parse_configcxx . . $ parse_config(874486713660bbc7).(beforecxx . . $ before., confcxx . . $ conf.->config_filecxx . . $ db_config#config_file., aftercxx . . $ after.);
729 if (errorno==RETFAILcxx . . $ `include/db_config.h:46:9`!){
730 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!);
731 }
732 freecxx . . $ free(5d22bdacc48458e8). (beforecxx . . $ before.);
733 freecxx . . $ free(5d22bdacc48458e8). (aftercxx . . $ after.);
734
735 setdefaults_after_configcxx . . $ setdefaults_after_config(49f6e7a06ebc5aa8).();
736
737 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., "initialize signal handler for SIGUSR1");
738 signalcxx . . $ signal(c2d516773f91faf8).(SIGUSR1cxx . . $ `<external>/1457673850468744829/signum-arch.h:49:9`!,sig_handlercxx . . $ sig_handler(d4f767463ce0a6b3).);
739
740 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_CONFIGcxx . . $ LOG_LEVEL_CONFIG., "report_urls:");
741 log_report_urlscxx . . $ log_report_urls(acc15b7e06406d4e).(LOG_LEVEL_CONFIGcxx . . $ LOG_LEVEL_CONFIG.);
742
743 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_RULEcxx . . $ LOG_LEVEL_RULE., "rule tree:");
744 log_treecxx . . $ log_tree(9936388f9497775b).(LOG_LEVEL_RULEcxx . . $ LOG_LEVEL_RULE., confcxx . . $ conf.->treecxx . . $ db_config#tree., 0);
745
746 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`! && is_tree_emptycxx . . $ is_tree_empty(58db79c0038671b0).(confcxx . . $ conf.->treecxx . . $ db_config#tree.)) {
747 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING., "rule tree is empty, no files will be added to the database");
748 }
749
750 if (confcxx . . $ conf.->check_filecxx . . $ db_config#check_file..namecxx . . $ file_t#name.) {
751 match_tcxx . . $ match_t# path_match = check_rxtreecxx . . $ check_rxtree(30f8ca777f09528f).(confcxx . . $ conf.->check_filecxx . . $ db_config#check_file., confcxx . . $ conf.->treecxx . . $ db_config#tree., "disk (path-check)", truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
752 print_matchcxx . . $ print_match(409851dd7b7ab465).(confcxx . . $ conf.->check_filecxx . . $ db_config#check_file., path_match);
753 switch (path_match.resultcxx . . $ match_t#result.) {
754 case RESULT_PARTIAL_LIMIT_MATCHcxx . . $ RESULT_PARTIAL_LIMIT_MATCH.:
755 case RESULT_NO_LIMIT_MATCHcxx . . $ RESULT_NO_LIMIT_MATCH.:
756 exitcxx . . $ exit(3ca292c338df9bb3).(2);
757 case RESULT_EQUAL_MATCHcxx . . $ RESULT_EQUAL_MATCH.:
758 case RESULT_SELECTIVE_MATCHcxx . . $ RESULT_SELECTIVE_MATCH.:
759 exitcxx . . $ exit(3ca292c338df9bb3).(0);
760 case RESULT_NON_RECURSIVE_NEGATIVE_MATCHcxx . . $ RESULT_NON_RECURSIVE_NEGATIVE_MATCH.:
761 case RESULT_RECURSIVE_NEGATIVE_MATCHcxx . . $ RESULT_RECURSIVE_NEGATIVE_MATCH.:
762 case RESULT_NEGATIVE_PARENT_MATCHcxx . . $ RESULT_NEGATIVE_PARENT_MATCH.:
763 case RESULT_NO_RULE_MATCHcxx . . $ RESULT_NO_RULE_MATCH.:
764 case RESULT_PARTIAL_MATCHcxx . . $ RESULT_PARTIAL_MATCH.:
765 case RESULT_PART_LIMIT_AND_NO_RECURSE_MATCHcxx . . $ RESULT_PART_LIMIT_AND_NO_RECURSE_MATCH.:
766 exitcxx . . $ exit(3ca292c338df9bb3).(1);
767 }
768 }
769
770 /* Let's do some sanity checks for the config */
771 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_DIFFcxx . . $ `include/db_config.h:50:9`!|DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_LISTcxx . . $ `include/db_config.h:52:9`!) && !(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.)) {
772 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("missing 'database_in', config option is required"));
773 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
774 }
775 if (!(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!) && confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`! && !(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.)) {
776 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("missing 'database_out', config option is required"));
777 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
778 }
779 if(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url. && confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url. && cmpurlcxx . . $ cmpurl(4d6c4d40bb1e144a).(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.,confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.)==RETOKcxx . . $ `include/db_config.h:45:9`!){
780 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_NOTICEcxx . . $ LOG_LEVEL_NOTICE., "input and output database URLs are the same: '%s'", (confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.)->valuecxx . . $ url_t#value.);
781 if((confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!)&&(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!)){
782 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("input and output database urls cannot be the same "
783 "when doing database update"));
784 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
785 }
786 };
787 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DIFFcxx . . $ `include/db_config.h:50:9`!) {
788 if(!(confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..urlcxx . . $ database#url.)||!(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.)) {
789 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("must have both input databases defined for database compare"));
790 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_ARGUMENT_ERRORcxx . . $ `include/errorcodes.h:26:9`!);
791 }
792 if(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url. && confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..urlcxx . . $ database#url. && cmpurlcxx . . $ cmpurl(4d6c4d40bb1e144a).(confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.,confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..urlcxx . . $ database#url.)==RETOKcxx . . $ `include/db_config.h:45:9`!){
793 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING.,_cxx . . $ `include/locale-aide.h:33:9`!("both input databases for database compare are the same"));
794 }
795 }
796
797 /* ensure size attribute is added to db_out_attrs if sizeg or growing attribute is set */
798 if (confcxx . . $ conf.->db_out_attrscxx . . $ db_config#db_out_attrs. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg) || confcxx . . $ conf.->db_out_attrscxx . . $ db_config#db_out_attrs. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing)) {
799 confcxx . . $ conf.->db_out_attrscxx . . $ db_config#db_out_attrs. |=ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size);
800 }
801
802 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`! && confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!) {
803 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "scan file system (dry-run)");
804 db_scan_diskcxx . . $ db_scan_disk(b45ddcbc8423892c).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
805 exitcxx . . $ exit(3ca292c338df9bb3). (0);
806 }
807
808 if ((confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_LISTcxx . . $ `include/db_config.h:52:9`!)) {
809 if(db_initcxx . . $ db_init(d8a340524e05b6c1).(&(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)==RETFAILcxx . . $ `include/db_config.h:46:9`!) {
810 exitcxx . . $ exit(3ca292c338df9bb3).(IO_ERRORcxx . . $ `include/errorcodes.h:29:9`!);
811 }
812 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "list entries from database: %s", (confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.)->rawcxx . . $ url_t#raw.);
813 db_entry_tcxx . . $ db_entry_t# entry;
814 while((entry = db_readlinecxx . . $ db_readline(9768d9fab7f01dc3).(&(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)).linecxx . . $ $anonymous_type_392304a1032d2441_1#line. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
815 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_RULEcxx . . $ LOG_LEVEL_RULE., "\u252c process '%s' (filetype: %c)", (entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->filenamecxx . . $ db_line#filename., get_f_type_char_from_permcxx . . $ get_f_type_char_from_perm(1cb8f0426fc6e5a2).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->permcxx . . $ db_line#perm.));
816 char *entry_safe = stresccxx . . $ stresc(a8b8e32347182212).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->filenamecxx . . $ db_line#filename.);
817 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "%s\n", entry_safe);
818 freecxx . . $ free(5d22bdacc48458e8).(entry_safe);
819 for (int j=0; j < report_attrs_order_lengthcxx . . $ report_attrs_order_length.; ++j) {
820 switch(report_attrs_ordercxx . . $ report_attrs_order.[j]) {
821 case attr_allhashsumscxx . . $ attr_allhashsums.:
822 for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) {
823 if (ATTRcxx . . $ `include/attributes.h:28:9`!(hashsums[i].attribute)&(entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->attrcxx . . $ db_line#attr.) { list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.), hashsumscxx . . $ hashsums.[i].attributecxx . . $ $anonymous_type_76c4ad3622101c33_0#attribute.); }
824 }
825 break;
826 case attr_sizecxx . . $ attr_size.:
827 if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)&(entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->attrcxx . . $ db_line#attr.) { list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.), attr_sizecxx . . $ attr_size.); }
828 if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)&(entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->attrcxx . . $ db_line#attr.) { list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.), attr_sizegcxx . . $ attr_sizeg.); }
829 break;
830 default:
831 if (ATTRcxx . . $ `include/attributes.h:28:9`!(report_attrs_order[j])&(entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->attrcxx . . $ db_line#attr.) { list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.), report_attrs_ordercxx . . $ report_attrs_order.[j]); }
832 break;
833 }
834 }
835 list_attributecxx . . $ list_attribute(2f46a39b4c95eb05).((entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.), attr_attrcxx . . $ attr_attr.);
836 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "\n");
837 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_RULEcxx . . $ LOG_LEVEL_RULE., "\u2534 finish processing '%s'", (entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.)->filenamecxx . . $ db_line#filename.);
838 }
839 db_closecxx . . $ db_close(49f6e7a06ebc5aa8).();
840 exitcxx . . $ exit(3ca292c338df9bb3). (0);
841 }
842
843 if (!(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DRY_RUNcxx . . $ `include/db_config.h:51:9`!)) {
844
845 if (!init_report_urlscxx . . $ init_report_urls(c9857a73d68e59ba).()) {
846 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!);
847 }
848
849 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_INITcxx . . $ `include/db_config.h:48:9`!|DO_COMPAREcxx . . $ `include/db_config.h:49:9`!) && confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length. > 0) {
850 DIRcxx . . $ DIR# *dir;
851 if((dir = opendircxx . . $ opendir(f465d4b65cec8dd2).(confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
852 closedircxx . . $ closedir(ac30a447bc7c2f80).(dir);
853 } else {
854 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,"opendir() for root_prefix %s failed: %s", confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
855 exitcxx . . $ exit(3ca292c338df9bb3).(INVALID_CONFIGURELINE_ERRORcxx . . $ `include/errorcodes.h:28:9`!);
856 }
857 }
858 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!){
859 if(db_initcxx . . $ db_init(d8a340524e05b6c1).(&(confcxx . . $ conf.->database_outcxx . . $ db_config#database_out.), falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
860 #ifdef WITH_ZLIBcxx . . $ `include/config.h:266:9`!
861 confcxx . . $ conf.->gzip_dboutcxx . . $ db_config#gzip_dbout.
862 #else
863 false
864 #endif
865 ) == RETFAILcxx . . $ `include/db_config.h:46:9`!) {
866 exitcxx . . $ exit(3ca292c338df9bb3).(IO_ERRORcxx . . $ `include/errorcodes.h:29:9`!);
867 }
868 if(db_writespeccxx . . $ db_writespec(d87c77e6d45fe0c5).(confcxx . . $ conf.)==RETFAILcxx . . $ `include/db_config.h:46:9`!){
869 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR.,_cxx . . $ `include/locale-aide.h:33:9`!("Error while writing database. Exiting.."));
870 exitcxx . . $ exit(3ca292c338df9bb3).(IO_ERRORcxx . . $ `include/errorcodes.h:29:9`!);
871 }
872 }
873 if((confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!)||(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DIFFcxx . . $ `include/db_config.h:50:9`!)){
874 if(db_initcxx . . $ db_init(d8a340524e05b6c1).(&(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)==RETFAILcxx . . $ `include/db_config.h:46:9`!)
875 exitcxx . . $ exit(3ca292c338df9bb3).(IO_ERRORcxx . . $ `include/errorcodes.h:29:9`!);
876 }
877 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DIFFcxx . . $ `include/db_config.h:50:9`!){
878 if(db_initcxx . . $ db_init(d8a340524e05b6c1).(&(confcxx . . $ conf.->database_newcxx . . $ db_config#database_new.), truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!)==RETFAILcxx . . $ `include/db_config.h:46:9`!)
879 exitcxx . . $ exit(3ca292c338df9bb3).(IO_ERRORcxx . . $ `include/errorcodes.h:29:9`!);
880 }
881
882 populate_treecxx . . $ populate_tree(373bb888e3180625).(confcxx . . $ conf.->treecxx . . $ db_config#tree.);
883
884 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!) {
885 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_WRITEDBcxx . . $ PROGRESS_WRITEDB., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
886 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "write new entries to database: %s", (confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.)->rawcxx . . $ url_t#raw.);
887 write_treecxx . . $ write_tree(373bb888e3180625).(confcxx . . $ conf.->treecxx . . $ db_config#tree.);
888 }
889 progress_stopcxx . . $ progress_stop(49f6e7a06ebc5aa8).();
890
891 db_closecxx . . $ db_close(49f6e7a06ebc5aa8).();
892
893 confcxx . . $ conf.->end_timecxx . . $ db_config#end_time.=timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
894
895 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "generate reports");
896
897 int exitcode = gen_reportcxx . . $ gen_report(b2b9a89df0a93043).(confcxx . . $ conf.->treecxx . . $ db_config#tree.);
898
899 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "exit AIDE with exit code '%d'", exitcode);
900
901 exitcxx . . $ exit(3ca292c338df9bb3).(exitcode);
902 }
903 return RETOKcxx . . $ `include/db_config.h:45:9`!;
904 }
905 // vi: ts=8 sw=8