Debian Codegraph @

include/db_config.h

raw symbols SCIP
1 /*
2 * AIDE (Advanced Intrusion Detection Environment)
3 *
4 * Copyright (C) 1999-2002, 2004-2006, 2010-2013, 2015-2016, 2019-2024
5 * Rami Lehti, Pablo Virolainen, 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 #ifndef _DB_CONFIG_H_INCLUDED
24 #define _DB_CONFIG_H_INCLUDED
25
26 #include "config.h"
27 #define PCRE2_CODE_UNIT_WIDTH 8
28 #include <pcre2.h>
29 #include <stdbool.h>
30 #include <sys/types.h>
31 #ifdef WITH_ZLIB
32 #include <zlib.h>
33 #endif
34 #include "attributes.h"
35 #include "db_line.h"
36 #include "list.h"
37 #include "report.h"
38 #include "file.h"
39 #include "rx_rule.h"
40 #include "url.h"
41
42
43 #define E2O(n) (1<<n)
44
45 #define RETOK 0
46 #define RETFAIL -1
47
48 #define DO_INIT (1<<0)
49 #define DO_COMPARE (1<<1)
50 #define DO_DIFF (1<<2)
51 #define DO_DRY_RUN (1<<3)
52 #define DO_LIST (1<<4)
53
54 /* TIMEBUFSIZE should be exactly ceil(sizeof(time_t)*8*ln(2)/ln(10))
55 * Now it is ceil(sizeof(time_t)*2.5)
56 * And of course we add one for end of string char
57 */
58
59 #define TIMEBUFSIZE (((sizeof(time_t)*5+1)>>1)+1)
60
61
62 /*
63 New db_config
64 Not used yet, maybe someday.
65 */
66
67 /* typedef struct _db_config { */
68 /* url_t* url; */
69 /* config* conf; */
70 /* int inout; */
71 /* int (*init)(url*,int,config*); */
72 /* char** (*readline)(_db_config*); */
73 /* int (*writeline)(_db_config*,db_line* line); */
74 /* int (*close)(_db_config*); */
75 /* int db_size; */
76 /* DB_FIELD* db_order; */
77 /* void* local; */
78 /* }_db_config ; */
79
80 typedef enum {
81 DB_FLAG_NONE =0,
82 DB_FLAG_CREATED =1,
83 DB_FLAG_PARSE =2,
84 } DB_FLAG;
85
86 typedef struct database {
87 url_t* url;
88
89 char *filename;
90 int linenumber;
91 char *linebuf;
92
93 void *fp;
94 #ifdef WITH_ZLIB
95 gzFile gzp;
96 #endif
97
98 long lineno;
99 ATTRIBUTE* fields;
100 int num_fields;
101 struct md_container *mdc;
102 struct db_line *db_line;
103
104 DB_FLAG flags;
105
106 } database;
107
108 typedef struct db_config {
109 char *hostname;
110
111 database database_in;
112 database database_out;
113 database database_new;
114
115 DB_ATTR_TYPE db_attrs;
116
117 #ifdef WITH_ZLIB
118 /* Is dbout gzipped or not */
119 int gzip_dbout;
120
121 #endif
122
123 DB_ATTR_TYPE db_out_attrs;
124
125 file_t check_file;
126
127 char* config_file;
128 char* config_version;
129 char* aide_version;
130 bool config_check_warn_unrestricted_rules;
131
132 int database_add_metadata;
133 int report_detailed_init;
134 int report_base16;
135 int report_quiet;
136 bool report_append;
137
138 DB_ATTR_TYPE report_ignore_added_attrs;
139 DB_ATTR_TYPE report_ignore_removed_attrs;
140 DB_ATTR_TYPE report_ignore_changed_attrs;
141 DB_ATTR_TYPE report_force_attrs;
142
143 #ifdef WITH_E2FSATTRS
144 unsigned long report_ignore_e2fsattrs;
145 #endif
146
147 list* report_urls;
148 REPORT_LEVEL report_level;
149 REPORT_FORMAT report_format;
150
151 /* defsyms is a list of symba*s */
152 list* defsyms;
153 /* so is groupsyms */
154 list* groupsyms;
155
156 /* What are we supposed to do */
157 int action;
158
159 long num_workers;
160
161 int progress;
162 bool no_color;
163
164 time_t start_time;
165 time_t end_time;
166
167 int symlinks_found;
168 DB_ATTR_TYPE attr;
169
170 #ifdef WITH_ACL
171 int no_acl_on_symlinks;
172 #endif
173 int warn_dead_symlinks;
174
175 int report_grouped;
176
177 int report_summarize_changes;
178
179 char* root_prefix;
180 int root_prefix_length;
181
182 char* limit;
183 pcre2_code* limit_crx;
184 pcre2_match_data* limit_md;
185
186 struct seltree* tree;
187
188 int print_details_width;
189
190 } db_config;
191
192 #endif