| 1 | /* |
| 2 | * AIDE (Advanced Intrusion Detection Environment) |
| 3 | * |
| 4 | * Copyright (C) 2022-2025 Hannes von Haugwitz |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of the |
| 9 | * License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #include <stdlib.h> |
| 22 | #include "config.h"cxx . . $ `<file>/include/config.h`/ |
| 23 | #include "aide.h"cxx . . $ `<file>/include/aide.h`/ |
| 24 | #include "attributes.h"cxx . . $ `<file>/include/attributes.h`/ |
| 25 | #include "conf_ast.h"cxx . . $ `<file>/include/conf_ast.h`/ |
| 26 | #include "db.h"cxx . . $ `<file>/include/db.h`/ |
| 27 | #include "db_config.h"cxx . . $ `<file>/include/db_config.h`/ |
| 28 | #include "db_line.h"cxx . . $ `<file>/include/db_line.h`/ |
| 29 | #include "report.h"cxx . . $ `<file>/include/report.h`/ |
| 30 | #include "seltree.h"cxx . . $ `<file>/include/seltree.h`/ |
| 31 | #include "stdbool.h" |
| 32 | #include "url.h"cxx . . $ `<file>/include/url.h`/ |
| 33 | |
| 34 | #define JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`! "%*c\"%s\": [\n" |
| 35 | #define JSON_FMT_ARRAY_ELEMENT_INNERcxx . . $ `src/report_json.c:35:9`! "%*c\"%s\",\n" |
| 36 | #define JSON_FMT_ARRAY_ELEMENT_LASTcxx . . $ `src/report_json.c:36:9`! "%*c\"%s\"\n" |
| 37 | #define JSON_FMT_ARRAY_ELEMENT_PLAINcxx . . $ `src/report_json.c:37:9`! "%*c\"%s\"" |
| 38 | #define JSON_FMT_ARRAY_ENDcxx . . $ `src/report_json.c:38:9`! "%*c],\n" |
| 39 | #define JSON_FMT_ARRAY_END_PLAINcxx . . $ `src/report_json.c:39:9`! "%*c]" |
| 40 | #define JSON_FMT_LONGcxx . . $ `src/report_json.c:40:9`! "%*c\"%s\": %ld,\n" |
| 41 | #define JSON_FMT_LONG_LASTcxx . . $ `src/report_json.c:41:9`! "%*c\"%s\": %ld\n" |
| 42 | #define JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`! "%*c\"%s\": {\n" |
| 43 | #define JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`! "%*c},\n" |
| 44 | #define JSON_FMT_OBJECT_END_PLAINcxx . . $ `src/report_json.c:44:9`! "%*c}" |
| 45 | #define JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`! "%*c\"%s\": \"%s\",\n" |
| 46 | #define JSON_FMT_STRING_LASTcxx . . $ `src/report_json.c:46:9`! "%*c\"%s\": \"%s\"\n" |
| 47 | #define JSON_FMT_STRING_PLAINcxx . . $ `src/report_json.c:47:9`! "%*c\"%s\": \"%s\"" |
| 48 | |
| 49 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! line_firstcxx . . $ line_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 50 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! database_firstcxx . . $ database_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 51 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! databases_firstcxx . . $ databases_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 52 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! details_firstcxx . . $ details_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 53 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! attributes_firstcxx . . $ attributes_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 54 | |
| 55 | static int _escape_json_stringcxx . . $ _escape_json_string(2f051e3560ff300f).(const char *src, char *escaped_string) { |
| 56 | size_t i; |
| 57 | int n = 0; |
| 58 | |
| 59 | for (i = 0; i < strlencxx . . $ strlen(751346f8406fd082).(src); ++i) { |
| 60 | switch(src[i]) { |
| 61 | case '\n': |
| 62 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 63 | n++; |
| 64 | if (escaped_string) { escaped_string[n] = 'n'; } |
| 65 | n++; |
| 66 | break; |
| 67 | case '\t': |
| 68 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 69 | n++; |
| 70 | if (escaped_string) { escaped_string[n] = 't'; } |
| 71 | n++; |
| 72 | break; |
| 73 | case '\b': |
| 74 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 75 | n++; |
| 76 | if (escaped_string) { escaped_string[n] = 'b'; } |
| 77 | n++; |
| 78 | break; |
| 79 | case '\f': |
| 80 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 81 | n++; |
| 82 | if (escaped_string) { escaped_string[n] = 'f'; } |
| 83 | n++; |
| 84 | break; |
| 85 | case '\r': |
| 86 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 87 | n++; |
| 88 | if (escaped_string) { escaped_string[n] = 'r'; } |
| 89 | n++; |
| 90 | break; |
| 91 | case '"': |
| 92 | case '\\': |
| 93 | if (escaped_string) { escaped_string[n] = '\\'; } |
| 94 | n++; |
| 95 | if (escaped_string) { escaped_string[n] = src[i]; } |
| 96 | n++; |
| 97 | break; |
| 98 | default: |
| 99 | if (src[i] >= 0 && (src[i] < 0x1f || src[i] == 0x7f)) { |
| 100 | if (escaped_string) { snprintfcxx . . $ snprintf(ea502d73e74c754c).(&escaped_string[n], 7, "\\u%04x", src[i]); } |
| 101 | n += 6; |
| 102 | } else { |
| 103 | if (escaped_string) { escaped_string[n] = src[i]; } |
| 104 | n++; |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | if (escaped_string) { escaped_string[n] = '\0'; } |
| 109 | n++; |
| 110 | |
| 111 | return n; |
| 112 | } |
| 113 | |
| 114 | static char *_get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(const char *src) { |
| 115 | char *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 116 | int n = _escape_json_stringcxx . . $ _escape_json_string(2f051e3560ff300f).(src, str); |
| 117 | str = checked_malloccxx . . $ checked_malloc(bfcfa4d6b7f7ef64).(n); |
| 118 | _escape_json_stringcxx . . $ _escape_json_string(2f051e3560ff300f).(src, str); |
| 119 | return str; |
| 120 | } |
| 121 | |
| 122 | static void _print_config_optioncxx . . $ _print_config_option(21fa13cc67b7dd0d).(report_tcxx . . $ report_t# *report, config_optioncxx . . $ config_option# option, const char* value) { |
| 123 | char *escaped_value = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(value); |
| 124 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!, 2, ' ', config_optionscxx . . $ config_options.[option].config_namecxx . . $ $anonymous_type_f4816c30b1564b4_0#config_name., escaped_value); |
| 125 | freecxx . . $ free(5d22bdacc48458e8).(escaped_value); |
| 126 | } |
| 127 | |
| 128 | static char* _get_value_formatcxx . . $ _get_value_format(130a310d7dde1752).(ATTRIBUTEcxx . . $ ATTRIBUTE# attribute) { |
| 129 | switch(attribute) { |
| 130 | case attr_uidcxx . . $ attr_uid.: |
| 131 | case attr_gidcxx . . $ attr_gid.: |
| 132 | case attr_sizecxx . . $ attr_size.: |
| 133 | case attr_sizegcxx . . $ attr_sizeg.: |
| 134 | case attr_inodecxx . . $ attr_inode.: |
| 135 | case attr_bcountcxx . . $ attr_bcount.: |
| 136 | case attr_linkcountcxx . . $ attr_linkcount.: |
| 137 | return "%*c\"%s\": %s"; |
| 138 | default: |
| 139 | return "%*c\"%s\": \"%s\""; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | static void print_line_jsoncxx . . $ print_line_json(77e6edcfaabdcef6).(report_tcxx . . $ report_t#* report, char* filename, int node_checked, seltreecxx . . $ seltree#* node) { |
| 144 | if (line_firstcxx . . $ line_first.) { line_firstcxx . . $ line_first.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; } |
| 145 | else { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 146 | |
| 147 | char *escaped_filename = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(filename); |
| 148 | |
| 149 | if(report->summarize_changescxx . . $ report_t#summarize_changes.) { |
| 150 | char* summary = get_summarize_changes_stringcxx . . $ get_summarize_changes_string(995b9c65a0e968c6).(report, node); |
| 151 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_PLAINcxx . . $ `src/report_json.c:47:9`!, 4, ' ', escaped_filename, summary); |
| 152 | freecxx . . $ free(5d22bdacc48458e8).(summary); summary=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 153 | } else if (!report->groupedcxx . . $ report_t#grouped.) { |
| 154 | char* change_type; |
| 155 | if (node_checked&NODE_ADDEDcxx . . $ `include/db.h:60:9`!) { |
| 156 | change_type = "added"; |
| 157 | } else if (node_checked&NODE_REMOVEDcxx . . $ `include/db.h:61:9`!) { |
| 158 | change_type = "removed"; |
| 159 | } else { |
| 160 | change_type = "changed"; |
| 161 | } |
| 162 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_PLAINcxx . . $ `src/report_json.c:47:9`!, 4, ' ', escaped_filename, change_type); |
| 163 | } else { |
| 164 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_ARRAY_ELEMENT_PLAINcxx . . $ `src/report_json.c:37:9`!, 4, ' ', escaped_filename); |
| 165 | } |
| 166 | freecxx . . $ free(5d22bdacc48458e8).(escaped_filename); |
| 167 | } |
| 168 | |
| 169 | static void _print_attribute_valuecxx . . $ _print_attribute_value(8076e30bf8fa76ab).(report_tcxx . . $ report_t# *report, const char* name, ATTRIBUTEcxx . . $ ATTRIBUTE# attribute, char **value, int num, int ident) { |
| 170 | if (num) { |
| 171 | if (num > 1) { |
| 172 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`!, ident, ' ', name); |
| 173 | for (int i = 0 ; i < num ; i++) { |
| 174 | char *escaped_value = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(value[i]); |
| 175 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, i+1<num?JSON_FMT_ARRAY_ELEMENT_INNERcxx . . $ `src/report_json.c:35:9`!:JSON_FMT_ARRAY_ELEMENT_LASTcxx . . $ `src/report_json.c:36:9`!, ident+2, ' ', escaped_value); |
| 176 | freecxx . . $ free(5d22bdacc48458e8).(escaped_value); |
| 177 | } |
| 178 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_ARRAY_END_PLAINcxx . . $ `src/report_json.c:39:9`!, ident, ' '); |
| 179 | } else { |
| 180 | char *escaped_value = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(value[0]); |
| 181 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, _get_value_formatcxx . . $ _get_value_format(130a310d7dde1752).(attribute), ident, ' ', name, escaped_value); |
| 182 | freecxx . . $ free(5d22bdacc48458e8).(escaped_value); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | static void _print_attributecxx . . $ _print_attribute(7f3fc18eaf6294aa).(report_tcxx . . $ report_t# *report, db_linecxx . . $ db_line#* oline, db_linecxx . . $ db_line#* nline, ATTRIBUTEcxx . . $ ATTRIBUTE# attribute) { |
| 188 | char **ovalue = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 189 | char **nvalue = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 190 | int onumber, nnumber, i; |
| 191 | |
| 192 | if (attributes_firstcxx . . $ attributes_first.) { attributes_firstcxx . . $ attributes_first.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; } |
| 193 | else { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 194 | |
| 195 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr = ATTRcxx . . $ `include/attributes.h:28:9`!(attribute); |
| 196 | |
| 197 | const char* json_name = attributescxx . . $ attributes.[attribute].field_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#field_name.; |
| 198 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 6, ' ', json_name); |
| 199 | |
| 200 | onumber=get_attribute_valuescxx . . $ get_attribute_values(daa3275b1ddcb9d1).(attr, oline, &ovalue, report); |
| 201 | nnumber=get_attribute_valuescxx . . $ get_attribute_values(daa3275b1ddcb9d1).(attr, nline, &nvalue, report); |
| 202 | |
| 203 | _print_attribute_valuecxx . . $ _print_attribute_value(8076e30bf8fa76ab).(report, "old", attribute, ovalue, onumber, 8); |
| 204 | for(i=0; i < onumber; ++i) { freecxx . . $ free(5d22bdacc48458e8).(ovalue[i]); ovalue[i]=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; } freecxx . . $ free(5d22bdacc48458e8).(ovalue); ovalue=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 205 | |
| 206 | if (onumber && nnumber) { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 207 | |
| 208 | _print_attribute_valuecxx . . $ _print_attribute_value(8076e30bf8fa76ab).(report, "new", attribute, nvalue, nnumber, 8); |
| 209 | for(i=0; i < nnumber; ++i) { freecxx . . $ free(5d22bdacc48458e8).(nvalue[i]); nvalue[i]=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; } freecxx . . $ free(5d22bdacc48458e8).(nvalue); nvalue=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 210 | |
| 211 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 212 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_END_PLAINcxx . . $ `src/report_json.c:44:9`!, 6, ' '); |
| 213 | } |
| 214 | |
| 215 | static void _print_database_attributecxx . . $ _print_database_attribute(7f3fc18eaf6294aa).(report_tcxx . . $ report_t# *report, db_linecxx . . $ db_line#* oline, __attribute__((unused)) db_linecxx . . $ db_line#* nline, ATTRIBUTEcxx . . $ ATTRIBUTE# attribute) { |
| 216 | char **value; |
| 217 | int num, i; |
| 218 | |
| 219 | if (database_firstcxx . . $ database_first.) { database_firstcxx . . $ database_first.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; } |
| 220 | else { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 221 | |
| 222 | DB_ATTR_TYPEcxx . . $ `include/attributes.h:25:9`! attr = ATTRcxx . . $ `include/attributes.h:28:9`!(attribute); |
| 223 | |
| 224 | const char* json_name = attributescxx . . $ attributes.[attribute].field_namecxx . . $ $anonymous_type_bb8296fff58edf70_1#field_name.; |
| 225 | |
| 226 | num=get_attribute_valuescxx . . $ get_attribute_values(daa3275b1ddcb9d1).(attr, oline, &value, report); |
| 227 | |
| 228 | _print_attribute_valuecxx . . $ _print_attribute_value(8076e30bf8fa76ab).(report, json_name, attribute, value, num, 6); |
| 229 | for(i=0; i < num; ++i) { freecxx . . $ free(5d22bdacc48458e8).(value[i]); value[i]=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; } freecxx . . $ free(5d22bdacc48458e8).(value); value=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 230 | } |
| 231 | |
| 232 | static void _print_database_attributescxx . . $ _print_database_attributes(c89731a28d87173).(report_tcxx . . $ report_t# *report, db_linecxx . . $ db_line#* db) { |
| 233 | if (databases_firstcxx . . $ databases_first.) { databases_firstcxx . . $ databases_first.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; } |
| 234 | else { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 235 | |
| 236 | char *escaped_filename = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(db->filenamecxx . . $ db_line#filename.); |
| 237 | |
| 238 | database_firstcxx . . $ database_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 239 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 4, ' ', escaped_filename); |
| 240 | print_dbline_attrscxx . . $ print_dbline_attrs(74750e9842f268de).(report, db, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, db->attrcxx . . $ db_line#attr., _print_database_attributecxx . . $ _print_database_attribute(7f3fc18eaf6294aa).); |
| 241 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 242 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_END_PLAINcxx . . $ `src/report_json.c:44:9`!, 4, ' '); |
| 243 | freecxx . . $ free(5d22bdacc48458e8).(escaped_filename); |
| 244 | } |
| 245 | |
| 246 | static void _print_report_dbline_attributescxx . . $ _print_report_dbline_attributes(a3815088d7b5e335).(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) { |
| 247 | if (report_attrs) { |
| 248 | if (details_firstcxx . . $ details_first.) { details_firstcxx . . $ details_first.=falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; } |
| 249 | else { report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,",\n"); } |
| 250 | |
| 251 | char *escaped_filename = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).((nline==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!?oline:nline)->filenamecxx . . $ db_line#filename.); |
| 252 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 4, ' ', escaped_filename); |
| 253 | attributes_firstcxx . . $ attributes_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 254 | print_dbline_attrscxx . . $ print_dbline_attrs(74750e9842f268de).(report, oline, nline, report_attrs, _print_attributecxx . . $ _print_attribute(7f3fc18eaf6294aa).); |
| 255 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 256 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_END_PLAINcxx . . $ `src/report_json.c:44:9`!, 4, ' '); |
| 257 | freecxx . . $ free(5d22bdacc48458e8).(escaped_filename); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | static void print_report_header_jsoncxx . . $ print_report_header_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 262 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, "{\n"); |
| 263 | } |
| 264 | static void print_report_footer_jsoncxx . . $ print_report_footer_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 265 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, "}\n"); |
| 266 | } |
| 267 | static void print_report_outline_jsoncxx . . $ print_report_outline_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 268 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->levelcxx . . $ report_t#level. >= REPORT_LEVEL_SUMMARYcxx . . $ REPORT_LEVEL_SUMMARY.?JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!:JSON_FMT_STRING_LASTcxx . . $ `src/report_json.c:46:9`! , 2, ' ', "outline", get_summary_stringcxx . . $ get_summary_string(ec346f625076085b).(report)); |
| 269 | } |
| 270 | static void print_report_starttime_version_jsoncxx . . $ print_report_starttime_version_json(bd72d82e8b6e7cd5).(report_tcxx . . $ report_t# *report, const char* start_time, const char* aide_version) { |
| 271 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!, 2, ' ', "start_time", start_time); |
| 272 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!, 2, ' ', "aide_version", aide_version); |
| 273 | } |
| 274 | static void print_report_endtime_runtime_jsoncxx . . $ print_report_endtime_runtime_json(112969454c88f9a1).(report_tcxx . . $ report_t#* report, const char* end_time, long run_time) { |
| 275 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!, 2, ' ', "end_time", end_time); |
| 276 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONG_LASTcxx . . $ `src/report_json.c:41:9`!, 2, ' ', "run_time_seconds", run_time); |
| 277 | } |
| 278 | |
| 279 | static void print_report_config_options_jsoncxx . . $ print_report_config_options_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 280 | print_report_config_optionscxx . . $ print_report_config_options(8fd66a0c554c67cb).(report, _print_config_optioncxx . . $ _print_config_option(21fa13cc67b7dd0d).); |
| 281 | } |
| 282 | |
| 283 | static void print_report_report_options_jsoncxx . . $ print_report_report_options_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 284 | print_report_report_optionscxx . . $ print_report_report_options(8fd66a0c554c67cb).(report, _print_config_optioncxx . . $ _print_config_option(21fa13cc67b7dd0d).); |
| 285 | } |
| 286 | |
| 287 | static void print_report_summary_jsoncxx . . $ print_report_summary_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 288 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 2, ' ', "number_of_entries"); |
| 289 | if (confcxx . . $ conf.->actioncxx . . $ db_config#action.&(DO_COMPAREcxx . . $ `include/db_config.h:49:9`!|DO_DIFFcxx . . $ `include/db_config.h:50:9`!) && (report->naddcxx . . $ report_t#nadd.||report->nremcxx . . $ report_t#nrem.||report->nchgcxx . . $ report_t#nchg.)) { |
| 290 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONGcxx . . $ `src/report_json.c:40:9`!, 4, ' ', "total", report->ntotalcxx . . $ report_t#ntotal.); |
| 291 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONGcxx . . $ `src/report_json.c:40:9`!, 4, ' ', "added", report->naddcxx . . $ report_t#nadd.); |
| 292 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONGcxx . . $ `src/report_json.c:40:9`!, 4, ' ', "removed", report->nremcxx . . $ report_t#nrem.); |
| 293 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONG_LASTcxx . . $ `src/report_json.c:41:9`!, 4, ' ', "changed", report->nchgcxx . . $ report_t#nchg.); |
| 294 | } else { |
| 295 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_LONG_LASTcxx . . $ `src/report_json.c:41:9`!, 4, ' ', "total", report->ntotalcxx . . $ report_t#ntotal.); |
| 296 | } |
| 297 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`!, 2, ' '); |
| 298 | } |
| 299 | |
| 300 | static void print_report_new_database_written_jsoncxx . . $ print_report_new_database_written_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 301 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`!, 2, ' ', "new_database", confcxx . . $ conf.->database_outcxx . . $ db_config#database_out..urlcxx . . $ database#url.->valuecxx . . $ url_t#value.); |
| 302 | } |
| 303 | |
| 304 | static void print_report_details_jsoncxx . . $ print_report_details_json(3a601c4c6d2db327).(report_tcxx . . $ report_t# *report, seltreecxx . . $ seltree#* node) { |
| 305 | details_firstcxx . . $ details_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 306 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 2, ' ', "details"); |
| 307 | print_report_detailscxx . . $ print_report_details(c1b9a86155df1be7).(report, node, _print_report_dbline_attributescxx . . $ _print_report_dbline_attributes(a3815088d7b5e335).); |
| 308 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 309 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`!, 2, ' '); |
| 310 | } |
| 311 | |
| 312 | static void print_report_databases_jsoncxx . . $ print_report_databases_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 313 | databases_firstcxx . . $ databases_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 314 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 2, ' ', "databases"); |
| 315 | print_databases_attrscxx . . $ print_databases_attrs(e6fbbe7f0ff0be64).(report, _print_database_attributescxx . . $ _print_database_attributes(c89731a28d87173).); |
| 316 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 317 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`!, 2, ' '); |
| 318 | } |
| 319 | |
| 320 | static void print_report_entries_jsoncxx . . $ print_report_entries_json(87970db00a1cace1).(report_tcxx . . $ report_t# *report, seltreecxx . . $ seltree#* node, const int filter) { |
| 321 | line_firstcxx . . $ line_first. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 322 | switch (filter) { |
| 323 | case NODE_ADDEDcxx . . $ `include/db.h:60:9`!: |
| 324 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->summarize_changescxx . . $ report_t#summarize_changes.||!report->groupedcxx . . $ report_t#grouped.?JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!:JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`!, 2, ' ', "added"); |
| 325 | break; |
| 326 | case NODE_REMOVEDcxx . . $ `include/db.h:61:9`!: |
| 327 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->summarize_changescxx . . $ report_t#summarize_changes.||!report->groupedcxx . . $ report_t#grouped.?JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!:JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`!, 2, ' ', "removed"); |
| 328 | break; |
| 329 | case NODE_CHANGEDcxx . . $ `include/db.h:62:9`!: |
| 330 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->summarize_changescxx . . $ report_t#summarize_changes.||!report->groupedcxx . . $ report_t#grouped.?JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!:JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`!, 2, ' ', "changed"); |
| 331 | break; |
| 332 | default: |
| 333 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->summarize_changescxx . . $ report_t#summarize_changes.||!report->groupedcxx . . $ report_t#grouped.?JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!:JSON_FMT_ARRAY_BEGINcxx . . $ `src/report_json.c:34:9`!, 2, ' ', "entries"); |
| 334 | break; |
| 335 | } |
| 336 | print_report_entriescxx . . $ print_report_entries(f8d8678ee3db360e).(report, node, filter, print_line_jsoncxx . . $ print_line_json(77e6edcfaabdcef6).); |
| 337 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report,"\n"); |
| 338 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, report->summarize_changescxx . . $ report_t#summarize_changes.||!report->groupedcxx . . $ report_t#grouped.?JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`!:JSON_FMT_ARRAY_ENDcxx . . $ `src/report_json.c:38:9`!, 2, ' '); |
| 339 | } |
| 340 | |
| 341 | static void print_report_diff_attrs_entries_jsoncxx . . $ print_report_diff_attrs_entries_json(5c5b916f0dae0aa1).(report_tcxx . . $ report_t# *report) { |
| 342 | if (report->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.) { |
| 343 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_BEGINcxx . . $ `src/report_json.c:42:9`!, 2, ' ', "different_attributes"); |
| 344 | for(int i = 0; i < report->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries.; ++i) { |
| 345 | char *escaped_filename = _get_escaped_json_stringcxx . . $ _get_escaped_json_string(a8b8e32347182212).(report->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[i].entrycxx . . $ diff_attrs_entry#entry.); |
| 346 | char *attrs = diff_attributescxx . . $ diff_attributes(39cd1df6f24d7ad6).(report->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[i].old_attrscxx . . $ diff_attrs_entry#old_attrs., report->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.[i].new_attrscxx . . $ diff_attrs_entry#new_attrs.); |
| 347 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, i + 1 < report->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries. ? JSON_FMT_STRING_COMMAcxx . . $ `src/report_json.c:45:9`! : JSON_FMT_STRING_LASTcxx . . $ `src/report_json.c:46:9`!, 4, ' ', |
| 348 | escaped_filename, attrs); |
| 349 | freecxx . . $ free(5d22bdacc48458e8).(escaped_filename); |
| 350 | freecxx . . $ free(5d22bdacc48458e8).(attrs); |
| 351 | } |
| 352 | report->num_diff_attrs_entriescxx . . $ report_t#num_diff_attrs_entries. = 0; |
| 353 | freecxx . . $ free(5d22bdacc48458e8).(report->diff_attrs_entriescxx . . $ report_t#diff_attrs_entries.); |
| 354 | report_printfcxx . . $ report_printf(4e012a91a5600c6).(report, JSON_FMT_OBJECT_ENDcxx . . $ `src/report_json.c:43:9`!, 2, ' '); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | report_format_modulecxx . . $ report_format_module# report_module_jsoncxx . . $ report_module_json. = { |
| 359 | .print_report_config_options = print_report_config_options_jsoncxx . . $ print_report_config_options_json(5c5b916f0dae0aa1)., |
| 360 | .print_report_databases = print_report_databases_jsoncxx . . $ print_report_databases_json(5c5b916f0dae0aa1)., |
| 361 | .print_report_details = print_report_details_jsoncxx . . $ print_report_details_json(3a601c4c6d2db327)., |
| 362 | .print_report_diff_attrs_entries = print_report_diff_attrs_entries_jsoncxx . . $ print_report_diff_attrs_entries_json(5c5b916f0dae0aa1)., |
| 363 | .print_report_endtime_runtime = print_report_endtime_runtime_jsoncxx . . $ print_report_endtime_runtime_json(112969454c88f9a1)., |
| 364 | .print_report_entries = print_report_entries_jsoncxx . . $ print_report_entries_json(87970db00a1cace1)., |
| 365 | .print_report_footer = print_report_footer_jsoncxx . . $ print_report_footer_json(5c5b916f0dae0aa1)., |
| 366 | .print_report_header = print_report_header_jsoncxx . . $ print_report_header_json(5c5b916f0dae0aa1)., |
| 367 | .print_report_new_database_written = print_report_new_database_written_jsoncxx . . $ print_report_new_database_written_json(5c5b916f0dae0aa1)., |
| 368 | .print_report_outline = print_report_outline_jsoncxx . . $ print_report_outline_json(5c5b916f0dae0aa1)., |
| 369 | .print_report_report_options = print_report_report_options_jsoncxx . . $ print_report_report_options_json(5c5b916f0dae0aa1)., |
| 370 | .print_report_starttime_version = print_report_starttime_version_jsoncxx . . $ print_report_starttime_version_json(bd72d82e8b6e7cd5)., |
| 371 | .print_report_summary = print_report_summary_jsoncxx . . $ print_report_summary_json(5c5b916f0dae0aa1)., |
| 372 | }; |