| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 1999-2007, 2010-2013, 2015-2016, 2018-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 <stdlib.h> |
| 26 | #include <string.h> |
| 27 | #include <math.h> |
| 28 | #ifdef WITH_AUDIT |
| 29 | #include <libaudit.h> |
| 30 | #include <unistd.h> |
| 31 | #endif |
| 32 | #ifdef WITH_E2FSATTRS |
| 33 | #include "e2fsattrs.h" |
| 34 | #endif |
| 35 | #ifdef HAVE_SYSLOGcxx . . $ `./include/config.h:110:9`! |
| 36 | #include <syslog.h> |
| 37 | #endif |
| 38 | #include <stdarg.h> |
| 39 | #include <stdbool.h> |
| 40 | #include <stdio.h> |
| 41 | #include <sys/stat.h> |
| 42 | #include "hashsum.h"cxx . . $ `<file>/include/hashsum.h`/ |
| 43 | #include "log.h"cxx . . $ `<file>/include/log.h`/ |
| 44 | #include "rx_rule.h"cxx . . $ `<file>/include/rx_rule.h`/ |
| 45 | #include "seltree_struct.h"cxx . . $ `<file>/include/seltree_struct.h`/ |
| 46 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 47 | #include "file.h"cxx . . $ `<file>/include/file.h`/ |
| 48 | #endif |
| 49 | #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/ |
| 50 | #include "base64.h"cxx . . $ `<file>/include/base64.h`/ |
| 51 | #include "conf_ast.h"cxx . . $ `<file>/include/conf_ast.h`/ |
| 52 | #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/ |
| 53 | #include "list.h"cxx . . $ `<file>/include/list.h`/ |
| 54 | #include "url.h"cxx . . $ `<file>/include/url.h`/ |
| 55 | #include "db.h"cxx . . $ `<file>/include/db.h`/ |
| 56 | #include "db_line.h"cxx . . $ `<file>/include/db_line.h`/ |
| 57 | #include "be.h"cxx . . $ `<file>/include/be.h`/ |
| 58 | #include "util.h"cxx . . $ `<file>/include/util.h`/ |
| 59 | #include "report.h"cxx . . $ `<file>/include/report.h`/ |
| 60 | #include "report_plain.h"cxx . . $ `<file>/include/report_plain.h`/ |
| 61 | #include "report_json.h"cxx . . $ `<file>/include/report_json.h`/ |
| 62 | /*for locale support*/ |
| 63 | #include "locale-aide.h"cxx . . $ `<file>/include/locale-aide.h`/ |
| 64 | /*for locale support*/ |
| 65 | |
| 66 | |
| 67 | /*************/ |
| 68 | /* construction area for report lines */ |
| 69 | |
| 70 | #ifdef WITH_AUDIT |
| 71 | long nadd, nrem, nchg = 0; |
| 72 | #endif |
| 73 | int added_entries_reportedcxx . . $ added_entries_reported., removed_entries_reportedcxx . . $ removed_entries_reported., changed_entries_reportedcxx . . $ changed_entries_reported. = 0; |
| 74 | |
| 75 | |
| 76 | const ATTRIBUTEcxx . . $ ATTRIBUTE# report_attrs_ordercxx . . $ report_attrs_order.[] = { |
| 77 | attr_ftypecxx . . $ attr_ftype., |
| 78 | attr_linknamecxx . . $ attr_linkname., |
| 79 | attr_sizecxx . . $ attr_size., |
| 80 | attr_bcountcxx . . $ attr_bcount., |
| 81 | attr_permcxx . . $ attr_perm., |
| 82 | attr_uidcxx . . $ attr_uid., |
| 83 | attr_gidcxx . . $ attr_gid., |
| 84 | attr_atimecxx . . $ attr_atime., |
| 85 | attr_mtimecxx . . $ attr_mtime., |
| 86 | attr_ctimecxx . . $ attr_ctime., |
| 87 | attr_inodecxx . . $ attr_inode., |
| 88 | attr_linkcountcxx . . $ attr_linkcount., |
| 89 | attr_allhashsumscxx . . $ attr_allhashsums., |
| 90 | #ifdef WITH_ACL |
| 91 | attr_acl, |
| 92 | #endif |
| 93 | #ifdef WITH_XATTR |
| 94 | attr_xattrs, |
| 95 | #endif |
| 96 | #ifdef WITH_SELINUX |
| 97 | attr_selinux, |
| 98 | #endif |
| 99 | #ifdef WITH_E2FSATTRS |
| 100 | attr_e2fsattrs, |
| 101 | #endif |
| 102 | #ifdef WITH_CAPABILITIES |
| 103 | attr_capabilities, |
| 104 | #endif |
| 105 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 106 | attr_fs_typecxx . . $ attr_fs_type., |
| 107 | #endif |
| 108 | }; |
| 109 | |
| 110 | int report_attrs_order_lengthcxx . . $ report_attrs_order_length. = sizeof(report_attrs_ordercxx . . $ report_attrs_order.)/sizeof(ATTRIBUTEcxx . . $ ATTRIBUTE#); |
| 111 | |
| 112 | static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_attrscxx . . $ get_attrs(e520b8502d5c70a7).(ATTRIBUTEcxx . . $ ATTRIBUTE# attr) { |
| 113 | switch(attr) { |
| 114 | case attr_allhashsumscxx . . $ attr_allhashsums.: return get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!); |
| 115 | case attr_sizecxx . . $ attr_size.: return ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg); |
| 116 | default: return ATTRcxx . . $ `include/attributes.h:28:9`!(attr); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | report_optionscxx . . $ report_options# default_report_optionscxx . . $ default_report_options. = { |
| 121 | .format = REPORT_FORMAT_PLAINcxx . . $ REPORT_FORMAT_PLAIN., |
| 122 | .level = REPORT_LEVEL_CHANGED_ATTRIBUTEScxx . . $ REPORT_LEVEL_CHANGED_ATTRIBUTES., |
| 123 | }; |
| 124 | |
| 125 | struct report_levelcxx . . $ report_level# { |
| 126 | REPORT_LEVELcxx . . $ REPORT_LEVEL# report_levelcxx . . $ report_level#report_level.; |
| 127 | const char *namecxx . . $ report_level#name.; |
| 128 | }; |
| 129 | |
| 130 | static struct report_levelcxx . . $ report_level# report_level_arraycxx . . $ report_level_array.[] = { |
| 131 | { REPORT_LEVEL_MINIMALcxx . . $ REPORT_LEVEL_MINIMAL., "minimal" }, |
| 132 | { REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY., "summary" }, |
| 133 | { REPORT_LEVEL_DATABASE_ATTRIBUTEScxx . . $ REPORT_LEVEL_DATABASE_ATTRIBUTES., "database_attributes" }, |
| 134 | { REPORT_LEVEL_LIST_ENTRIEScxx . . $ REPORT_LEVEL_LIST_ENTRIES., "list_entries" }, |
| 135 | { REPORT_LEVEL_CHANGED_ATTRIBUTEScxx . . $ REPORT_LEVEL_CHANGED_ATTRIBUTES., "changed_attributes" }, |
| 136 | { REPORT_LEVEL_ADDED_REMOVED_ATTRIBUTEScxx . . $ REPORT_LEVEL_ADDED_REMOVED_ATTRIBUTES., "added_removed_attributes" }, |
| 137 | { REPORT_LEVEL_ADDED_REMOVED_ENTRIEScxx . . $ REPORT_LEVEL_ADDED_REMOVED_ENTRIES., "added_removed_entries" }, |
| 138 | { REPORT_LEVEL_UNKNOWNcxx . . $ REPORT_LEVEL_UNKNOWN., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! } |
| 139 | }; |
| 140 | |
| 141 | struct report_formatcxx . . $ report_format# { |
| 142 | REPORT_FORMATcxx . . $ REPORT_FORMAT# report_formatcxx . . $ report_format#report_format.; |
| 143 | const char *namecxx . . $ report_format#name.; |
| 144 | }; |
| 145 | |
| 146 | static struct report_formatcxx . . $ report_format# report_format_arraycxx . . $ report_format_array.[] = { |
| 147 | { REPORT_FORMAT_PLAINcxx . . $ REPORT_FORMAT_PLAIN., "plain" }, |
| 148 | { REPORT_FORMAT_JSONcxx . . $ REPORT_FORMAT_JSON., "json" }, |
| 149 | { REPORT_FORMAT_UNKNOWNcxx . . $ REPORT_FORMAT_UNKNOWN., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! } |
| 150 | }; |
| 151 | |
| 152 | #ifdef WITH_XATTR |
| 153 | static size_t xstrnspn(const char *s1, size_t len, const char *srch) |
| 154 | { |
| 155 | const char *os1 = s1; |
| 156 | |
| 157 | while (len-- && strchr(srch, *s1)) |
| 158 | ++s1; |
| 159 | |
| 160 | return (s1 - os1); |
| 161 | } |
| 162 | |
| 163 | #define PRINTABLE_XATTR_VALS \ |
| 164 | "0123456789" \ |
| 165 | "abcdefghijklmnopqrstuvwxyz" \ |
| 166 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ |
| 167 | ".-_:;,[]{}<>()!@#$%^&*|\\/?~" |
| 168 | |
| 169 | static int xattrs2array(xattrs_type* xattrs, char* **values) { |
| 170 | int n = 0; |
| 171 | if (xattrs==NULL) { n=1; } |
| 172 | else { n=1+xattrs->num; } |
| 173 | *values = checked_malloc(n * sizeof(char*)); |
| 174 | (*values)[0]=checked_malloc((6+floor(log10(n)))*sizeof(char)); |
| 175 | snprintf((*values)[0], 6+floor(log10(n)), "num=%d", n-1); |
| 176 | if (n>1) { |
| 177 | size_t num = 0; |
| 178 | int width, length; |
| 179 | width = log10(xattrs->num); /* make them the same width */ |
| 180 | while (num++ < xattrs->num) { |
| 181 | char *val = NULL; |
| 182 | size_t len = 0; |
| 183 | val = (char *)xattrs->ents[num - 1].val; |
| 184 | len = xstrnspn(val, xattrs->ents[num - 1].vsz, PRINTABLE_XATTR_VALS); |
| 185 | if ((len == xattrs->ents[num - 1].vsz) || ((len == (xattrs->ents[num - 1].vsz - 1)) && !val[len])) { |
| 186 | length = 8 + width + strlen(xattrs->ents[num - 1].key) + strlen(val); |
| 187 | (*values)[num]=checked_malloc(length *sizeof(char)); |
| 188 | snprintf((*values)[num], length , "[%.*zd] %s = %s", width, num, xattrs->ents[num - 1].key, val); |
| 189 | } else { |
| 190 | val = encode_base64(xattrs->ents[num - 1].val, xattrs->ents[num - 1].vsz); |
| 191 | length = 10 + width + strlen(xattrs->ents[num - 1].key) + strlen(val); |
| 192 | (*values)[num]=checked_malloc( length *sizeof(char)); |
| 193 | snprintf((*values)[num], length , "[%.*zd] %s <=> %s", width, num, xattrs->ents[num - 1].key, val); |
| 194 | free(val); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | return n; |
| 199 | } |
| 200 | #endif |
| 201 | |
| 202 | #ifdef WITH_ACL |
| 203 | static int acl2array(acl_type* acl, char* **values) { |
| 204 | int n = 0; |
| 205 | *values = NULL; |
| 206 | #ifdef WITH_POSIX_ACL |
| 207 | #define easy_posix_acl(x,y) \ |
| 208 | if (acl->x) { \ |
| 209 | i = k = 0; \ |
| 210 | while (acl->x[i]) { \ |
| 211 | if (acl->x[i]=='\n') { \ |
| 212 | (*values)[j]=checked_malloc(4+(i-k)*sizeof(char)); \ |
| 213 | snprintf((*values)[j], 4+(i-k), "%c: %s", y, &acl->x[k]); \ |
| 214 | j++; \ |
| 215 | k=i+1; \ |
| 216 | } \ |
| 217 | i++; \ |
| 218 | } \ |
| 219 | } |
| 220 | if (acl->acl_a || acl->acl_d) { |
| 221 | int j, k, i; |
| 222 | if (acl->acl_a) { i = 0; while (acl->acl_a[i]) { if (acl->acl_a[i++]=='\n') { n++; } } } |
| 223 | if (acl->acl_d) { i = 0; while (acl->acl_d[i]) { if (acl->acl_d[i++]=='\n') { n++; } } } |
| 224 | *values = checked_malloc(n * sizeof(char*)); |
| 225 | j = 0; |
| 226 | easy_posix_acl(acl_a, 'A') |
| 227 | easy_posix_acl(acl_d, 'D') |
| 228 | } |
| 229 | #endif |
| 230 | return n; |
| 231 | } |
| 232 | #endif |
| 233 | |
| 234 | char* get_file_type_stringcxx . . $ get_file_type_string(f109d7e0a0ca42b3).(mode_tcxx . . $ mode_t# mode) { |
| 235 | switch (mode & S_IFMTcxx . . $ `<external>/531885356569766532/stat.h:104:10`!) { |
| 236 | case S_IFREGcxx . . $ `<external>/531885356569766532/stat.h:108:10`!: return _cxx . . $ `include/locale-aide.h:33:9`!("File"); |
| 237 | case S_IFDIRcxx . . $ `<external>/531885356569766532/stat.h:105:10`!: return _cxx . . $ `include/locale-aide.h:33:9`!("Directory"); |
| 238 | #ifdef S_IFIFOcxx . . $ `<external>/531885356569766532/stat.h:110:11`! |
| 239 | case S_IFIFOcxx . . $ `<external>/531885356569766532/stat.h:110:11`!: return _cxx . . $ `include/locale-aide.h:33:9`!("FIFO"); |
| 240 | #endif |
| 241 | case S_IFLNKcxx . . $ `<external>/531885356569766532/stat.h:113:11`!: return _cxx . . $ `include/locale-aide.h:33:9`!("Link"); |
| 242 | case S_IFBLKcxx . . $ `<external>/531885356569766532/stat.h:107:10`!: return _cxx . . $ `include/locale-aide.h:33:9`!("Block device"); |
| 243 | case S_IFCHRcxx . . $ `<external>/531885356569766532/stat.h:106:10`!: return _cxx . . $ `include/locale-aide.h:33:9`!("Character device"); |
| 244 | #ifdef S_IFSOCKcxx . . $ `<external>/531885356569766532/stat.h:117:11`! |
| 245 | case S_IFSOCKcxx . . $ `<external>/531885356569766532/stat.h:117:11`!: return _cxx . . $ `include/locale-aide.h:33:9`!("Socket"); |
| 246 | #endif |
| 247 | #ifdef S_IFDOOR |
| 248 | case S_IFDOOR: return _("Door"); |
| 249 | #endif |
| 250 | #ifdef S_IFPORT |
| 251 | case S_IFPORT: return _("Port"); |
| 252 | #endif |
| 253 | default: return _cxx . . $ `include/locale-aide.h:33:9`!("Unknown file type"); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | static int cmp_urlcxx . . $ cmp_url(4d6c4d40bb1e144a).(url_tcxx . . $ url_t#* url1,url_tcxx . . $ url_t#* url2){ |
| 258 | return ((url1->typecxx . . $ url_t#type.==url2->typecxx . . $ url_t#type.)&&(strcmpcxx . . $ strcmp(5ae29d726ae57f88).(url1->valuecxx . . $ url_t#value.,url2->valuecxx . . $ url_t#value.)==0)); |
| 259 | } |
| 260 | |
| 261 | const char* get_report_level_stringcxx . . $ get_report_level_string(75b820ae76c41009).(REPORT_LEVELcxx . . $ REPORT_LEVEL# report_level) { |
| 262 | return report_level_arraycxx . . $ report_level_array.[report_level-1].namecxx . . $ report_level#name.; |
| 263 | } |
| 264 | |
| 265 | REPORT_LEVELcxx . . $ REPORT_LEVEL# get_report_levelcxx . . $ get_report_level(5aff053b5fa218f3).(char *str) { |
| 266 | struct report_levelcxx . . $ report_level# *level; |
| 267 | |
| 268 | for (level = report_level_arraycxx . . $ report_level_array.; level->report_levelcxx . . $ report_level#report_level. != 0; level++) { |
| 269 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, level->namecxx . . $ report_level#name.) == 0) { |
| 270 | return level->report_levelcxx . . $ report_level#report_level.; |
| 271 | } |
| 272 | } |
| 273 | return REPORT_LEVEL_UNKNOWNcxx . . $ REPORT_LEVEL_UNKNOWN.; |
| 274 | } |
| 275 | |
| 276 | static const char* get_report_format_stringcxx . . $ get_report_format_string(b519dee68bb82d64).(REPORT_FORMATcxx . . $ REPORT_FORMAT# report_format) { |
| 277 | return report_format_arraycxx . . $ report_format_array.[report_format-1].namecxx . . $ report_format#name.; |
| 278 | } |
| 279 | |
| 280 | REPORT_FORMATcxx . . $ REPORT_FORMAT# get_report_formatcxx . . $ get_report_format(286e75ce408cac52).(char *str) { |
| 281 | struct report_formatcxx . . $ report_format# *level; |
| 282 | |
| 283 | for (level = report_format_arraycxx . . $ report_format_array.; level->report_formatcxx . . $ report_format#report_format. != 0; level++) { |
| 284 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(str, level->namecxx . . $ report_format#name.) == 0) { |
| 285 | return level->report_formatcxx . . $ report_format#report_format.; |
| 286 | } |
| 287 | } |
| 288 | return REPORT_FORMAT_UNKNOWNcxx . . $ REPORT_FORMAT_UNKNOWN.; |
| 289 | } |
| 290 | |
| 291 | static void report_vprintfcxx . . $ report_vprintf(1c0574ac79fd3b42).(report_tcxx . . $ report_t#*, const char *, va_listcxx . . $ va_list#) |
| 292 | #ifdef __GNUC__cxx . . $ `<built-in>:8:9`! |
| 293 | __attribute__ ((format (printf, 2, 0))) |
| 294 | #endif |
| 295 | ; |
| 296 | |
| 297 | static void report_vprintfcxx . . $ report_vprintf(1c0574ac79fd3b42).(report_tcxx . . $ report_t#* r, const char *format, va_listcxx . . $ va_list# ap) { |
| 298 | int retval; |
| 299 | |
| 300 | if (!r->quietcxx . . $ report_t#quiet. || (r->naddcxx . . $ report_t#nadd. || r->nchgcxx . . $ report_t#nchg. || r->nremcxx . . $ report_t#nrem.)) { |
| 301 | switch ((r->urlcxx . . $ report_t#url.)->typecxx . . $ url_t#type.) { |
| 302 | #ifdef HAVE_SYSLOGcxx . . $ `./include/config.h:110:9`! |
| 303 | case url_syslogcxx . . $ url_syslog.: { |
| 304 | #ifdef HAVE_VSYSLOGcxx . . $ `./include/config.h:152:9`! |
| 305 | vsyslogcxx . . $ vsyslog(7aa579bceef62d01).(AIDE_SYSLOG_PRIORITYcxx . . $ `./include/config.h:23:9`!,format,ap); |
| 306 | #else |
| 307 | char buf[1024]; |
| 308 | vsnprintf(buf,1024,format,ap); |
| 309 | syslog(AIDE_SYSLOG_PRIORITY,"%s",buf); |
| 310 | #endif |
| 311 | break; |
| 312 | } |
| 313 | #endif |
| 314 | default : { |
| 315 | retval=vfprintfcxx . . $ vfprintf(bded311e54d67f9c).(r->fdcxx . . $ report_t#fd., format, ap); |
| 316 | if(retval==0) { |
| 317 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_ERRORcxx . . $ LOG_LEVEL_ERROR., "unable to write to '%s", (r->urlcxx . . $ report_t#url.)->valuecxx . . $ url_t#value.); |
| 318 | } |
| 319 | break; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | } |
| 324 | |
| 325 | } |
| 326 | |
| 327 | void report_printfcxx . . $ report_printf(4e012a91a5600c6).(report_tcxx . . $ report_t#* r, const char* error_msg, ...) { |
| 328 | va_listcxx . . $ va_list# ap; |
| 329 | |
| 330 | va_startcxx . . $ `<external>/8293021631987149590/stdarg.h:51:9`!(ap, error_msg); |
| 331 | report_vprintfcxx . . $ report_vprintf(1c0574ac79fd3b42).(r, error_msg, ap); |
| 332 | va_endcxx . . $ `<external>/8293021631987149590/stdarg.h:53:9`!(ap); |
| 333 | |
| 334 | } |
| 335 | |
| 336 | static int compare_report_t_by_report_levelcxx . . $ compare_report_t_by_report_level(9148c8c3ff42c9d8).(const void *n1, const void *n2) |
| 337 | { |
| 338 | const report_tcxx . . $ report_t# *x1 = n1; |
| 339 | const report_tcxx . . $ report_t# *x2 = n2; |
| 340 | return x2->levelcxx . . $ report_t#level. - x1->levelcxx . . $ report_t#level.; |
| 341 | } |
| 342 | |
| 343 | void log_report_urlscxx . . $ log_report_urls(acc15b7e06406d4e).(LOG_LEVELcxx . . $ LOG_LEVEL# log_level) { |
| 344 | listcxx . . $ list#* l = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 345 | |
| 346 | for (l=confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.; l; l=l->nextcxx . . $ list#next.) { |
| 347 | report_tcxx . . $ report_t#* r = l->datacxx . . $ list#data.; |
| 348 | |
| 349 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " %s%s%s (%p)", get_url_type_stringcxx . . $ get_url_type_string(6e06a7e3ceb1c24f).((r->urlcxx . . $ report_t#url.)->typecxx . . $ url_t#type.), (r->urlcxx . . $ report_t#url.)->valuecxx . . $ url_t#value.?":":"", (r->urlcxx . . $ report_t#url.)->valuecxx . . $ url_t#value.?(r->urlcxx . . $ report_t#url.)->valuecxx . . $ url_t#value.:"", (void*) r); |
| 350 | |
| 351 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " level: %s | format: %s | base16: %s | append: %s | quiet: %s | detailed_init: %s | summarize_changes: %s | grouped: %s", get_report_level_stringcxx . . $ get_report_level_string(75b820ae76c41009).(r->levelcxx . . $ report_t#level.), get_report_format_stringcxx . . $ get_report_format_string(b519dee68bb82d64).(r->formatcxx . . $ report_t#format.), btoacxx . . $ btoa(626eec357d49c77e).(r->base16cxx . . $ report_t#base16.), btoacxx . . $ btoa(626eec357d49c77e).(r->appendcxx . . $ report_t#append.), btoacxx . . $ btoa(626eec357d49c77e).(r->quietcxx . . $ report_t#quiet.), btoacxx . . $ btoa(626eec357d49c77e).(r->detailed_initcxx . . $ report_t#detailed_init.), btoacxx . . $ btoa(626eec357d49c77e).(r->summarize_changescxx . . $ report_t#summarize_changes.), btoacxx . . $ btoa(626eec357d49c77e).(r->groupedcxx . . $ report_t#grouped.)); |
| 352 | char *str; |
| 353 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " ignore_added_attrs: '%s'", str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, r->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.)); |
| 354 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 355 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " ignore_removed_attrs: '%s'", str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, r->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.)); |
| 356 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 357 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " ignore_changed_attrs: '%s'", str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, r->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.)); |
| 358 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 359 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(log_level, " force_attrs: '%s'", str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, r->force_attrscxx . . $ report_t#force_attrs.)); |
| 360 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 361 | #ifdef WITH_E2FSATTRS |
| 362 | log_msg(log_level, " ignore_e2fsattrs: '%s'", str = get_e2fsattrs_string(r->ignore_e2fsattrs, true, 0)); |
| 363 | free(str); |
| 364 | #endif |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | void print_report_config_optionscxx . . $ print_report_config_options(8fd66a0c554c67cb).(report_tcxx . . $ report_t# *report, void (*print_config_option)(report_tcxx . . $ report_t# *, config_optioncxx . . $ config_option#, const char*)) { |
| 369 | if(confcxx . . $ conf.->config_versioncxx . . $ db_config#config_version.) { |
| 370 | print_config_option(report, CONFIG_VERSIONcxx . . $ CONFIG_VERSION., confcxx . . $ conf.->config_versioncxx . . $ db_config#config_version.); |
| 371 | } |
| 372 | if (confcxx . . $ conf.->limitcxx . . $ db_config#limit. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 373 | print_config_option(report, LIMIT_CMDLINE_OPTIONcxx . . $ LIMIT_CMDLINE_OPTION., confcxx . . $ conf.->limitcxx . . $ db_config#limit.); |
| 374 | } |
| 375 | 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) { |
| 376 | print_config_option(report, ROOT_PREFIX_OPTIONcxx . . $ ROOT_PREFIX_OPTION., confcxx . . $ conf.->root_prefixcxx . . $ db_config#root_prefix.); |
| 377 | } |
| 378 | if (report->levelcxx . . $ report_t#level. != default_report_optionscxx . . $ default_report_options..levelcxx . . $ report_options#level.) { |
| 379 | print_config_option(report, REPORT_LEVEL_OPTIONcxx . . $ REPORT_LEVEL_OPTION., get_report_level_stringcxx . . $ get_report_level_string(75b820ae76c41009).(report->levelcxx . . $ report_t#level.)); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | void print_report_report_optionscxx . . $ print_report_report_options(8fd66a0c554c67cb).(report_tcxx . . $ report_t# *report, void (*print_config_option)(report_tcxx . . $ report_t# *, config_optioncxx . . $ config_option#, const char*)) { |
| 384 | char *str; |
| 385 | if (report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.) { |
| 386 | print_config_option(report, REPORT_IGNORE_ADDED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_ADDED_ATTRS_OPTION., str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.)); |
| 387 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 388 | } |
| 389 | if (report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.) { |
| 390 | print_config_option(report, REPORT_IGNORE_REMOVED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_REMOVED_ATTRS_OPTION., str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.)); |
| 391 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 392 | } |
| 393 | if (report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.) { |
| 394 | print_config_option(report, REPORT_IGNORE_CHANGED_ATTRS_OPTIONcxx . . $ REPORT_IGNORE_CHANGED_ATTRS_OPTION., str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.)); |
| 395 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 396 | } |
| 397 | if (report->force_attrscxx . . $ report_t#force_attrs. && report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_CHANGED_ATTRIBUTEScxx . . $ REPORT_LEVEL_CHANGED_ATTRIBUTES.) { |
| 398 | print_config_option(report, REPORT_FORCE_ATTRS_OPTIONcxx . . $ REPORT_FORCE_ATTRS_OPTION., str = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(0, report->force_attrscxx . . $ report_t#force_attrs.)); |
| 399 | freecxx . . $ free(5d22bdacc48458e8).(str); |
| 400 | } |
| 401 | #ifdef WITH_E2FSATTRS |
| 402 | if (report->ignore_e2fsattrs) { |
| 403 | print_config_option(report, REPORT_IGNORE_E2FSATTRS_OPTION, str = get_e2fsattrs_string(report->ignore_e2fsattrs, true, 0) ); |
| 404 | free(str); |
| 405 | } |
| 406 | #endif |
| 407 | |
| 408 | } |
| 409 | |
| 410 | char* get_summary_stringcxx . . $ get_summary_string(ec346f625076085b).(report_tcxx . . $ report_t#* report) { |
| 411 | if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!)) { |
| 412 | if (report->naddcxx . . $ report_t#nadd.||report->nremcxx . . $ report_t#nrem.||report->nchgcxx . . $ report_t#nchg.) { |
| 413 | if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!) { |
| 414 | return _cxx . . $ `include/locale-aide.h:33:9`!("AIDE found differences between database and filesystem!!"); |
| 415 | } else { |
| 416 | return _cxx . . $ `include/locale-aide.h:33:9`!("AIDE found differences between the two databases!!"); |
| 417 | } |
| 418 | } else { |
| 419 | if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_COMPAREcxx . . $ `include/db_config.h:49:9`!) { |
| 420 | return _cxx . . $ `include/locale-aide.h:33:9`!("AIDE found NO differences between database and filesystem. Looks okay!!"); |
| 421 | } else { |
| 422 | return _cxx . . $ `include/locale-aide.h:33:9`!("AIDE found NO differences between the two databases. Looks okay!!"); |
| 423 | } |
| 424 | } |
| 425 | } else { |
| 426 | return _cxx . . $ `include/locale-aide.h:33:9`!("AIDE successfully initialized database."); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! add_report_urlcxx . . $ add_report_url(b6d92bad158dd3b).(url_tcxx . . $ url_t#* url, int linenumber, char* filename, char* linebuf) { |
| 431 | listcxx . . $ list#* report_urls=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 432 | |
| 433 | if(url==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 434 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 435 | } else if (url->typecxx . . $ url_t#type.==url_stdincxx . . $ url_stdin.) { |
| 436 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_ERROR, "unsupported report URL-type: '%s'", get_url_type_string(url->type)) |
| 437 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 438 | } |
| 439 | |
| 440 | for(report_urls=confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.; report_urls ; report_urls=report_urls->nextcxx . . $ list#next.) { |
| 441 | if (cmp_urlcxx . . $ cmp_url(4d6c4d40bb1e144a).((url_tcxx . . $ url_t#*) report_urls->datacxx . . $ list#data., url)) { |
| 442 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_WARNING, "report_url '%s' already defined (ignoring) ",url->value) |
| 443 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | |
| 448 | report_tcxx . . $ report_t#* r = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(sizeof(report_tcxx . . $ report_t#)); |
| 449 | r->urlcxx . . $ report_t#url. = url; |
| 450 | r->fdcxx . . $ report_t#fd. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 451 | r->levelcxx . . $ report_t#level. = confcxx . . $ conf.->report_levelcxx . . $ db_config#report_level.; |
| 452 | r->formatcxx . . $ report_t#format. = confcxx . . $ conf.->report_formatcxx . . $ db_config#report_format.; |
| 453 | |
| 454 | r->detailed_initcxx . . $ report_t#detailed_init. = confcxx . . $ conf.->report_detailed_initcxx . . $ db_config#report_detailed_init.; |
| 455 | r->base16cxx . . $ report_t#base16. = confcxx . . $ conf.->report_base16cxx . . $ db_config#report_base16.; |
| 456 | r->quietcxx . . $ report_t#quiet. = confcxx . . $ conf.->report_quietcxx . . $ db_config#report_quiet.; |
| 457 | r->appendcxx . . $ report_t#append. = confcxx . . $ conf.->report_appendcxx . . $ db_config#report_append.; |
| 458 | r->summarize_changescxx . . $ report_t#summarize_changes. = confcxx . . $ conf.->report_summarize_changescxx . . $ db_config#report_summarize_changes.; |
| 459 | r->groupedcxx . . $ report_t#grouped. = confcxx . . $ conf.->report_groupedcxx . . $ db_config#report_grouped.; |
| 460 | |
| 461 | r->ignore_added_attrscxx . . $ report_t#ignore_added_attrs. = confcxx . . $ conf.->report_ignore_added_attrscxx . . $ db_config#report_ignore_added_attrs.; |
| 462 | r->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs. = confcxx . . $ conf.->report_ignore_removed_attrscxx . . $ db_config#report_ignore_removed_attrs.; |
| 463 | r->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs. = confcxx . . $ conf.->report_ignore_changed_attrscxx . . $ db_config#report_ignore_changed_attrs.; |
| 464 | r->force_attrscxx . . $ report_t#force_attrs. = confcxx . . $ conf.->report_force_attrscxx . . $ db_config#report_force_attrs.; |
| 465 | |
| 466 | r->ntotalcxx . . $ report_t#ntotal. = 0; |
| 467 | r->naddcxx . . $ report_t#nadd. = 0; |
| 468 | r->nremcxx . . $ report_t#nrem. = 0; |
| 469 | r->nchgcxx . . $ report_t#nchg. = 0; |
| 470 | |
| 471 | r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 472 | r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries. = 0; |
| 473 | |
| 474 | r->linenumbercxx . . $ report_t#linenumber. = linenumber; |
| 475 | r->filenamecxx . . $ report_t#filename. = filename; |
| 476 | r->linebufcxx . . $ report_t#linebuf. = linebuf?checked_strdupcxx . . $ checked_strdup(42228c1987407501).(linebuf):NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 477 | |
| 478 | #ifdef WITH_E2FSATTRS |
| 479 | r->ignore_e2fsattrs = conf->report_ignore_e2fsattrs; |
| 480 | #endif |
| 481 | |
| 482 | log_msgcxx . . $ log_msg(e585f2b5603b5bf9).(LOG_LEVEL_DEBUGcxx . . $ LOG_LEVEL_DEBUG., _cxx . . $ `include/locale-aide.h:33:9`!("add report_url (%p): url(: %s, level: %d"), (void*) r, (r->urlcxx . . $ report_t#url.)->rawcxx . . $ url_t#raw., r->levelcxx . . $ report_t#level.); |
| 483 | confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.=list_sorted_insertcxx . . $ list_sorted_insert(6d36e65c849df1d).(confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls., (void*) r, compare_report_t_by_report_levelcxx . . $ compare_report_t_by_report_level(9148c8c3ff42c9d8).); |
| 484 | LOG_CONFIG_FORMAT_LINEcxx . . $ `include/log.h:59:9`!(LOG_LEVEL_CONFIG, "set 'report_url' to '%s'", url->raw) |
| 485 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 486 | |
| 487 | } |
| 488 | |
| 489 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! init_report_urlscxx . . $ init_report_urls(c9857a73d68e59ba).(void) { |
| 490 | listcxx . . $ list#* l = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 491 | |
| 492 | for (l=confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.; l; l=l->nextcxx . . $ list#next.) { |
| 493 | report_tcxx . . $ report_t#* r = l->datacxx . . $ list#data.; |
| 494 | switch (r->urlcxx . . $ report_t#url.->typecxx . . $ url_t#type.) { |
| 495 | #ifdef HAVE_SYSLOGcxx . . $ `./include/config.h:110:9`! |
| 496 | int sfac; |
| 497 | case url_syslogcxx . . $ url_syslog.: { |
| 498 | sfac=syslog_facility_lookupcxx . . $ syslog_facility_lookup(1ef8e6ec083aabb9).(r->urlcxx . . $ report_t#url.->valuecxx . . $ url_t#value.); |
| 499 | openlogcxx . . $ openlog(7b85637613228108).(AIDE_IDENTcxx . . $ `./include/config.h:14:9`!,AIDE_LOGOPTcxx . . $ `./include/config.h:17:9`!, sfac); |
| 500 | break; |
| 501 | } |
| 502 | #endif |
| 503 | default : { |
| 504 | r->fdcxx . . $ report_t#fd.=be_initcxx . . $ be_init(d7a38dc26e275cb4).(r->urlcxx . . $ report_t#url., falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, r->appendcxx . . $ report_t#append., r->linenumbercxx . . $ report_t#linenumber., r->filenamecxx . . $ report_t#filename., r->linebufcxx . . $ report_t#linebuf., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 505 | if(r->fdcxx . . $ report_t#fd.==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 506 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 507 | } |
| 508 | break; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | } |
| 513 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 514 | } |
| 515 | |
| 516 | static int attributes2arraycxx . . $ attributes2array(4e30e3ba3b96057b).(DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attrs, char* **values) { |
| 517 | *values = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 518 | |
| 519 | int n = 0; |
| 520 | for (ATTRIBUTEcxx . . $ ATTRIBUTE# i = 0; i < num_attrscxx . . $ num_attrs.; ++i) { |
| 521 | if (attributescxx . . $ attributes.[i].db_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#db_name. && (1LLU<<i)&attrs) { |
| 522 | n++; |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | *values = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(n * sizeof(char*)); |
| 527 | n = 0; |
| 528 | for (ATTRIBUTEcxx . . $ ATTRIBUTE# i = 0; i < num_attrscxx . . $ num_attrs.; ++i) { |
| 529 | if (attributescxx . . $ attributes.[i].db_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#db_name. && (1LLU<<i)&attrs) { |
| 530 | size_t len = strlencxx . . $ strlen(751346f8406fd082).(attributescxx . . $ attributes.[i].db_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#db_name.)+1; |
| 531 | (*values)[n] = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(len * sizeof(char)); |
| 532 | snprintfcxx . . $ snprintf(ea502d73e74c754c).((*values)[n], len, "%s", attributescxx . . $ attributes.[i].db_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#db_name.); |
| 533 | n++; |
| 534 | } |
| 535 | } |
| 536 | return n; |
| 537 | } |
| 538 | |
| 539 | int get_attribute_valuescxx . . $ get_attribute_values(daa3275b1ddcb9d1).(DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr, db_linecxx . . $ db_line#* line, |
| 540 | char* **values, report_tcxx . . $ report_t# *r) { |
| 541 | |
| 542 | #define easy_stringcxx . . $ `src/report.c:542:9`!(s) \ |
| 543 | l = strlen(s)+1; \ |
| 544 | *values[0] = checked_malloc(l * sizeof (char)); \ |
| 545 | snprintf(*values[0], l, "%s",s); |
| 546 | |
| 547 | #define easy_numbercxx . . $ `src/report.c:547:9`!(a,b,c) \ |
| 548 | } else if (a&attr) { \ |
| 549 | l = 2+floor(line->b?log10(line->b):0); \ |
| 550 | *values[0] = checked_malloc(l * sizeof (char)); \ |
| 551 | snprintf(*values[0], l, c,line->b); |
| 552 | |
| 553 | #define easy_timecxx . . $ `src/report.c:553:9`!(a,b) \ |
| 554 | } else if (a&attr) { \ |
| 555 | *values[0] = get_time_string(&(line->b)); \ |
| 556 | |
| 557 | if (line!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! && attr&get_hashescxx . . $ get_hashes(48b6f722ee11d9bd).(truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!)) { |
| 558 | for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) { |
| 559 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(hashsums[i].attribute)&attr) { |
| 560 | if (line->hashsumscxx . . $ db_line#hashsums.[i]) { |
| 561 | *values = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(1 * sizeof (char*)); |
| 562 | if (r==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! || r->base16cxx . . $ report_t#base16.) { |
| 563 | *values[0] = byte_to_base16cxx . . $ byte_to_base16(422350ec2b3c7f).(line->hashsumscxx . . $ db_line#hashsums.[i], hashsumscxx . . $ hashsums.[i].lengthcxx . . $ $anonymous_type_76c4ad3622101c33_0#length.); |
| 564 | } else { |
| 565 | *values[0] = encode_base64cxx . . $ encode_base64(ea9ec9b3a5ad8ddb).(line->hashsumscxx . . $ db_line#hashsums.[i], hashsumscxx . . $ hashsums.[i].lengthcxx . . $ $anonymous_type_76c4ad3622101c33_0#length.); |
| 566 | } |
| 567 | return 1; |
| 568 | } else { |
| 569 | return 0; |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_attr)&attr) { |
| 576 | return attributes2arraycxx . . $ attributes2array(4e30e3ba3b96057b).(line->attrcxx . . $ db_line#attr., values); |
| 577 | } else |
| 578 | if (line==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! || !(line->attrcxx . . $ db_line#attr.&attr)) { |
| 579 | *values = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 580 | return 0; |
| 581 | #ifdef WITH_ACL |
| 582 | } else if (ATTR(attr_acl)&attr) { |
| 583 | return acl2array(line->acl, values); |
| 584 | #endif |
| 585 | #ifdef WITH_XATTR |
| 586 | } else if (ATTR(attr_xattrs)&attr) { |
| 587 | return xattrs2array(line->xattrs, values); |
| 588 | #endif |
| 589 | } else { |
| 590 | int l; |
| 591 | *values = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(1 * sizeof (char*)); |
| 592 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ftype)&attr) { |
| 593 | easy_stringcxx . . $ `src/report.c:542:9`!(get_file_type_string(line->perm)) |
| 594 | #ifdef HAVE_FSTYPEcxx . . $ `./include/config.h:53:9`! |
| 595 | } else if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_fs_type)&attr) { |
| 596 | *values[0] = get_fs_type_string_from_magiccxx . . $ get_fs_type_string_from_magic(4b58d6ff543a4736).(line->fs_typecxx . . $ db_line#fs_type.); |
| 597 | #endif |
| 598 | } else if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkname)&attr) { |
| 599 | easy_stringcxx . . $ `src/report.c:542:9`!(line->linkname) |
| 600 | easy_numbercxx . . $ `src/report.c:547:9`!((ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)|ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)),size,"%lli") |
| 601 | } else if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_perm)&attr) { |
| 602 | *values[0] = perm_to_charcxx . . $ perm_to_char(f109d7e0a0ca42b3).(line->permcxx . . $ db_line#perm.); |
| 603 | easy_timecxx . . $ `src/report.c:553:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_atime),atime) |
| 604 | easy_timecxx . . $ `src/report.c:553:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_mtime),mtime) |
| 605 | easy_timecxx . . $ `src/report.c:553:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_ctime),ctime) |
| 606 | easy_numbercxx . . $ `src/report.c:547:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_bcount),bcount,"%lli") |
| 607 | easy_numbercxx . . $ `src/report.c:547:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_uid),uid,"%li") |
| 608 | easy_numbercxx . . $ `src/report.c:547:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_gid),gid,"%li") |
| 609 | easy_numbercxx . . $ `src/report.c:547:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_inode),inode,"%li") |
| 610 | easy_numbercxx . . $ `src/report.c:547:9`!(ATTRcxx . . $ `include/attributes.h:28:9`!(attr_linkcount),nlink,"%li") |
| 611 | #ifdef WITH_SELINUX |
| 612 | } else if (ATTR(attr_selinux)&attr) { |
| 613 | easy_string(line->cntx) |
| 614 | #endif |
| 615 | #ifdef WITH_E2FSATTRS |
| 616 | } else if (ATTR(attr_e2fsattrs)&attr) { |
| 617 | *values[0]=get_e2fsattrs_string(line->e2fsattrs, false, r?r->ignore_e2fsattrs:0L); |
| 618 | #endif |
| 619 | #ifdef WITH_CAPABILITIES |
| 620 | } else if (ATTR(attr_capabilities)&attr) { |
| 621 | easy_string(line->capabilities) |
| 622 | #endif |
| 623 | } else { |
| 624 | easy_stringcxx . . $ `src/report.c:542:9`!("unknown attribute") |
| 625 | } |
| 626 | return 1; |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | char* get_summarize_changes_stringcxx . . $ get_summarize_changes_string(995b9c65a0e968c6).(report_tcxx . . $ report_t#* report, seltreecxx . . $ seltree#* node) { |
| 631 | int i; |
| 632 | char* summary = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64). ((report_attrs_order_lengthcxx . . $ report_attrs_order_length.+1) * sizeof (char)); |
| 633 | if (node->checkedcxx . . $ seltree#checked.&(NODE_ADDEDcxx . . $ `include/db.h:60:9`!|NODE_REMOVEDcxx . . $ `include/db.h:61:9`!)) { |
| 634 | summary[0]=get_f_type_char_from_permcxx . . $ get_f_type_char_from_perm(1cb8f0426fc6e5a2).(((node->checkedcxx . . $ seltree#checked.&NODE_REMOVEDcxx . . $ `include/db.h:61:9`!)?node->old_datacxx . . $ seltree#old_data.:node->new_datacxx . . $ seltree#new_data.)->permcxx . . $ db_line#perm.); |
| 635 | for(i=1;i<report_attrs_order_lengthcxx . . $ report_attrs_order_length.;i++){ |
| 636 | summary[i]=(node->checkedcxx . . $ seltree#checked.&NODE_ADDEDcxx . . $ `include/db.h:60:9`!)?'+':'-'; |
| 637 | } |
| 638 | } else if (node->checkedcxx . . $ seltree#checked.&NODE_CHANGEDcxx . . $ `include/db.h:62:9`!) { |
| 639 | for(i=0;i<report_attrs_order_lengthcxx . . $ report_attrs_order_length.;i++) { |
| 640 | char c, u, a, d, g, s; |
| 641 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attrs = get_attrscxx . . $ get_attrs(e520b8502d5c70a7).(report_attrs_ordercxx . . $ report_attrs_order.[i]); |
| 642 | c = attributescxx . . $ attributes.[report_attrs_ordercxx . . $ report_attrs_order.[i]].summary_charcxx . . $ $anonymous_type_bb8296fff58edf70_1#summary_char.; |
| 643 | d = '-'; a = '+'; g = ':'; u = '.'; s = ' '; |
| 644 | switch (i) { |
| 645 | case 0: |
| 646 | summary[i]=get_f_type_char_from_permcxx . . $ get_f_type_char_from_perm(1cb8f0426fc6e5a2).((node->new_datacxx . . $ seltree#new_data.)->permcxx . . $ db_line#perm.); |
| 647 | continue; |
| 648 | case 2: |
| 649 | if (attrs&(node->changed_attrscxx . . $ seltree#changed_attrs.&(~(report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.))) && (node->old_datacxx . . $ seltree#old_data.)->sizecxx . . $ db_line#size. > (node->new_datacxx . . $ seltree#new_data.)->sizecxx . . $ db_line#size.) { |
| 650 | c = '<'; |
| 651 | } |
| 652 | u = '='; |
| 653 | break; |
| 654 | } |
| 655 | if (attrs&node->changed_attrscxx . . $ seltree#changed_attrs.&(report->force_attrscxx . . $ report_t#force_attrs.|(~(report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.)))) { |
| 656 | summary[i]=c; |
| 657 | } else if (attrs&((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&~((node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.)&(report->force_attrscxx . . $ report_t#force_attrs.|~(report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.)))) { |
| 658 | summary[i]=d; |
| 659 | } else if (attrs&~((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.)&(node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.&(report->force_attrscxx . . $ report_t#force_attrs.|~(report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.))) { |
| 660 | summary[i]=a; |
| 661 | } else if (attrs& ( |
| 662 | (((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&~((node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.)&report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.))| |
| 663 | (~((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.)&(node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.&report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.)| |
| 664 | (((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&(node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.)&report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.) |
| 665 | ) ) { |
| 666 | summary[i]=g; |
| 667 | } else if (attrs&((node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&(node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.)) { |
| 668 | summary[i]=u; |
| 669 | } else { |
| 670 | summary[i]=s; |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | summary[report_attrs_order_lengthcxx . . $ report_attrs_order_length.]='\0'; |
| 675 | return summary; |
| 676 | } |
| 677 | |
| 678 | |
| 679 | |
| 680 | static DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! get_report_attributescxx . . $ get_report_attributes(e767fc3f7270ec38).(seltreecxx . . $ seltree#* node, report_tcxx . . $ report_t# *report) { |
| 681 | db_linecxx . . $ db_line#* oline = node->old_datacxx . . $ seltree#old_data.; |
| 682 | db_linecxx . . $ db_line#* nline = node->new_datacxx . . $ seltree#new_data.; |
| 683 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attrs = node->changed_attrscxx . . $ seltree#changed_attrs.; |
| 684 | |
| 685 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! report_attrs, changed_attrs; |
| 686 | |
| 687 | changed_attrs = ~(report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.)&(attrs |
| 688 | #ifdef WITH_E2FSATTRS |
| 689 | & (~ATTR(attr_e2fsattrs) | ( (attrs&ATTR(attr_e2fsattrs) && oline != NULL && nline != NULL && ~(report->ignore_e2fsattrs)&(oline->e2fsattrs^nline->e2fsattrs)) ? ATTR(attr_e2fsattrs) : 0 ) ) |
| 690 | #endif |
| 691 | ); |
| 692 | |
| 693 | report_attrs = 0LL; |
| 694 | report_attrs |= changed_attrs; |
| 695 | |
| 696 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_ADDED_REMOVED_ATTRIBUTEScxx . . $ REPORT_LEVEL_ADDED_REMOVED_ATTRIBUTES. && oline&&nline) { |
| 697 | report_attrs |= ~(oline->attrcxx . . $ db_line#attr.)&nline->attrcxx . . $ db_line#attr.&~(report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.); /* added attributes */ |
| 698 | report_attrs |= oline->attrcxx . . $ db_line#attr.&~(nline->attrcxx . . $ db_line#attr.)&~(report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.); /* removed attributes */ |
| 699 | } |
| 700 | report_attrs |= report_attrs?report->force_attrscxx . . $ report_t#force_attrs.:0; /* forced attributes */ |
| 701 | |
| 702 | return report_attrs; |
| 703 | } |
| 704 | |
| 705 | static void terse_reportcxx . . $ terse_report(373bb888e3180625).(seltreecxx . . $ seltree#* node) { |
| 706 | listcxx . . $ list#* l = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 707 | |
| 708 | pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 709 | for (l=confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.; l; l=l->nextcxx . . $ list#next.) { |
| 710 | report_tcxx . . $ report_t#* r = l->datacxx . . $ list#data.; |
| 711 | |
| 712 | if ((node->checkedcxx . . $ seltree#checked.&(DB_OLDcxx . . $ `include/db.h:57:9`!|DB_NEWcxx . . $ `include/db.h:59:9`!)) != 0) { |
| 713 | r->ntotalcxx . . $ report_t#ntotal. += ((node->checkedcxx . . $ seltree#checked.&DB_NEWcxx . . $ `include/db.h:59:9`!) != 0); |
| 714 | if (!(node->checkedcxx . . $ seltree#checked.&DB_OLDcxx . . $ `include/db.h:57:9`!)){ |
| 715 | /* File is in new db but not old. (ADDED) */ |
| 716 | /* unless it was moved in */ |
| 717 | if ( (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`! && r->detailed_initcxx . . $ report_t#detailed_init.) || (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!) && !((node->checkedcxx . . $ seltree#checked.&NODE_ALLOW_NEWcxx . . $ `include/db.h:67:9`!)||(node->checkedcxx . . $ seltree#checked.&NODE_MOVED_INcxx . . $ `include/db.h:66:9`!))) ) { |
| 718 | #ifdef WITH_AUDIT |
| 719 | nadd++; |
| 720 | #endif |
| 721 | r->naddcxx . . $ report_t#nadd.++; |
| 722 | node->checkedcxx . . $ seltree#checked.|=NODE_ADDEDcxx . . $ `include/db.h:60:9`!; |
| 723 | } |
| 724 | } else if (!(node->checkedcxx . . $ seltree#checked.&DB_NEWcxx . . $ `include/db.h:59:9`!)){ |
| 725 | /* File is in old db but not new. (REMOVED) */ |
| 726 | /* unless it was moved out */ |
| 727 | if (!((node->checkedcxx . . $ seltree#checked.&NODE_ALLOW_RMcxx . . $ `include/db.h:68:9`!)||(node->checkedcxx . . $ seltree#checked.&NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!))) { |
| 728 | #ifdef WITH_AUDIT |
| 729 | nrem++; |
| 730 | #endif |
| 731 | r->nremcxx . . $ report_t#nrem.++; |
| 732 | node->checkedcxx . . $ seltree#checked.|=NODE_REMOVEDcxx . . $ `include/db.h:61:9`!; |
| 733 | } |
| 734 | } else if ((node->old_datacxx . . $ seltree#old_data.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)&&(node->new_datacxx . . $ seltree#new_data.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)){ |
| 735 | /* File is in both db's and the data is still there. (CHANGED) */ |
| 736 | if (!(node->checkedcxx . . $ seltree#checked.&(NODE_MOVED_INcxx . . $ `include/db.h:66:9`!|NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!))){ |
| 737 | if (r->levelcxx . . $ report_t#level. >= REPORT_LEVEL_LIST_ENTRIEScxx . . $ REPORT_LEVEL_LIST_ENTRIES. |
| 738 | && ((node->old_datacxx . . $ seltree#old_data.->attrcxx . . $ db_line#attr.&~(r->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.))^(node->new_datacxx . . $ seltree#new_data.->attrcxx . . $ db_line#attr.&~(r->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.)))&((node->old_datacxx . . $ seltree#old_data.->attrcxx . . $ db_line#attr.)^(node->new_datacxx . . $ seltree#new_data.->attrcxx . . $ db_line#attr.)) ) { |
| 739 | r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries. = checked_realloccxx . . $ checked_realloc(417ab160f6baadc6).(r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries., (r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.+1) * sizeof(diff_attrs_entrycxx . . $ diff_attrs_entry#)); |
| 740 | r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.].entrycxx . . $ diff_attrs_entry#entry. = node->old_datacxx . . $ seltree#old_data.->filenamecxx . . $ db_line#filename.; |
| 741 | r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.].old_attrscxx . . $ diff_attrs_entry#old_attrs. = node->old_datacxx . . $ seltree#old_data.->attrcxx . . $ db_line#attr.&~(r->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.); |
| 742 | r->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.].new_attrscxx . . $ diff_attrs_entry#new_attrs. = node->new_datacxx . . $ seltree#new_data.->attrcxx . . $ db_line#attr.&~(r->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.); |
| 743 | r->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.++; |
| 744 | } |
| 745 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! changed_attrs = (node->changed_attrscxx . . $ seltree#changed_attrs.)&~(r->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.); |
| 746 | if (changed_attrs |
| 747 | #ifdef WITH_E2FSATTRS |
| 748 | &~ATTR(attr_e2fsattrs) || (changed_attrs&ATTR(attr_e2fsattrs) && ~(r->ignore_e2fsattrs)&(node->old_data->e2fsattrs^node->new_data->e2fsattrs)) |
| 749 | #endif |
| 750 | ) { |
| 751 | r->nchgcxx . . $ report_t#nchg.++; |
| 752 | node->checkedcxx . . $ seltree#checked.|=NODE_CHANGEDcxx . . $ `include/db.h:62:9`!; |
| 753 | } |
| 754 | #ifdef WITH_AUDIT |
| 755 | nchg++; |
| 756 | #endif |
| 757 | }else if (!((node->checkedcxx . . $ seltree#checked.&NODE_ALLOW_NEWcxx . . $ `include/db.h:67:9`!)||(node->checkedcxx . . $ seltree#checked.&NODE_MOVED_INcxx . . $ `include/db.h:66:9`!))) { |
| 758 | #ifdef WITH_AUDIT |
| 759 | nadd++; |
| 760 | #endif |
| 761 | r->naddcxx . . $ report_t#nadd.++; |
| 762 | node->checkedcxx . . $ seltree#checked.|=NODE_ADDEDcxx . . $ `include/db.h:60:9`!; |
| 763 | }else if (!((node->checkedcxx . . $ seltree#checked.&NODE_ALLOW_RMcxx . . $ `include/db.h:68:9`!)||(node->checkedcxx . . $ seltree#checked.&NODE_MOVED_OUTcxx . . $ `include/db.h:65:9`!))) { |
| 764 | #ifdef WITH_AUDIT |
| 765 | nrem++; |
| 766 | #endif |
| 767 | r->nremcxx . . $ report_t#nrem.++; |
| 768 | node->checkedcxx . . $ seltree#checked.|=NODE_REMOVEDcxx . . $ `include/db.h:61:9`!; |
| 769 | } |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | added_entries_reportedcxx . . $ added_entries_reported. |= r->naddcxx . . $ report_t#nadd. != 0; |
| 774 | removed_entries_reportedcxx . . $ removed_entries_reported. |= r->nremcxx . . $ report_t#nrem. != 0; |
| 775 | changed_entries_reportedcxx . . $ changed_entries_reported. |= r->nchgcxx . . $ report_t#nchg. != 0; |
| 776 | } |
| 777 | |
| 778 | for(tree_nodecxx . . $ tree_node# *x = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).(node->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)) { |
| 779 | terse_reportcxx . . $ terse_report(373bb888e3180625).(tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(x)); |
| 780 | } |
| 781 | pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 782 | } |
| 783 | |
| 784 | void print_report_entriescxx . . $ print_report_entries(f8d8678ee3db360e).(report_tcxx . . $ report_t# *report, seltreecxx . . $ seltree#* node, const int node_status, void (*print_line)(report_tcxx . . $ report_t#*, char*, int, seltreecxx . . $ seltree#*)) { |
| 785 | |
| 786 | pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 787 | if (node->checkedcxx . . $ seltree#checked.&node_status) { |
| 788 | if (!(node->changed_attrscxx . . $ seltree#changed_attrs.) || ~(report->ignore_changed_attrscxx . . $ report_t#ignore_changed_attrs.)&(node->changed_attrscxx . . $ seltree#changed_attrs. |
| 789 | #ifdef WITH_E2FSATTRS |
| 790 | & (~ATTR(attr_e2fsattrs) | (node->changed_attrs&ATTR(attr_e2fsattrs) && ~(report->ignore_e2fsattrs)&(node->old_data->e2fsattrs^node->new_data->e2fsattrs)?ATTR(attr_e2fsattrs):0)) |
| 791 | #endif |
| 792 | )) { |
| 793 | print_line(report, ((node->checkedcxx . . $ seltree#checked.&NODE_REMOVEDcxx . . $ `include/db.h:61:9`!)?node->old_datacxx . . $ seltree#old_data.:node->new_datacxx . . $ seltree#new_data.)->filenamecxx . . $ db_line#filename., node->checkedcxx . . $ seltree#checked., node); |
| 794 | } |
| 795 | |
| 796 | } |
| 797 | for(tree_nodecxx . . $ tree_node# *x = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).(node->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)) { |
| 798 | print_report_entriescxx . . $ print_report_entries(f8d8678ee3db360e).(report, tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(x), node_status, print_line); |
| 799 | } |
| 800 | pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 801 | } |
| 802 | |
| 803 | void print_dbline_attrscxx . . $ print_dbline_attrs(74750e9842f268de).(report_tcxx . . $ report_t# * report, db_linecxx . . $ db_line#* oline, db_linecxx . . $ db_line#* nline, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! report_attrs, void (*print_attribute)(report_tcxx . . $ report_t# *, db_linecxx . . $ db_line#*, db_linecxx . . $ db_line#*, ATTRIBUTEcxx . . $ ATTRIBUTE#)) { |
| 804 | for (int j=0; j < report_attrs_order_lengthcxx . . $ report_attrs_order_length.; ++j) { |
| 805 | switch(report_attrs_ordercxx . . $ report_attrs_order.[j]) { |
| 806 | case attr_allhashsumscxx . . $ attr_allhashsums.: |
| 807 | for (int i = 0 ; i < num_hashescxx . . $ num_hashes. ; ++i) { |
| 808 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(hashsums[i].attribute)&report_attrs) { print_attribute(report, oline, nline, hashsumscxx . . $ hashsums.[i].attributecxx . . $ $anonymous_type_76c4ad3622101c33_0#attribute.); } |
| 809 | } |
| 810 | break; |
| 811 | case attr_sizecxx . . $ attr_size.: |
| 812 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_size)&report_attrs) { print_attribute(report, oline, nline, attr_sizecxx . . $ attr_size.); } |
| 813 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(attr_sizeg)&report_attrs) { print_attribute(report, oline, nline, attr_sizegcxx . . $ attr_sizeg.); } |
| 814 | break; |
| 815 | default: |
| 816 | if (ATTRcxx . . $ `include/attributes.h:28:9`!(report_attrs_order[j])&report_attrs) { print_attribute(report, oline, nline, report_attrs_ordercxx . . $ report_attrs_order.[j]); } |
| 817 | break; |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | |
| 822 | |
| 823 | void print_databases_attrscxx . . $ print_databases_attrs(e6fbbe7f0ff0be64).(report_tcxx . . $ report_t# *report, void (*print_database_attributes)(report_tcxx . . $ report_t# *, db_linecxx . . $ db_line#*)) { |
| 824 | if (confcxx . . $ conf.->database_incxx . . $ db_config#database_in..db_linecxx . . $ database#db_line.) { |
| 825 | print_database_attributes(report, confcxx . . $ conf.->database_incxx . . $ db_config#database_in..db_linecxx . . $ database#db_line.); |
| 826 | } |
| 827 | if (confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..db_linecxx . . $ database#db_line.) { |
| 828 | print_database_attributes(report, confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..db_linecxx . . $ database#db_line.); |
| 829 | } |
| 830 | if (confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..db_linecxx . . $ database#db_line.) { |
| 831 | print_database_attributes(report, confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..db_linecxx . . $ database#db_line.); |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | void print_report_detailscxx . . $ print_report_details(c1b9a86155df1be7).(report_tcxx . . $ report_t# *report, seltreecxx . . $ seltree#* node, void (*print_attributes)(report_tcxx . . $ report_t# *, db_linecxx . . $ db_line#*, db_linecxx . . $ db_line#*, DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`!)) { |
| 836 | pthread_rwlock_rdlockcxx . . $ pthread_rwlock_rdlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 837 | if (node->checkedcxx . . $ seltree#checked.&NODE_CHANGEDcxx . . $ `include/db.h:62:9`!) { |
| 838 | print_attributes(report, node->old_datacxx . . $ seltree#old_data., node->new_datacxx . . $ seltree#new_data., get_report_attributescxx . . $ get_report_attributes(e767fc3f7270ec38).(node, report)); |
| 839 | } |
| 840 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_ADDED_REMOVED_ENTRIEScxx . . $ REPORT_LEVEL_ADDED_REMOVED_ENTRIES.) { |
| 841 | if (node->checkedcxx . . $ seltree#checked.&NODE_ADDEDcxx . . $ `include/db.h:60:9`!) { |
| 842 | print_attributes(report, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, node->new_datacxx . . $ seltree#new_data., (node->new_datacxx . . $ seltree#new_data.)->attrcxx . . $ db_line#attr.&~(report->ignore_added_attrscxx . . $ report_t#ignore_added_attrs.)); |
| 843 | } |
| 844 | if (node->checkedcxx . . $ seltree#checked.&NODE_REMOVEDcxx . . $ `include/db.h:61:9`!) { |
| 845 | print_attributes(report, node->old_datacxx . . $ seltree#old_data., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, (node->old_datacxx . . $ seltree#old_data.)->attrcxx . . $ db_line#attr.&~(report->ignore_removed_attrscxx . . $ report_t#ignore_removed_attrs.)); |
| 846 | } |
| 847 | } |
| 848 | for(tree_nodecxx . . $ tree_node# *x = tree_walk_firstcxx . . $ tree_walk_first(29fe63215e0d1f08).(node->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)) { |
| 849 | print_report_detailscxx . . $ print_report_details(c1b9a86155df1be7).(report, tree_get_datacxx . . $ tree_get_data(3ed80db4a2c90a05).(x), print_attributes); |
| 850 | } |
| 851 | pthread_rwlock_unlockcxx . . $ pthread_rwlock_unlock(e530de6d038c3578).(&node->rwlockcxx . . $ seltree#rwlock.); |
| 852 | } |
| 853 | |
| 854 | #ifdef WITH_AUDIT |
| 855 | /* Something changed, send audit anomaly message */ |
| 856 | void send_audit_report(void) |
| 857 | { |
| 858 | if(nadd!=0||nrem!=0||nchg!=0){ |
| 859 | int fd=audit_open(); |
| 860 | if (fd>=0){ |
| 861 | char msg[64]; |
| 862 | |
| 863 | snprintf(msg, sizeof(msg), "added=%ld removed=%ld changed=%ld", |
| 864 | nadd, nrem, nchg); |
| 865 | |
| 866 | if (audit_log_user_message(fd, AUDIT_ANOM_RBAC_INTEGRITY_FAIL, |
| 867 | msg, NULL, NULL, NULL, 0)<=0) |
| 868 | #ifdef HAVE_SYSLOG |
| 869 | syslog(LOG_ERR, "Failed sending audit message:%s", msg); |
| 870 | #else |
| 871 | ; |
| 872 | #endif |
| 873 | close(fd); |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | #endif /* WITH_AUDIT */ |
| 878 | |
| 879 | |
| 880 | static void print_reportcxx . . $ print_report(9d31da909e5050e9).(report_tcxx . . $ report_t# * report, seltreecxx . . $ seltree# * node, report_format_modulecxx . . $ report_format_module# module) { |
| 881 | if (module.print_report_headercxx . . $ report_format_module#print_report_header.) { |
| 882 | module.print_report_headercxx . . $ report_format_module#print_report_header.(report); |
| 883 | } |
| 884 | |
| 885 | module.print_report_diff_attrs_entriescxx . . $ report_format_module#print_report_diff_attrs_entries.(report); |
| 886 | |
| 887 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY.) { |
| 888 | char *time = get_time_stringcxx . . $ get_time_string(4e4bbfda8d4b3d77).(&(confcxx . . $ conf.->start_timecxx . . $ db_config#start_time.)); |
| 889 | module.print_report_starttime_versioncxx . . $ report_format_module#print_report_starttime_version.(report, time, confcxx . . $ conf.->aide_versioncxx . . $ db_config#aide_version.); |
| 890 | freecxx . . $ free(5d22bdacc48458e8).(time); time=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 891 | } |
| 892 | |
| 893 | module.print_report_outlinecxx . . $ report_format_module#print_report_outline.(report); |
| 894 | |
| 895 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY.) { |
| 896 | if(confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`!) { |
| 897 | module.print_report_new_database_writtencxx . . $ report_format_module#print_report_new_database_written.(report); |
| 898 | } |
| 899 | module.print_report_config_optionscxx . . $ report_format_module#print_report_config_options.(report); |
| 900 | } |
| 901 | |
| 902 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_LIST_ENTRIEScxx . . $ REPORT_LEVEL_LIST_ENTRIES.) { |
| 903 | module.print_report_report_optionscxx . . $ report_format_module#print_report_report_options.(report); |
| 904 | } |
| 905 | |
| 906 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY.) { |
| 907 | module.print_report_summarycxx . . $ report_format_module#print_report_summary.(report); |
| 908 | } |
| 909 | |
| 910 | if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!) || (confcxx . . $ conf.->actioncxx . . $ db_config#action.&DO_INITcxx . . $ `include/db_config.h:48:9`! && report->detailed_initcxx . . $ report_t#detailed_init.)) { |
| 911 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_LIST_ENTRIEScxx . . $ REPORT_LEVEL_LIST_ENTRIES.) { |
| 912 | if (report->groupedcxx . . $ report_t#grouped.) { |
| 913 | if (report->naddcxx . . $ report_t#nadd.) { |
| 914 | module.print_report_entriescxx . . $ report_format_module#print_report_entries.(report, node, NODE_ADDEDcxx . . $ `include/db.h:60:9`!); |
| 915 | } |
| 916 | if (report->nremcxx . . $ report_t#nrem.) { |
| 917 | module.print_report_entriescxx . . $ report_format_module#print_report_entries.(report, node, NODE_REMOVEDcxx . . $ `include/db.h:61:9`!); |
| 918 | } |
| 919 | if (report->nchgcxx . . $ report_t#nchg.) { |
| 920 | module.print_report_entriescxx . . $ report_format_module#print_report_entries.(report, node, NODE_CHANGEDcxx . . $ `include/db.h:62:9`!); |
| 921 | } |
| 922 | } else { |
| 923 | if (report->naddcxx . . $ report_t#nadd. || report->nremcxx . . $ report_t#nrem. || report->nchgcxx . . $ report_t#nchg.) { |
| 924 | module.print_report_entriescxx . . $ report_format_module#print_report_entries.(report, node, NODE_ADDEDcxx . . $ `include/db.h:60:9`!|NODE_REMOVEDcxx . . $ `include/db.h:61:9`!|NODE_CHANGEDcxx . . $ `include/db.h:62:9`!); |
| 925 | } |
| 926 | } |
| 927 | } |
| 928 | if ( (report->nchgcxx . . $ report_t#nchg. && report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_CHANGED_ATTRIBUTEScxx . . $ REPORT_LEVEL_CHANGED_ATTRIBUTES.) || ( (report->naddcxx . . $ report_t#nadd. || report->nremcxx . . $ report_t#nrem.) && report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_ADDED_REMOVED_ENTRIEScxx . . $ REPORT_LEVEL_ADDED_REMOVED_ENTRIES.) ) { |
| 929 | module.print_report_detailscxx . . $ report_format_module#print_report_details.(report, node); |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_DATABASE_ATTRIBUTEScxx . . $ REPORT_LEVEL_DATABASE_ATTRIBUTES.) { |
| 934 | if (confcxx . . $ conf.->database_incxx . . $ db_config#database_in..db_linecxx . . $ database#db_line. || confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..db_linecxx . . $ database#db_line. || confcxx . . $ conf.->database_newcxx . . $ db_config#database_new..db_linecxx . . $ database#db_line.) { |
| 935 | |
| 936 | module.print_report_databasescxx . . $ report_format_module#print_report_databases.(report); |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | if (report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY.) { |
| 941 | char *time = get_time_stringcxx . . $ get_time_string(4e4bbfda8d4b3d77).(&(confcxx . . $ conf.->end_timecxx . . $ db_config#end_time.)); |
| 942 | long run_time = (long) difftimecxx . . $ difftime(f630275aa3e30a1e).(confcxx . . $ conf.->end_timecxx . . $ db_config#end_time., confcxx . . $ conf.->start_timecxx . . $ db_config#start_time.); |
| 943 | module.print_report_endtime_runtimecxx . . $ report_format_module#print_report_endtime_runtime.(report, time, run_time); |
| 944 | freecxx . . $ free(5d22bdacc48458e8).(time); time=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 945 | } |
| 946 | if (module.print_report_footercxx . . $ report_format_module#print_report_footer.) { |
| 947 | module.print_report_footercxx . . $ report_format_module#print_report_footer.(report); |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | int gen_reportcxx . . $ gen_report(b2b9a89df0a93043).(seltreecxx . . $ seltree#* node) { |
| 952 | listcxx . . $ list#* report_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 953 | |
| 954 | terse_reportcxx . . $ terse_report(373bb888e3180625).(node); |
| 955 | |
| 956 | #ifdef WITH_AUDIT |
| 957 | send_audit_report(); |
| 958 | #endif |
| 959 | |
| 960 | for (report_list=confcxx . . $ conf.->report_urlscxx . . $ db_config#report_urls.; report_list; report_list=report_list->nextcxx . . $ list#next.) { |
| 961 | report_tcxx . . $ report_t#* report = report_list->datacxx . . $ list#data.; |
| 962 | switch(report->formatcxx . . $ report_t#format.) { |
| 963 | case REPORT_FORMAT_PLAINcxx . . $ REPORT_FORMAT_PLAIN.: |
| 964 | print_reportcxx . . $ print_report(9d31da909e5050e9).(report, node, report_module_plaincxx . . $ report_module_plain.); |
| 965 | break; |
| 966 | case REPORT_FORMAT_JSONcxx . . $ REPORT_FORMAT_JSON.: |
| 967 | print_reportcxx . . $ print_report(9d31da909e5050e9).(report, node, report_module_jsoncxx . . $ report_module_json.); |
| 968 | break; |
| 969 | case REPORT_FORMAT_UNKNOWNcxx . . $ REPORT_FORMAT_UNKNOWN.: |
| 970 | /* skip unknown report format */ |
| 971 | break; |
| 972 | } |
| 973 | } |
| 974 | |
| 975 | return confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!) ? (added_entries_reportedcxx . . $ added_entries_reported.)*1+(removed_entries_reportedcxx . . $ removed_entries_reported.!=0)*2+(changed_entries_reportedcxx . . $ changed_entries_reported.!=0)*4 : 0; |
| 976 | } |
| 977 | |
| 978 | // vi: ts=8 sw=8 |