Debian Codegraph @

src/gen_list.c

raw symbols SCIP
1 /*
2 * AIDE (Advanced Intrusion Detection Environment)
3 *
4 * Copyright (C) 1999-2006, 2009-2012, 2015-2016, 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 #include "aide.h"cxx . . $ `<file>/include/aide.h`/
25 #include "file.h"cxx . . $ `<file>/include/file.h`/
26 #include <pthread.h>
27 #include <string.h>
28 #include <stdbool.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <limits.h>
33 #include <sys/stat.h>
34 #include <errno.h>
35 #include <time.h>
36 #define PCRE2_CODE_UNIT_WIDTHcxx . . $ `src/gen_list.c:36:9`! 8
37 #include <pcre2.h>
38
39 #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/
40 #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/
41 #include "seltree_struct.h"cxx . . $ `<file>/include/seltree_struct.h`/
42 #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/
43 #include "url.h"cxx . . $ `<file>/include/url.h`/
44 #include "gen_list.h"cxx . . $ `<file>/include/gen_list.h`/
45 #include "md.h"cxx . . $ `<file>/include/md.h`/
46 #include "db.h"cxx . . $ `<file>/include/db.h`/
47 #include "db_line.h"cxx . . $ `<file>/include/db_line.h`/
48 #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/
49 #include "db_disk.h"cxx . . $ `<file>/include/db_disk.h`/
50 #include "do_md.h"cxx . . $ `<file>/include/do_md.h`/
51 #include "log.h"cxx . . $ `<file>/include/log.h`/
52 #include "progress.h"cxx . . $ `<file>/include/progress.h`/
53 #include "util.h"cxx . . $ `<file>/include/util.h`/
54 /*for locale support*/
55 #include "locale-aide.h"cxx . . $ `<file>/include/locale-aide.h`/
56 /*for locale support*/
57
58 void hsymlnkcxx . . $ hsymlnk(5dc4328f64ce0e3d).(db_linecxx . . $ db_line#* line);
59 void fs2db_linecxx . . $ fs2db_line(42bac3c81d5693f6).(struct statcxx . . $ stat#* fs,db_linecxx . . $ db_line#* line);
60
61 LOG_LEVELcxx . . $ LOG_LEVEL# compare_log_levelcxx . . $ compare_log_level. = LOG_LEVEL_COMPAREcxx . . $ LOG_LEVEL_COMPARE.;
62
63 static int bytecmpcxx . . $ bytecmp(717f5a131e501f50).(bytecxx . . $ byte# *b1, bytecxx . . $ byte# *b2, size_t len) {
64 return strncmpcxx . . $ strncmp(fd278af2f295fa2e).((char *)b1, (char *)b2, len);
65 }
66
67 static int has_str_changedcxx . . $ has_str_changed(e99f026884c896d5).(char* old,char* new) {
68 return (((old!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && new!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) &&
69 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(old,new)!=0 ) ||
70 ((old!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && new==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) ||
71 (old==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && new!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)));
72 }
73
74 #ifdef WITH_ACL
75 static int has_acl_changed(const acl_type* old, const acl_type* new) {
76 if (old==NULL && new==NULL) {
77 return RETOK;
78 }
79 if (old==NULL || new==NULL) {
80 return RETFAIL;
81 }
82 #ifdef WITH_POSIX_ACL
83 if ((!old->acl_a != !new->acl_a)
84 || (!old->acl_d != !new->acl_d)
85 || (old->acl_a && strcmp(old->acl_a, new->acl_a))
86 || (old->acl_d && strcmp(old->acl_d, new->acl_d))){
87 return RETFAIL;
88 }
89 #endif
90 return RETOK;
91 }
92 #endif
93
94 #ifdef WITH_XATTR
95 static int cmp_xattr_node(const void *c1, const void *c2)
96 {
97 const xattr_node *x1 = c1;
98 const xattr_node *x2 = c2;
99
100 return (strcmp(x1->key, x2->key));
101 }
102 static int have_xattrs_changed(xattrs_type* x1,xattrs_type* x2) {
103 size_t num = 0;
104
105 if (x1 && (x1->num == 0)) x1 = NULL;
106 if (x2 && (x2->num == 0)) x2 = NULL;
107
108 if (x1==NULL && x2==NULL) {
109 return RETOK;
110 }
111 if (x1==NULL || x2==NULL) {
112 return RETFAIL;
113 }
114
115 if (x1->num != x2->num) {
116 return RETFAIL;
117 }
118
119 qsort(x1->ents, x1->num, sizeof(xattr_node), cmp_xattr_node);
120 qsort(x2->ents, x2->num, sizeof(xattr_node), cmp_xattr_node);
121
122 while (num++ < x1->num) {
123 const char *x1key = NULL;
124 const byte *x1val = NULL;
125 size_t x1vsz = 0;
126 const char *x2key = NULL;
127 const byte *x2val = NULL;
128 size_t x2vsz = 0;
129
130 x1key = x1->ents[num - 1].key;
131 x1val = x1->ents[num - 1].val;
132 x1vsz = x1->ents[num - 1].vsz;
133
134 x2key = x2->ents[num - 1].key;
135 x2val = x2->ents[num - 1].val;
136 x2vsz = x2->ents[num - 1].vsz;
137
138 if (strcmp(x1key, x2key) ||
139 x1vsz != x2vsz ||
140 memcmp(x1val, x2val, x1vsz))
141 return RETFAIL;
142 }
143
144 return RETOK;
145 }
146 #endif
147
148 #ifdef WITH_E2FSATTRS
149 static int has_e2fsattrs_changed(unsigned long old, unsigned long new) {
150 return (old^new);
151 }
152 #endif
153
154 static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_changed_hashsumscxx . . $ get_changed_hashsums(8d0ccb7cb9714935).(bytecxx . . $ byte#** old_hashsums, bytecxx . . $ byte#** new_hashsums, db_linecxx . . $ db_line#* old, db_linecxx . . $ db_line#* new, const char* whoami) {
155 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! changed_hashsums = 0;
156 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! no_hashsums_compared = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
157 for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) {
158 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr = ATTRcxx . . $ `include/attributes.h:28:9`!(hashsums[i].attribute);
159 if (old_hashsums[i] || new_hashsums[i]) {
160 if (old_hashsums[i] && new_hashsums[i]) {
161 no_hashsums_compared = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
162 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! hash_has_changed = (bytecmpcxx . . $ bytecmp(717f5a131e501f50).(old_hashsums[i], new_hashsums[i], hashsumscxx . . $ hashsums.[i].lengthcxx . . $ $anonymous_type_76c4ad3622101c33_0#length.) != 0);
163 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE,"│ %s hashsum %s changed (old: %p, new: %p)", attributes[hashsums[i].attribute].db_name, hash_has_changed?"has":"has NOT", (void*) old_hashsums[i], (void*) new_hashsums[i]);
164 if(hash_has_changed) {
165 changed_hashsums|=attr;
166 }
167 } else {
168 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE,"│ %s hashsum comparison skipped (old: %p, new: %p)", attributes[hashsums[i].attribute].db_name, (void*) old_hashsums[i], (void*) new_hashsums[i]);
169 }
170 }
171 }
172 if (no_hashsums_compared) {
173 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING.,"cannot compare hashsums of old:'%s' and new:'%s' (no common hashsum(s) available)", old->filenamecxx . . $ db_line#filename., new->filenamecxx . . $ db_line#filename.);
174 }
175 return changed_hashsums;
176 }
177
178 /*
179 * Returns the changed attributes for two database lines.
180 *
181 * Attributes are only compared if they exist in both database lines.
182 */
183 static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_changed_attributescxx . . $ get_changed_attributes(632de1aa256cd910).(db_linecxx . . $ db_line#* l1,db_linecxx . . $ db_line#* l2, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ignore_attrs, disk_entrycxx . . $ disk_entry# *entry, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_hashsums, const char* whoami) {
184
185 #define easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(a,b) \
186 if(((a&l1->attr) && (a&l2->attr))) { \
187 if (l1->attr&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing)) { \
188 if (l1->b < l2->b) { \
189 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ ignore growing " #b " change of old:'%s' and new:'%s'", l1->filename, l2->filename); \
190 } else if (l1->b > l2->b) { \
191 ret|=a; \
192 } \
193 } else if (l1->b != l2->b) { \
194 ret|=a; \
195 } \
196 }
197
198 #define easy_comparecxx . . $ `src/gen_list.c:198:9`!(a,b) \
199 if((a&l1->attr && (a&l2->attr)) && l1->b!=l2->b){\
200 ret|=a;\
201 }
202
203 #define easy_function_comparecxx . . $ `src/gen_list.c:203:9`!(a,b,c) \
204 if((a&l1->attr && (a&l2->attr)) && c(l1->b,l2->b)){ \
205 ret|=a; \
206 }
207
208 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ret=0;
209
210 if (l1->attrcxx . . $ db_line#attr.&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing)) {
211 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' has growing attribute set, ignore growing changes", l1->filename);
212 }
213
214 if ((ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ftype)&l1->attrcxx . . $ db_line#attr. && ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ftype)&l2->attrcxx . . $ db_line#attr.) && (l1->permcxx . . $ db_line#perm.&S_IFMTcxx . . $ `<external>/531885356569766532/stat.h:104:10`!)!=(l2->permcxx . . $ db_line#perm.&S_IFMTcxx . . $ `<external>/531885356569766532/stat.h:104:10`!)) { ret|=ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ftype); }
215 easy_function_comparecxx . . $ `src/gen_list.c:203:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname),linkname,has_str_changed);
216 if ((ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)&l1->attrcxx . . $ db_line#attr. && ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)&l2->attrcxx . . $ db_line#attr.) && l1->sizecxx . . $ db_line#size.>l2->sizecxx . . $ db_line#size.){ ret|=ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg); }
217 easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size),size);
218 easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_bcount),bcount);
219 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_perm),perm);
220 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_uid),uid);
221 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_gid),gid);
222 easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_atime),atime);
223 easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_mtime),mtime);
224 easy_growing_comparecxx . . $ `src/gen_list.c:185:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ctime),ctime);
225 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_inode),inode);
226 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkcount),nlink);
227
228 #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`!
229 easy_comparecxx . . $ `src/gen_list.c:198:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_fs_type), fs_type);
230 #endif
231
232 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! all_hashsums = get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
233 if (compare_hashsums && l1->attrcxx . . $ db_line#attr.&all_hashsums && l2->attrcxx . . $ db_line#attr.&all_hashsums) {
234 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "│ compare hashsums of old:'%s' and new:'%s'", l1->filename, l2->filename);
235 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! changed_hashsums = get_changed_hashsumscxx . . $ get_changed_hashsums(8d0ccb7cb9714935).(l1->hashsumscxx . . $ db_line#hashsums., l2->hashsumscxx . . $ db_line#hashsums., l1, l2, whoami);
236 if (changed_hashsums) {
237 char *str;
238 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0,changed_hashsums);
239 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' and new:'%s' have CHANGED hashsum(s): %s", l1->filename, l2->filename, str);
240 freecxx . . $ free(5d22bdacc48458e8).(str);
241 if (l1->attrcxx . . $ db_line#attr.&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing)) {
242 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!) {
243 if(l1->sizecxx . . $ db_line#size. < l2->sizecxx . . $ db_line#size.) {
244 if (l1->sizecxx . . $ db_line#size.) {
245 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ old:'%s' has growing attribute set, check for growing hashsums", l1->filename);
246 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ compare hashsums of old:'%s' and new:'%s' (limited to old size %lld)", l1->filename, l2->filename, l1->size);
247 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! transition_hashsums = get_transition_hashsumscxx . . $ get_transition_hashsums(d940f40586ac8d6a).(l1->filenamecxx . . $ db_line#filename., l1->attrcxx . . $ db_line#attr., l2->filenamecxx . . $ db_line#filename., l2->attrcxx . . $ db_line#attr.);
248 md_hashsumscxx . . $ md_hashsums# hs = calc_hashsumscxx . . $ calc_hashsums(e5558d7452ce5e04).(entry, l2->attrcxx . . $ db_line#attr.|transition_hashsums, l1->sizecxx . . $ db_line#size., falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, whoami);
249
250 bytecxx . . $ byte#* new_hashsums[num_hashescxx . . $ num_hashes.];
251 copy_hashsumscxx . . $ copy_hashsums(f1f39ddc5401fb9).(l2->fullpathcxx . . $ db_line#fullpath., &hs, &new_hashsums, whoami);
252
253 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! new_changed = get_changed_hashsumscxx . . $ get_changed_hashsums(8d0ccb7cb9714935).(l1->hashsumscxx . . $ db_line#hashsums., new_hashsums, l1, l2, whoami);
254
255 for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) {
256 freecxx . . $ free(5d22bdacc48458e8).(new_hashsums[i]);
257 }
258
259 if (new_changed) {
260 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0,new_changed);
261 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ keep hashsums as CHANGED (hashsums of new:'%s' limited to old size %lld have been changed: %s)", l2->filename, l1->size, str);
262 freecxx . . $ free(5d22bdacc48458e8).(str);
263 } else {
264 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ set hashsums as UNCHANGED (hashsums of new:'%s' limited to old size %lld have NOT been changed)", l2->filename, l1->size);
265 changed_hashsums = 0;
266 }
267 } else {
268 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' has growing attribute set, but skip hashsums calculation (file was empty before)", l1->filename);
269 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "%s", "│ set hashsums as UNCHANGED (old size equals zero)");
270 changed_hashsums = 0;
271 }
272 } else {
273 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ old:'%s' has growing attribute set, but skip hashsum calculation (old size is greater than or equal to new size)", l1->filename);
274 }
275 } else {
276 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ old:'%s' has growing attribute set, but skip hashsum calculation (NOT supported in dataase compare mode)", l1->filename);
277 }
278 }
279 } else {
280 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ old:'%s' and new:'%s' have NO changed hashsum(s)", l1->filename, l2->filename);
281 }
282 ret |= changed_hashsums;
283 }
284
285 #ifdef WITH_ACL
286 easy_function_compare(ATTR(attr_acl),acl,has_acl_changed);
287 #endif
288 #ifdef WITH_XATTR
289 easy_function_compare(ATTR(attr_xattrs),xattrs,have_xattrs_changed);
290 #endif
291 #ifdef WITH_SELINUX
292 easy_function_compare(ATTR(attr_selinux),cntx,has_str_changed);
293 #endif
294 #ifdef WITH_E2FSATTRS
295 easy_function_compare(ATTR(attr_e2fsattrs),e2fsattrs,has_e2fsattrs_changed);
296 #endif
297 #ifdef WITH_CAPABILITIES
298 easy_function_compare(ATTR(attr_capabilities),capabilities,has_str_changed);
299 #endif
300
301 char *str;
302 if (ignore_attrs) {
303 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, ignore_attrs);
304 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ attribute changes to ignore: %s", str);
305 freecxx . . $ free(5d22bdacc48458e8).(str);
306 }
307 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ignored_attributes = ret&ignore_attrs;
308 char *ignored_attrs_str = ignored_attributes?diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, ignored_attributes):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
309 ret &= ~ignore_attrs;
310 if (ret) {
311 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, ret);
312 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' and new:'%s' have CHANGED attributes: %s (ignored attributes: %s)", l1->filename, l2->filename, str, ignored_attrs_str?ignored_attrs_str:"<none>");
313 freecxx . . $ free(5d22bdacc48458e8).(str);
314 } else {
315 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' and new:'%s' have NO changed attributes (ignored attributes: %s)", l1->filename, l2->filename, ignored_attrs_str?ignored_attrs_str:"<none>");
316 }
317 freecxx . . $ free(5d22bdacc48458e8).(ignored_attrs_str);
318 return ret;
319 }
320
321 static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_different_attributescxx . . $ get_different_attributes(6c513612009f50d7).(db_linecxx . . $ db_line#* l1, db_linecxx . . $ db_line#* l2, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ignore_attrs, const char *whoami) {
322 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ret = l1->attrcxx . . $ db_line#attr.^l2->attrcxx . . $ db_line#attr.;
323 char *str;
324 if (ignore_attrs) {
325 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, ignore_attrs);
326 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ attribute differences to ignore: %s", str);
327 freecxx . . $ free(5d22bdacc48458e8).(str);
328 }
329 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! ignored_attributes = ret&ignore_attrs;
330 char *ignored_attrs_str = ignored_attributes?diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, ignored_attributes):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
331 ret &= ~ignore_attrs;
332 if (ret) {
333 str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(l1->attrcxx . . $ db_line#attr.&~ignore_attrs, l2->attrcxx . . $ db_line#attr.&~ignore_attrs);
334 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' and new:'%s' have different attributes: %s (ignored attributes: %s)", l1->filename, l2->filename, str, ignored_attrs_str?ignored_attrs_str:"<none>");
335 freecxx . . $ free(5d22bdacc48458e8).(str);
336 } else {
337 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ old:'%s' and new:'%s' have NO different attributes (ignored attributes: %s)", l1->filename, l2->filename, ignored_attrs_str?ignored_attrs_str:"<none>");
338 }
339 freecxx . . $ free(5d22bdacc48458e8).(ignored_attrs_str);
340 return ret;
341 }
342
343 #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`!
344 #define PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!(format, c, ...) \
345 if (file.fs_type) { \
346 fs_type_str = get_fs_type_string_from_magic(file.fs_type); \
347 fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "[%c] %c=%s:%s: " format "\n", c, file_type, fs_type_str, filename_safe, __VA_ARGS__); \
348 free(fs_type_str); \
349 } else { \
350 fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, "[%c] %c:%s: " format "\n", c, file_type, filename_safe, __VA_ARGS__); \
351 }
352 #else
353 #define PRINT_RULE_MATCH(format, c, ...) \
354 fprintf(stdout, "[%c] %c:%s: " format "\n", c, file_type, filename_safe, __VA_ARGS__);
355 #endif
356
357 void print_matchcxx . . $ print_match(409851dd7b7ab465).(file_tcxx . . $ file_t# file, match_tcxx . . $ match_t# match) {
358 char * str;
359 char* attr_str;
360 char file_type = get_f_type_char_from_f_typecxx . . $ get_f_type_char_from_f_type(1cb8f0426fc6e5a2).(file.typecxx . . $ file_t#type.);
361 #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`!
362 char *fs_type_str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
363 #endif
364 rx_rulecxx . . $ rx_rule# *rule = match.rulecxx . . $ match_t#rule.;
365 char *filename_safe = stresccxx . . $ stresc(a8b8e32347182212).(file.namecxx . . $ file_t#name.);
366 char *limit_safe = confcxx . . $ conf.->limitcxx . . $ db_config#limit.?stresccxx . . $ stresc(a8b8e32347182212).(confcxx . . $ conf.->limitcxx . . $ db_config#limit.):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
367 switch (match.resultcxx . . $ match_t#result.) {
368 case RESULT_SELECTIVE_MATCHcxx . . $ RESULT_SELECTIVE_MATCH.:
369 case RESULT_EQUAL_MATCHcxx . . $ RESULT_EQUAL_MATCH.:
370 str = get_restriction_stringcxx . . $ get_restriction_string(7c1dd464d1a8aef8).(rule->restrictioncxx . . $ rx_rule#restriction.);
371 attr_str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, rule->attrcxx . . $ rx_rule#attr.);
372 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("%s: '%s%s %s %s' (%s:%d: '%s%s%s')", 'x', get_rule_type_long_string(rule->type), get_rule_type_char(rule->type), rule->rx, str, attr_str, rule->config_filename, rule->config_linenumber, rule->config_line, rule->prefix?"', prefix: '":"", rule->prefix?rule->prefix:"")
373 freecxx . . $ free(5d22bdacc48458e8).(attr_str);
374 freecxx . . $ free(5d22bdacc48458e8).(str);
375 break;
376 case RESULT_RECURSIVE_NEGATIVE_MATCHcxx . . $ RESULT_RECURSIVE_NEGATIVE_MATCH.:
377 case RESULT_NON_RECURSIVE_NEGATIVE_MATCHcxx . . $ RESULT_NON_RECURSIVE_NEGATIVE_MATCH.:
378 str = get_restriction_stringcxx . . $ get_restriction_string(7c1dd464d1a8aef8).(rule->restrictioncxx . . $ rx_rule#restriction.);
379 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("%s: '%s%s %s' (%s:%d: '%s%s%s')", ' ', get_rule_type_long_string(rule->type), get_rule_type_char(rule->type), rule->rx, str, rule->config_filename, rule->config_linenumber, rule->config_line, rule->prefix?"', prefix: '":"", rule->prefix?rule->prefix:"")
380 freecxx . . $ free(5d22bdacc48458e8).(str);
381 break;
382 case RESULT_NEGATIVE_PARENT_MATCHcxx . . $ RESULT_NEGATIVE_PARENT_MATCH.:
383 str = get_restriction_stringcxx . . $ get_restriction_string(7c1dd464d1a8aef8).(rule->restrictioncxx . . $ rx_rule#restriction.);
384 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("parent directory '%.*s' matches %s: '%s%s %s' (%s:%d: '%s%s%s')", ' ', match.length, filename_safe, get_rule_type_long_string(rule->type), get_rule_type_char(rule->type), rule->rx, str, rule->config_filename, rule->config_linenumber, rule->config_line, rule->prefix?"', prefix: '":"", rule->prefix?rule->prefix:"")
385 freecxx . . $ free(5d22bdacc48458e8).(str);
386 break;
387 case RESULT_PARTIAL_MATCHcxx . . $ RESULT_PARTIAL_MATCH.:
388 case RESULT_NO_RULE_MATCHcxx . . $ RESULT_NO_RULE_MATCH.:
389 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("%s", ' ', "no matching rule")
390 break;
391 case RESULT_PARTIAL_LIMIT_MATCHcxx . . $ RESULT_PARTIAL_LIMIT_MATCH.:
392 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("parital limit match (limit '%s')", ' ', limit_safe);
393 break;
394 case RESULT_PART_LIMIT_AND_NO_RECURSE_MATCHcxx . . $ RESULT_PART_LIMIT_AND_NO_RECURSE_MATCH.:
395 if (rule) {
396 str = get_restriction_stringcxx . . $ get_restriction_string(7c1dd464d1a8aef8).(rule->restrictioncxx . . $ rx_rule#restriction.);
397 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("partial limit match (limit '%s') but %s: '%s%s %s' (%s:%d: '%s%s%s')", ' ', limit_safe, get_rule_type_long_string(rule->type), get_rule_type_char(rule->type), rule->rx, str, rule->config_filename, rule->config_linenumber, rule->config_line, rule->prefix?"', prefix: '":"", rule->prefix?rule->prefix:"")
398 freecxx . . $ free(5d22bdacc48458e8).(str);
399 } else {
400 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("partial limit match (limit '%s') but no matching rule", ' ', limit_safe)
401 }
402 break;
403 case RESULT_NO_LIMIT_MATCHcxx . . $ RESULT_NO_LIMIT_MATCH.:
404 PRINT_RULE_MATCHcxx . . $ `src/gen_list.c:344:9`!("outside of limit '%s'", ' ', limit_safe);
405 break;
406 }
407 freecxx . . $ free(5d22bdacc48458e8).(filename_safe);
408 freecxx . . $ free(5d22bdacc48458e8).(limit_safe);
409 }
410
411 /*
412 * add_file_to_tree
413 */
414 void add_file_to_treecxx . . $ add_file_to_tree(def11f63420acca9).(seltreecxx . . $ seltree#* tree,db_linecxx . . $ db_line#* file,int db_flags, const databasecxx . . $ database# *db, disk_entrycxx . . $ disk_entry# *entry, const char *whoami)
415 {
416 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "add_file_to_tree: '%s'", file->filename);
417 seltreecxx . . $ seltree#* node=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
418
419 node = get_or_create_seltree_nodecxx . . $ get_or_create_seltree_node(e2ef57450a84c6c6).(tree,file->filenamecxx . . $ db_line#filename.);
420
421 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
422 int node_flags = node->checkedcxx . . $ seltree#checked.&db_flags;
423 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
424 if (db && node_flags) {
425 LOG_DB_FORMAT_LINEcxx . . $ `include/db.h:72:9`!(LOG_LEVEL_WARNING, "duplicate database entry found for '%s' (skip line)", file->filename)
426 free_db_linecxx . . $ free_db_line(5dc4328f64ce0e3d).(file);
427 freecxx . . $ free(5d22bdacc48458e8).(file);
428 } else {
429 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
430
431 /* add note to this node which db has modified it */
432 node->checkedcxx . . $ seltree#checked.|=db_flags;
433
434 LOG_LEVELcxx . . $ LOG_LEVEL# add_entry_log_level = LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG.;
435
436 switch (db_flags) {
437 case DB_OLDcxx . . $ `include/db.h:57:9`!: {
438 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_OLDDBcxx . . $ PROGRESS_OLDDB., file->filenamecxx . . $ db_line#filename.);
439 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(add_entry_log_level, "add old database entry '%s' (%c) to node '%s' (%p) as old data", file->filename, get_f_type_char_from_perm(file->perm), node->path, (void*) node);
440 node->old_datacxx . . $ seltree#old_data.=file;
441 break;
442 }
443 case DB_NEWcxx . . $ `include/db.h:59:9`!|DB_DISKcxx . . $ `include/db.h:58:9`!: {
444 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_DISKcxx . . $ PROGRESS_DISK., file->filenamecxx . . $ db_line#filename.);
445 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(add_entry_log_level, "add disk entry '%s' (%c) to node '%s' (%p) as new data", file->filename, get_f_type_char_from_perm(file->perm), node->path, (void*) node);
446 node->new_datacxx . . $ seltree#new_data.=file;
447 break;
448 }
449 case DB_NEWcxx . . $ `include/db.h:59:9`!: {
450 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_NEWDBcxx . . $ PROGRESS_NEWDB., file->filenamecxx . . $ db_line#filename.);
451 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(add_entry_log_level, "add new database entry '%s' (%c) to node '%s' (%p) as new data", file->filename, get_f_type_char_from_perm(file->perm), node->path, (void*) node);
452 node->new_datacxx . . $ seltree#new_data.=file;
453 break;
454 }
455 case DB_OLDcxx . . $ `include/db.h:57:9`!|DB_NEWcxx . . $ `include/db.h:59:9`!: {
456 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_SKIPPEDcxx . . $ PROGRESS_SKIPPED., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
457 node->new_datacxx . . $ seltree#new_data.=file;
458 node->checkedcxx . . $ seltree#checked.|=NODE_FREEcxx . . $ `include/db.h:63:9`!;
459 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_LIMIT, "add old database entry '%s' (%c) to node (%p) as new data (entry does not match limit but keep it for database_out)", file->filename, get_f_type_char_from_perm(file->perm), (void*) node);
460 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
461 return;
462 }
463 }
464 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
465
466 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!)) {
467 if (!(db_flags&DB_OLDcxx . . $ `include/db.h:57:9`!)) {
468 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
469 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┬ handle '%s' from %s", node->path, db_flags==DB_OLDcxx . . $ `include/db.h:57:9`! ? "old database": (db_flags==DB_NEWcxx . . $ `include/db.h:59:9`! ? "new database": "disk"));
470 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
471 }
472
473 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
474 if((node->checkedcxx . . $ seltree#checked.&DB_OLDcxx . . $ `include/db.h:57:9`!)&&(node->checkedcxx . . $ seltree#checked.&DB_NEWcxx . . $ `include/db.h:59:9`!)){
475 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ compare attributes of '%s'", node->path);
476 get_different_attributescxx . . $ get_different_attributes(6c513612009f50d7).(node->old_datacxx . . $ seltree#old_data.,node->new_datacxx . . $ seltree#new_data., 0, whoami);
477 node->changed_attrscxx . . $ seltree#changed_attrs.=get_changed_attributescxx . . $ get_changed_attributes(632de1aa256cd910).(node->old_datacxx . . $ seltree#old_data.,node->new_datacxx . . $ seltree#new_data., 0, entry, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, whoami);
478 /* Free the data if same else leave as is for report_tree */
479 if(node->changed_attrscxx . . $ seltree#changed_attrs.==RETOKcxx . . $ `include/db_config.h:45:9`! && !((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.^(node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.)) {
480 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ free old data (node '%s' is unchanged)", node->path);
481 node->changed_attrscxx . . $ seltree#changed_attrs.=0;
482
483 free_db_linecxx . . $ free_db_line(5dc4328f64ce0e3d).(node->old_datacxx . . $ seltree#old_data.);
484 freecxx . . $ free(5d22bdacc48458e8).(node->old_datacxx . . $ seltree#old_data.);
485 node->old_datacxx . . $ seltree#old_data.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
486
487 /* Free new data if not needed for write_tree */
488 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!) {
489 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ keep new data (node '%s' is unchanged, but keep it for database_out)", node->path);
490 node->checkedcxx . . $ seltree#checked.|=NODE_FREEcxx . . $ `include/db.h:63:9`!;
491 } else {
492 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ free new data (node '%s' is unchanged)", node->path);
493 free_db_linecxx . . $ free_db_line(5dc4328f64ce0e3d).(node->new_datacxx . . $ seltree#new_data.);
494 freecxx . . $ free(5d22bdacc48458e8).(node->new_datacxx . . $ seltree#new_data.);
495 node->new_datacxx . . $ seltree#new_data.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
496 }
497 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┴ finished '%s'", node->path);
498 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
499 return;
500 }
501 } else if(node->checkedcxx . . $ seltree#checked.&DB_NEWcxx . . $ `include/db.h:59:9`!) {
502 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ '%s' is new (no old data exists)", node->path);
503 }
504 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
505
506 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! default_move_ignored_attr = ATTRcxx . . $ `include/attributes.h:28:9`!(attr_allownewfile)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_allowrmfile)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_checkinode)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_compressed)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_growing);
507 if (db_flags&DB_NEWcxx . . $ `include/db.h:59:9`!) {
508 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
509 db_linecxx . . $ db_line# *new_file = node->new_datacxx . . $ seltree#new_data.;
510 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
511 if (new_file->attrcxx . . $ db_line#attr.&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_compressed)) {
512 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! available_hashsums = get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
513 if (new_file->attrcxx . . $ db_line#attr.&available_hashsums) {
514 if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!) {
515 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ '%s' has compressed attribute set, calculate uncompressed hashsums", new_file->filename);
516
517 seltreecxx . . $ seltree# *moved_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
518
519 md_hashsumscxx . . $ md_hashsums# hs = calc_hashsumscxx . . $ calc_hashsums(e5558d7452ce5e04).(entry, new_file->attrcxx . . $ db_line#attr., -1, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, whoami);
520 if (hs.attrscxx . . $ md_hashsums#attrs.) {
521 bytecxx . . $ byte#* new_hashsums[num_hashescxx . . $ num_hashes.];
522 copy_hashsumscxx . . $ copy_hashsums(f1f39ddc5401fb9).(new_file->fullpathcxx . . $ db_line#fullpath., &hs, &new_hashsums, whoami);
523 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ search for original file with uncompressed hashsums of new:'%s'", new_file->filename);
524
525 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
526 for(tree_nodecxx . . $ tree_node# *x = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).((node->parentcxx . . $ seltree#parent.)->childrencxx . . $ seltree#children.); x != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ; x = tree_walk_nextcxx . . $ tree_walk_next(29fe63215e0d1f08).(x)) {
527 moved_node = tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(x);
528 if (moved_node != node) {
529 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
530 if (moved_node->old_datacxx . . $ seltree#old_data.) {
531 if ((new_file->attrcxx . . $ db_line#attr.&(moved_node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.)&available_hashsums) {
532 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "│ compare hashsums of old:'%s' with uncompressed hashsums of new:'%s'", (moved_node->old_data)->filename, new_file->filename);
533 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! uncompressed_changed = get_changed_hashsumscxx . . $ get_changed_hashsums(8d0ccb7cb9714935).((moved_node->old_datacxx . . $ seltree#old_data.)->hashsumscxx . . $ db_line#hashsums., new_hashsums, (moved_node->old_datacxx . . $ seltree#old_data.), new_file, whoami);
534 if (uncompressed_changed) {
535 char *str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0,uncompressed_changed);
536 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ hashsums of old:'%s' and uncompressed hashsums of new:'%s' have been CHANGED: %s)", (moved_node->old_data)->filename, new_file->filename, str);
537 freecxx . . $ free(5d22bdacc48458e8).(str);
538 } else {
539 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ hashsums of old:'%s' and uncompressed hashsums of new:'%s' have NOT been changed)", (moved_node->old_data)->filename, new_file->filename);
540 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
541 break;
542 }
543 } else {
544 char *old_hashsums_str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0,(moved_node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&available_hashsums);
545 char *new_hashsums_str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0,new_file->attrcxx . . $ db_line#attr.&available_hashsums);
546 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ skip old:'%s' (no common hashsums with new:'%s', old hashsum(s): %s, new hashsum(s): %s)", (moved_node->old_data)->filename, new_file->filename, old_hashsums_str, new_hashsums_str);
547 freecxx . . $ free(5d22bdacc48458e8).(old_hashsums_str);
548 freecxx . . $ free(5d22bdacc48458e8).(new_hashsums_str);
549 }
550 }
551 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
552 }
553 moved_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
554 }
555 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
556
557 for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) {
558 freecxx . . $ free(5d22bdacc48458e8).(new_hashsums[i]);
559 }
560 if (moved_node) {
561 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
562 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
563 if (!(moved_node->checkedcxx . . $ seltree#checked.&NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!)) {
564 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ found old:'%s' with same common hashsum(s) as uncompressed file new:'%s'", (moved_node->old_data)->filename, new_file->filename);
565 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ compare attributes of original file old:'%s' and compressed file new:'%s'", (moved_node->old_data)->filename, new_file->filename);
566
567 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! compressed_ignored_attr = default_move_ignored_attr | get_hashsums_to_ignorecxx . . $ get_hashsums_to_ignore(d940f40586ac8d6a).((moved_node->old_datacxx . . $ seltree#old_data.)->filenamecxx . . $ db_line#filename., (moved_node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr., new_file->filenamecxx . . $ db_line#filename., new_file->attrcxx . . $ db_line#attr.);
568 if (get_different_attributescxx . . $ get_different_attributes(6c513612009f50d7).(moved_node->old_datacxx . . $ seltree#old_data., new_file, compressed_ignored_attr, whoami)) {
569 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ ignore old:'%s' as original file of compressed file new:'%s' (due to different attributes)", (moved_node->old_data)->filename, new_file->filename);
570 } else if (get_changed_attributescxx . . $ get_changed_attributes(632de1aa256cd910).((moved_node->old_datacxx . . $ seltree#old_data.), new_file, ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ctime)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_bcount)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_inode), entry, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, whoami) == RETOKcxx . . $ `include/db_config.h:45:9`!) {
571 node->checkedcxx . . $ seltree#checked. |= NODE_MOVED_INcxx . . $ `include/db.h:66:9`!;
572 moved_node->checkedcxx . . $ seltree#checked. |= NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!;
573 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level,_cxx . . $ `include/locale-aide.h:33:9`!("│ accept old:'%s' as original file of compressed file new:'%s'"), (moved_node->old_data)->filename, new_file->filename);
574 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┴ finished '%s'", node->path);
575 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
576 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
577 return;
578 } else {
579 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level,"│ ignore '%s' as original file of compressed file '%s' (due to changed attributes)", (moved_node->old_data)->filename, new_file->filename);
580 }
581 } else {
582 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ '%s' has been already moved out", (moved_node->old_data)->filename);
583 }
584 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
585 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
586 } else {
587 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ NO original file with same hashsum(s) found for compressed file new:'%s'", new_file->filename);
588 }
589 } else {
590 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ calculation of uncompressed hashsums for comprressed file new:'%s' FAILED", new_file->filename);
591 }
592 } else {
593 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ new:'%s' has compressed attribute set, but skip hashsum calculation (NOT supported in dataase compare mode)", new_file->filename);
594 }
595 } else {
596 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ new:'%s' has compressed attribute set, but skip hashsum calculation (file has no hashsums set)", new_file->filename);
597 }
598 }
599 }
600
601 if (node->parentcxx . . $ seltree#parent. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { /* root (/) has no parent */
602 if (db_flags&DB_OLDcxx . . $ `include/db.h:57:9`!) {
603 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
604 if(file->attrcxx . . $ db_line#attr. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_checkinode)) {
605 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "'%s' (inode: %li) has check inode attribute set, set NODE_CHECK_INODE_CHILD for parent '%s'", file->filename, file->inode, (node->parent)->path);
606 (node->parentcxx . . $ seltree#parent.)->checkedcxx . . $ seltree#checked. |= NODE_CHECK_INODEcxx . . $ `include/db.h:69:9`!;
607 }
608 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
609 } else {
610 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
611 db_linecxx . . $ db_line# *new_file = node->new_datacxx . . $ seltree#new_data.;
612 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
613
614 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
615 if( (node->parentcxx . . $ seltree#parent.)->checkedcxx . . $ seltree#checked.&NODE_CHECK_INODEcxx . . $ `include/db.h:69:9`! && new_file != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ) {
616 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┝ parent directory (%s) of '%s' (inode: %li) has entries with check inode attribute set, search for source file with same inode", (node->parent)->path, new_file->filename, new_file->inode);
617 seltreecxx . . $ seltree#* moved_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
618 for(tree_nodecxx . . $ tree_node# *x = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).((node->parentcxx . . $ seltree#parent.)->childrencxx . . $ seltree#children.); x != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ; x = tree_walk_nextcxx . . $ tree_walk_next(29fe63215e0d1f08).(x)) {
619 moved_node = tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(x);
620 if (moved_node != node) {
621 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
622 if (moved_node->old_datacxx . . $ seltree#old_data. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && (moved_node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_checkinode)) {
623 if ((moved_node->old_datacxx . . $ seltree#old_data.)->inodecxx . . $ db_line#inode. == new_file->inodecxx . . $ db_line#inode.) {
624 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
625 break;
626 } else {
627 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "│ '%s' has check inode attribute set but different inode", (moved_node->old_data)->filename);
628 }
629 }
630 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
631 }
632 moved_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
633 }
634 if(moved_node != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
635 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
636 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
637 db_linecxx . . $ db_line# *newData = new_file;
638 db_linecxx . . $ db_line# *oldData = moved_node->old_datacxx . . $ seltree#old_data.;
639 if (!(moved_node->checkedcxx . . $ seltree#checked.&NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!)) {
640 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ found old:'%s' with check inode attribute set and same inode as file new:'%s'", oldData->filename, newData->filename);
641 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ compare attributes of source file old:'%s' and target file new:'%s'", oldData->filename, newData->filename);
642 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! move_ignored_attr = default_move_ignored_attr | get_hashsums_to_ignorecxx . . $ get_hashsums_to_ignore(d940f40586ac8d6a).(oldData->filenamecxx . . $ db_line#filename., oldData->attrcxx . . $ db_line#attr., newData->filenamecxx . . $ db_line#filename., newData->attrcxx . . $ db_line#attr.);
643 if (get_different_attributescxx . . $ get_different_attributes(6c513612009f50d7).(oldData, newData, move_ignored_attr, whoami)) {
644 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ ignore old:'%s' as source file of target file new:'%s' (due to different attributes)", oldData->filename, newData->filename);
645 } else if (get_changed_attributescxx . . $ get_changed_attributes(632de1aa256cd910).(oldData, newData, ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ctime), entry, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!, whoami) == RETOKcxx . . $ `include/db_config.h:45:9`!) {
646 node->checkedcxx . . $ seltree#checked. |= NODE_MOVED_INcxx . . $ `include/db.h:66:9`!;
647 moved_node->checkedcxx . . $ seltree#checked. |= NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!;
648 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ accept old:'%s' as source file of target file new:'%s'", oldData->filename, newData->filename);
649 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "┴ finished '%s'", node->path);
650 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
651 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
652 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
653 return;
654 } else {
655 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ ignore old:'%s' as source file of target file new:'%s' (due to changed attributes)", oldData->filename, newData->filename);
656 }
657 } else {
658 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ '%s' has been already moved out", oldData->filename);
659 }
660 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
661 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&moved_node->rwlockcxx . . $ seltree#rwlock.);
662 } else {
663 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level, "│ no source file found for target file '%s'", new_file->filename);
664 }
665 }
666 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&(node->parentcxx . . $ seltree#parent.)->rwlockcxx . . $ seltree#rwlock.);
667 }
668 }
669
670 pthread_rwlock_wrlockcxx . . $ pthread_rwlock_wrlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
671 if( (db_flags&DB_NEWcxx . . $ `include/db.h:59:9`!) &&
672 (node->new_datacxx . . $ seltree#new_data.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) &&
673 (file->attrcxx . . $ db_line#attr. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_allownewfile)) ){
674 node->checkedcxx . . $ seltree#checked.|=NODE_ALLOW_NEWcxx . . $ `include/db.h:67:9`!;
675 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level,_cxx . . $ `include/locale-aide.h:33:9`!("│ '%s' has ANF attribute set, ignore addition of entry in the report"), file->filename);
676 }
677 if( (db_flags&DB_OLDcxx . . $ `include/db.h:57:9`!) &&
678 (node->old_datacxx . . $ seltree#old_data.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) &&
679 (file->attrcxx . . $ db_line#attr. & ATTRcxx . . $ `include/attributes.h:28:9`!(attr_allowrmfile)) ){
680 node->checkedcxx . . $ seltree#checked.|=NODE_ALLOW_RMcxx . . $ `include/db.h:68:9`!;
681 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level,_cxx . . $ `include/locale-aide.h:33:9`!("'%s' has ARF attribute set, ignore removal of entry in the report"), file->filename);
682 }
683 if (!(db_flags&DB_OLDcxx . . $ `include/db.h:57:9`!)) {
684 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(compare_log_level,"┴ finished '%s'", node->path);
685 }
686 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
687 }
688 }
689 }
690
691 match_resultcxx . . $ match_result# check_limitcxx . . $ check_limit(29f6a365c6b3226d).(char* filename, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! log_partial_match, const char *whoami) {
692 if(confcxx . . $ conf.->limitcxx . . $ db_config#limit.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
693 int match=pcre2_matchcxx . . $ `<external>/9988290459910441303/pcre2.h:938:9`!(confcxx . . $ conf.->limit_crxcxx . . $ db_config#limit_crx., (PCRE2_SPTRcxx . . $ `<external>/9988290459910441303/pcre2.h:877:9`!) filename, PCRE2_ZERO_TERMINATEDcxx . . $ `<external>/9988290459910441303/pcre2.h:530:9`!, 0, PCRE2_PARTIAL_SOFTcxx . . $ `<external>/9988290459910441303/pcre2.h:186:9`!, confcxx . . $ conf.->limit_mdcxx . . $ db_config#limit_md., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
694 if (match >= 0) {
695 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "'%s' does match limit '%s'", filename, conf->limit);
696 return 0;
697 } else if (match == PCRE2_ERROR_PARTIALcxx . . $ `<external>/9988290459910441303/pcre2.h:350:9`!) {
698 if (log_partial_match) {
699 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_LIMIT, "skip '%s' (reason: partial limit match, limit: '%s')", filename, conf->limit);
700 }
701 return RESULT_PARTIAL_LIMIT_MATCHcxx . . $ RESULT_PARTIAL_LIMIT_MATCH.;
702 } else {
703 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_LIMIT, "skip '%s' (reason: no limit match, limit '%s')", filename, conf->limit);
704 return RESULT_NO_LIMIT_MATCHcxx . . $ RESULT_NO_LIMIT_MATCH.;
705 }
706 }
707 return 0;
708 }
709
710 match_tcxx . . $ match_t# check_rxtreecxx . . $ check_rxtree(30f8ca777f09528f).(file_tcxx . . $ file_t# file, seltreecxx . . $ seltree#* tree, char* source, boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! check_parent_dirs, const char *whoami) {
711 match_resultcxx . . $ match_result# limit_result = check_limitcxx . . $ check_limit(29f6a365c6b3226d).(file.namecxx . . $ file_t#name., !(file.typecxx . . $ file_t#type.&FT_DIRcxx . . $ `include/file.h:32:9`!), whoami);
712 match_tcxx . . $ match_t# match;
713 if (limit_result) {
714 if (limit_result == RESULT_PARTIAL_LIMIT_MATCHcxx . . $ RESULT_PARTIAL_LIMIT_MATCH. && file.typecxx . . $ file_t#type.&FT_DIRcxx . . $ `include/file.h:32:9`!) {
715 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u252c partial limit match (limit: '%s') for directory '%s', check for no-recurse match", conf->limit, file.name);
716 match = check_seltreecxx . . $ check_seltree(634c6f0bfd0e2c3d).(tree, file, check_parent_dirs, whoami);
717 if (match.resultcxx . . $ match_t#result. == RESULT_NON_RECURSIVE_NEGATIVE_MATCHcxx . . $ RESULT_NON_RECURSIVE_NEGATIVE_MATCH. || match.resultcxx . . $ match_t#result. == RESULT_NO_RULE_MATCHcxx . . $ RESULT_NO_RULE_MATCH.) {
718 match.resultcxx . . $ match_t#result. = RESULT_PART_LIMIT_AND_NO_RECURSE_MATCHcxx . . $ RESULT_PART_LIMIT_AND_NO_RECURSE_MATCH.;
719 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u2534 no-recurse match for '%s', stop directory processing", file.name);
720 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "check_rxtree: match result %s (%d) for '%s'", get_match_result_string(match.result), match.result, file.name);
721 return match;
722 } else {
723 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u2534 no no-recurse match for '%s'", file.name);
724 }
725 }
726 match = (match_tcxx . . $ match_t#) { limit_result, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0 };
727 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "check_rxtree: match result %s (%d) for '%s'", get_match_result_string(match.result), match.result, file.name);
728 return match;
729 }
730
731 #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`!
732 char * fs_type_str = get_fs_type_string_from_magiccxx . . $ get_fs_type_string_from_magic(4b58d6ff543a4736).(file.fs_typecxx . . $ file_t#fs_type.);
733 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u252c process '%s' from %s (filetype: %c, file system type: %s)", file.name, source, get_f_type_char_from_f_type(file.type), fs_type_str);
734 freecxx . . $ free(5d22bdacc48458e8).(fs_type_str);
735 #else
736 LOG_WHOAMI(LOG_LEVEL_RULE, "\u252c process '%s' from %s (filetype: %c)", file.name, source, get_f_type_char_from_f_type(file.type));
737 #endif
738 match = check_seltreecxx . . $ check_seltree(634c6f0bfd0e2c3d).(tree, file, check_parent_dirs, whoami);
739 if (match.resultcxx . . $ match_t#result. == RESULT_SELECTIVE_MATCHcxx . . $ RESULT_SELECTIVE_MATCH. || match.resultcxx . . $ match_t#result. == RESULT_EQUAL_MATCHcxx . . $ RESULT_EQUAL_MATCH.) {
740 char *str;
741 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u2534 ADD '%s' (attr: '%s')", file.name, str = diff_attributes(0, match.rule->attr));
742 freecxx . . $ free(5d22bdacc48458e8).(str);
743 } else {
744 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_RULE, "\u2534 do NOT add '%s'", file.name);
745 }
746 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_TRACE, "check_rxtree: match result %s (%d) for '%s'", get_match_result_string(match.result), match.result, file.name);
747 return match;
748 }
749
750 db_linecxx . . $ db_line#* get_file_attrscxx . . $ get_file_attrs(38115f8814b417cb).(disk_entrycxx . . $ disk_entry# *file, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attrs, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! extra_hashsums, const char *whoami) {
751 LOG_WHOAMIcxx . . $ `include/log.h:73:9`!(LOG_LEVEL_DEBUG, "get file attributes '%s' (fullpath: '%s')", &file->filename[conf->root_prefix_length], file->filename);
752 db_linecxx . . $ db_line#* line=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
753 time_tcxx . . $ time_t# cur_time;
754
755 /*
756 Get current time for future time notification.
757 */
758 cur_time=timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
759
760 if (cur_time==(time_tcxx . . $ time_t#)-1) {
761 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING., "can't get current time: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
762 } else {
763
764 if(file->fscxx . . $ disk_entry#fs..st_atimecxx . . $ `<external>/16045971866008360577/struct_stat.h:77:11`!>cur_time){
765 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_NOTICEcxx . . $ LOG_LEVEL_NOTICE.,_cxx . . $ `include/locale-aide.h:33:9`!("%s atime in future"),file->filenamecxx . . $ disk_entry#filename.);
766 }
767 if(file->fscxx . . $ disk_entry#fs..st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!>cur_time){
768 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_NOTICEcxx . . $ LOG_LEVEL_NOTICE.,_cxx . . $ `include/locale-aide.h:33:9`!("%s mtime in future"),file->filenamecxx . . $ disk_entry#filename.);
769 }
770 if(file->fscxx . . $ disk_entry#fs..st_ctimecxx . . $ `<external>/16045971866008360577/struct_stat.h:79:11`!>cur_time){
771 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_NOTICEcxx . . $ LOG_LEVEL_NOTICE.,_cxx . . $ `include/locale-aide.h:33:9`!("%s ctime in future"),file->filenamecxx . . $ disk_entry#filename.);
772 }
773 }
774
775 line = checked_calloccxx . . $ checked_calloc(63a7bf2941bfcd7a).(1, sizeof(db_linecxx . . $ db_line#));
776
777 /*
778 We want filename
779 */
780
781 line->attrcxx . . $ db_line#attr.=attrs|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_filename);
782
783 /*
784 Just copy some needed fields.
785 */
786
787 line->fullpathcxx . . $ db_line#fullpath. = checked_strdupcxx . . $ checked_strdup(42228c1987407501).(file->filenamecxx . . $ disk_entry#filename.);
788 line->filenamecxx . . $ db_line#filename.=&line->fullpathcxx . . $ db_line#fullpath.[confcxx . . $ conf.->root_prefix_lengthcxx . . $ db_config#root_prefix_length.];
789 line->perm_ocxx . . $ db_line#perm_o.=file->fscxx . . $ disk_entry#fs..st_modecxx . . $ stat#st_mode.;
790 line->linknamecxx . . $ db_line#linkname.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
791
792 #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`!
793 if(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_fs_type)&line->attrcxx . . $ db_line#attr.) {
794 line->fs_typecxx . . $ db_line#fs_type. = file->fs_typecxx . . $ disk_entry#fs_type.;
795 } else {
796 line->fs_typecxx . . $ db_line#fs_type. = 0;
797 }
798 #endif
799
800 /*
801 Handle symbolic link
802 */
803
804 hsymlnkcxx . . $ hsymlnk(5dc4328f64ce0e3d).(line);
805
806 /*
807 Set normal part
808 */
809
810 fs2db_linecxx . . $ fs2db_line(42bac3c81d5693f6).(&file->fscxx . . $ disk_entry#fs., line);
811
812 /*
813 ACL stuff
814 */
815
816 #ifdef WITH_ACL
817 acl2line(line, file->fd, whoami);
818 #endif
819
820 #ifdef WITH_XATTR
821 xattrs2line(line, file->fd, whoami);
822 #endif
823
824 #ifdef WITH_SELINUX
825 selinux2line(line, file->fd, whoami);
826 #endif
827
828 #ifdef WITH_E2FSATTRS
829 e2fsattrs2line(line, file->fd, whoami);
830 #endif
831
832 #ifdef WITH_CAPABILITIES
833 capabilities2line(line, file->fd, whoami);
834 #endif
835
836 DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! all_hashsums = get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
837 if (line->attrcxx . . $ db_line#attr.&all_hashsums) {
838 md_hashsumscxx . . $ md_hashsums# hs = calc_hashsumscxx . . $ calc_hashsums(e5558d7452ce5e04).(file, line->attrcxx . . $ db_line#attr.|extra_hashsums, -1, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, whoami);
839 if (hs.attrscxx . . $ md_hashsums#attrs.) {
840 hashsums2linecxx . . $ hashsums2line(f5f0f94a1303d470).(&hs,line, whoami);
841 } else {
842 line->attrcxx . . $ db_line#attr.&=~all_hashsums;
843 }
844 }
845
846 return line;
847 }
848
849 void write_treecxx . . $ write_tree(373bb888e3180625).(seltreecxx . . $ seltree#* node) {
850 pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
851 if (node->checkedcxx . . $ seltree#checked.&DB_NEWcxx . . $ `include/db.h:59:9`!) {
852 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_WRITEDBcxx . . $ PROGRESS_WRITEDB., (node->new_datacxx . . $ seltree#new_data.)->filenamecxx . . $ db_line#filename.);
853 db_writelinecxx . . $ db_writeline(bb1b3cc1d92abff8).(node->new_datacxx . . $ seltree#new_data.,confcxx . . $ conf.);
854 if (node->checkedcxx . . $ seltree#checked.&NODE_FREEcxx . . $ `include/db.h:63:9`!) {
855 free_db_linecxx . . $ free_db_line(5dc4328f64ce0e3d).(node->new_datacxx . . $ seltree#new_data.);
856 freecxx . . $ free(5d22bdacc48458e8).(node->new_datacxx . . $ seltree#new_data.);
857 node->new_datacxx . . $ seltree#new_data.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
858 }
859 }
860 for(tree_nodecxx . . $ tree_node# *n = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).(node->childrencxx . . $ seltree#children.); n != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! ; n = tree_walk_nextcxx . . $ tree_walk_next(29fe63215e0d1f08).(n)) {
861 write_treecxx . . $ write_tree(373bb888e3180625).(tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(n));
862 }
863 pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.);
864 }
865
866 void populate_treecxx . . $ populate_tree(373bb888e3180625).(seltreecxx . . $ seltree#* tree) {
867 db_entry_tcxx . . $ db_entry_t# entry;
868 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`!)){
869 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_OLDDBcxx . . $ PROGRESS_OLDDB., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
870 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "read old entries from database: %s", (confcxx . . $ conf.->database_incxx . . $ db_config#database_in..urlcxx . . $ database#url.)->rawcxx . . $ url_t#raw.);
871 while((entry = db_readlinecxx . . $ db_readline(9768d9fab7f01dc3).(&(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!)).linecxx . . $ $anonymous_type_392304a1032d2441_1#line. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) {
872 if (entry.limitcxx . . $ $anonymous_type_392304a1032d2441_1#limit.) {
873 add_file_to_treecxx . . $ add_file_to_tree(def11f63420acca9).(tree,entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.,DB_OLDcxx . . $ `include/db.h:57:9`!|DB_NEWcxx . . $ `include/db.h:59:9`!, &(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), 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`!);
874 } else {
875 add_file_to_treecxx . . $ add_file_to_tree(def11f63420acca9).(tree,entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.,DB_OLDcxx . . $ `include/db.h:57:9`!, &(confcxx . . $ conf.->database_incxx . . $ db_config#database_in.), 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`!);
876 }
877 }
878 }
879 if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_DIFFcxx . . $ `include/db_config.h:50:9`!){
880 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_NEWDBcxx . . $ PROGRESS_NEWDB., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
881 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "read new entries from database: %s", (confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..urlcxx . . $ database#url.)->rawcxx . . $ url_t#raw.);
882 while((entry = db_readlinecxx . . $ db_readline(9768d9fab7f01dc3).(&(confcxx . . $ conf.->database_newcxx . . $ db_config#database_new.), 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`!){
883 add_file_to_treecxx . . $ add_file_to_tree(def11f63420acca9).(tree,entry.linecxx . . $ $anonymous_type_392304a1032d2441_1#line.,DB_NEWcxx . . $ `include/db.h:59:9`!, &(confcxx . . $ conf.->database_newcxx . . $ db_config#database_new.), 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`!);
884 }
885 }
886
887 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`!)){
888 progress_statuscxx . . $ progress_status(a36c9239dfdba10f).(PROGRESS_DISKcxx . . $ PROGRESS_DISK., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
889 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_INFOcxx . . $ LOG_LEVEL_INFO., "read new entries from disk (limit: '%s', root prefix: '%s')", confcxx . . $ conf.->limitcxx . . $ db_config#limit.?confcxx . . $ conf.->limitcxx . . $ db_config#limit.:"(none)", confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.);
890
891 db_scan_diskcxx . . $ db_scan_disk(b45ddcbc8423892c).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
892 }
893 }
894
895 void hsymlnkcxx . . $ hsymlnk(5dc4328f64ce0e3d).(db_linecxx . . $ db_line#* line) {
896
897 line->linknamecxx . . $ db_line#linkname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
898 if (line->attrcxx . . $ db_line#attr.&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname)) {
899 if((S_ISLNKcxx . . $ `<external>/531885356569766532/stat.h:133:10`!(line->perm_o))){
900 int len=0;
901 #ifdef WITH_ACL
902 if(conf->no_acl_on_symlinks!=1) {
903 line->attr&=(~ATTR(attr_acl));
904 }
905 #endif
906
907 if(confcxx . . $ conf.->warn_dead_symlinkscxx . . $ db_config#warn_dead_symlinks.==1) {
908 struct statcxx . . $ stat# fs;
909 int sres;
910 sres=statcxx . . $ stat(a9cd1e23e96f423c).(line->fullpathcxx . . $ db_line#fullpath.,&fs);
911 if (sres!=0 && sres!=EACCEScxx . . $ `<external>/8987895939074593727/errno-base.h:17:9`!) {
912 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING.,"Dead symlink detected at %s",line->fullpathcxx . . $ db_line#fullpath.);
913 }
914 if(!(line->attrcxx . . $ db_line#attr.&ATTRcxx . . $ `include/attributes.h:28:9`!(attr_rdev))) {
915 fs.st_rdevcxx . . $ stat#st_rdev.=0;
916 }
917 }
918 /*
919 Is this valid??
920 No, We should do this elsewhere.
921 */
922 line->linknamecxx . . $ db_line#linkname.=(char*)checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(_POSIX_PATH_MAXcxx . . $ `<external>/2534844627595019613/posix1_lim.h:97:9`!+1);
923
924 /*
925 Remember to nullify the buffer, because man page says
926
927 readlink places the contents of the symbolic link path in
928 the buffer buf, which has size bufsiz. readlink does not
929 append a NUL character to buf. It will truncate the con-
930 tents (to a length of bufsiz characters), in case the
931 buffer is too small to hold all of the contents.
932
933 */
934 memsetcxx . . $ memset(d1de1e4fb215f1c6).(line->linknamecxx . . $ db_line#linkname.,0,_POSIX_PATH_MAXcxx . . $ `<external>/2534844627595019613/posix1_lim.h:97:9`!+1);
935
936 len=readlinkcxx . . $ readlink(373c9bd46766ee5).(line->fullpathcxx . . $ db_line#fullpath.,line->linknamecxx . . $ db_line#linkname.,_POSIX_PATH_MAXcxx . . $ `<external>/2534844627595019613/posix1_lim.h:97:9`!+1);
937 if (len < 0) {
938 log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_WARNINGcxx . . $ LOG_LEVEL_WARNING., "readlink() failed for '%s': %s", line->fullpathcxx . . $ db_line#fullpath., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
939 line->attrcxx . . $ db_line#attr.&=(~ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname));
940 freecxx . . $ free(5d22bdacc48458e8).(line->linknamecxx . . $ db_line#linkname.);
941 line->linknamecxx . . $ db_line#linkname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
942 } else {
943 line->linknamecxx . . $ db_line#linkname.=checked_realloccxx . . $ checked_realloc(417ab160f6baadc6).(line->linknamecxx . . $ db_line#linkname.,len+1);
944 }
945 } else {
946 line->attrcxx . . $ db_line#attr.&=(~ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname));
947 }
948 }
949
950 }
951 // vi: ts=8 sw=2