Debian Codegraph @

src/OVAL/probes/independent/textfilecontent54_probe.c

raw symbols SCIP
1 /**
2 * @file textfilecontent54_probe.c
3 * @brief textfilecontent54 probe
4 * @author "Tomas Heinrich" <[email protected]>
5 *
6 * 2010/06/13 [email protected]
7 * This probe is able to process a textfilecontent54_object as defined in OVAL 5.4 and 5.5.
8 *
9 */
10
11 /*
12 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
13 * All Rights Reserved.
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 *
29 * Authors:
30 * "Tomas Heinrich" <[email protected]>
31 */
32
33 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
34 #include <config.h>cxx . . $ `<file>/build/config.h`/
35 #endif
36
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <sys/stat.h>
42 #include <sys/types.h>
43 #include <fcntl.h>
44 #include <unistd.h>
45 #include <limits.h>
46
47 #include "_seap.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap.h`/
48 #include <probe-api.h>cxx . . $ `<file>/src/OVAL/probes/public/probe-api.h`/
49 #include <probe/entcmp.h>cxx . . $ `<file>/src/OVAL/probes/probe/entcmp.h`/
50 #include <probe/probe.h>cxx . . $ `<file>/src/OVAL/probes/probe/probe.h`/
51 #include <probe/option.h>cxx . . $ `<file>/src/OVAL/probes/probe/option.h`/
52 #include <oval_fts.h>cxx . . $ `<file>/src/OVAL/probes/oval_fts.h`/
53 #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
54 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
55 #include "common/oscap_pcre.h"cxx . . $ `<file>/src/common/oscap_pcre.h`/
56 #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/
57
58 #include "textfilecontent54_probe.h"cxx . . $ `<file>/src/OVAL/probes/independent/textfilecontent54_probe.h`/
59
60 #define FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/textfilecontent54_probe.c:60:9`! '/'
61
62 static SEXP_tcxx . . $ SEXP_t# *create_itemcxx . . $ create_item(91a654989eed1720).(const char *path, const char *filename, char *pattern,
63 int instance, char **substrs, int substr_cnt, oval_schema_version_tcxx . . $ oval_schema_version_t# over)
64 {
65 int i;
66 SEXP_tcxx . . $ SEXP_t# *item;
67 SEXP_tcxx . . $ SEXP_t# *r0;
68 SEXP_tcxx . . $ SEXP_t# *se_instance, *se_filepath;
69 char *text;
70
71 if (strlencxx . . $ strlen(751346f8406fd082).(path) + strlencxx . . $ strlen(751346f8406fd082).(filename) + 1 > PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) {
72 dEcxx . . $ `src/common/debug_priv.h:63:9`!("path+filename too long");
73 return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
74 }
75
76 if (oval_schema_version_cmpcxx . . $ oval_schema_version_cmp(b4d0c2bfb97f274f).(over, OVAL_SCHEMA_VERSIONcxx . . $ `src/OVAL/public/oval_schema_version.h:39:9`!(5.4)) < 0) {
77 pattern = text = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
78 se_instance = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
79 } else {
80 text = substrs[0];
81 se_instance = SEXP_number_newu_64cxx . . $ SEXP_number_newu_64(6d23cce3a40f89fa).((int64_tcxx . . $ int64_t#) instance);
82 }
83 if (oval_schema_version_cmpcxx . . $ oval_schema_version_cmp(b4d0c2bfb97f274f).(over, OVAL_SCHEMA_VERSIONcxx . . $ `src/OVAL/public/oval_schema_version.h:39:9`!(5.6)) < 0) {
84 se_filepath = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
85 } else {
86 const size_t path_len = strlencxx . . $ strlen(751346f8406fd082).(path);
87 /* Avoid 2 slashes */
88 if (path_len >= 1 && path[path_len - 1] == FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/textfilecontent54_probe.c:60:9`!) {
89 se_filepath = SEXP_string_newfcxx . . $ SEXP_string_newf(b2137ed863725962).("%s%s", path, filename);
90 } else {
91 se_filepath = SEXP_string_newfcxx . . $ SEXP_string_newf(b2137ed863725962).("%s%c%s", path, FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/textfilecontent54_probe.c:60:9`!, filename);
92 }
93 }
94
95 item = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c).(OVAL_INDEPENDENT_TEXT_FILE_CONTENTcxx . . $ OVAL_INDEPENDENT_TEXT_FILE_CONTENT., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
96 "filepath", OVAL_DATATYPE_SEXPcxx . . $ OVAL_DATATYPE_SEXP., se_filepath,
97 "path", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., path,
98 "filename", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., filename,
99 "pattern", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pattern,
100 "instance", OVAL_DATATYPE_SEXPcxx . . $ OVAL_DATATYPE_SEXP., se_instance,
101 "line", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pattern,
102 "text", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., substrs[0],
103 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
104
105 for (i = 1; i < substr_cnt; ++i) {
106 probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1). (item, "subexpression", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, r0 = SEXP_string_newcxx . . $ SEXP_string_new(a588a58d7514eee2). (substrs[i], strlencxx . . $ strlen(751346f8406fd082). (substrs[i])));
107 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (r0);
108 }
109
110 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(se_filepath);
111 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(se_instance);
112 return item;
113 }
114
115 struct pfdatacxx . . $ pfdata# {
116 char *patterncxx . . $ pfdata#pattern.;
117 oscap_pcre_options_tcxx . . $ oscap_pcre_options_t# re_optscxx . . $ pfdata#re_opts.;
118 SEXP_tcxx . . $ SEXP_t# *instance_entcxx . . $ pfdata#instance_ent.;
119 probe_ctxcxx . . $ probe_ctx# *ctxcxx . . $ pfdata#ctx.;
120 oscap_pcre_tcxx . . $ oscap_pcre_t# *compiled_regexcxx . . $ pfdata#compiled_regex.;
121 };
122
123 static int process_filecxx . . $ process_file(1478ec65bdad9ed8).(const char *prefix, const char *path, const char *file, struct pfdatacxx . . $ pfdata# *pfd, oval_schema_version_tcxx . . $ oval_schema_version_t# over, struct oscap_listcxx . . $ oscap_list# *blocked_paths)
124 {
125 int ret = 0, path_len, file_len, cur_inst = 0, fd = -1, substr_cnt,
126 buf_size = 0, buf_used = 0, ofs = 0, buf_inc = 4096, instance_count = 0,
127 want_instance = 1, negative_instance_value = 0;
128 char **substrs = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
129 char *whole_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *whole_path_with_prefix = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *buf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
130 SEXP_tcxx . . $ SEXP_t# *next_inst = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, *items = SEXP_list_newcxx . . $ SEXP_list_new(902e4f76566c8810).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!), *instance_value_list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
131 *instance_value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
132 struct statcxx . . $ stat# st;
133
134
135 if (file == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
136 goto cleanup;
137
138 path_len = strlencxx . . $ strlen(751346f8406fd082).(path);
139 file_len = strlencxx . . $ strlen(751346f8406fd082).(file);
140 whole_path = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(path_len + file_len + 2);
141
142 memcpycxx . . $ memcpy(cc817cb175f282d).(whole_path, path, path_len);
143
144 if (whole_path[path_len - 1] != FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/textfilecontent54_probe.c:60:9`!) {
145 whole_path[path_len] = FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/textfilecontent54_probe.c:60:9`!;
146 ++path_len;
147 }
148
149 memcpycxx . . $ memcpy(cc817cb175f282d).(whole_path + path_len, file, file_len + 1);
150
151 if (probe_path_is_blockedcxx . . $ probe_path_is_blocked(6f786adec44f4a13).(whole_path, blocked_paths)) {
152 goto cleanup;
153 }
154 /*
155 * If stat() fails, don't report an error and just skip the file.
156 * This is an expected situation, because the fts_*() functions
157 * are called with the 'FTS_PHYSICAL' option. Normally, stumbling
158 * upon a symlink without a target would cause fts_read() to return
159 * the 'FTS_SLNONE' flag, but the 'FTS_PHYSICAL' option causes it
160 * to return 'FTS_SL' and the presence of a valid target has to
161 * be determined with stat().
162 */
163 whole_path_with_prefix = oscap_path_joincxx . . $ oscap_path_join(a713fe7b9a57cf96).(prefix, whole_path);
164 if (statcxx . . $ stat(a9cd1e23e96f423c).(whole_path_with_prefix, &st) == -1)
165 goto cleanup;
166 if (!S_ISREGcxx . . $ `<external>/531885356569766532/stat.h:128:9`!(st.st_mode))
167 goto cleanup;
168
169 fd = opencxx . . $ open(e156e3aa1e5c4ad1).(whole_path_with_prefix, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!);
170 if (fd == -1) {
171 SEXP_tcxx . . $ SEXP_t# *msg;
172
173 msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "open(): '%s' %s.", whole_path, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
174 probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg);
175 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg);
176 probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.);
177 ret = -1;
178 goto cleanup;
179 }
180
181 do {
182 buf_size += buf_inc;
183 void *new_buf = realloccxx . . $ realloc(417ab160f6baadc6).(buf, buf_size);
184 if (new_buf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
185 dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't re-allocate memory for file-processing buffer");
186 ret = PROBE_ENOMEMcxx . . $ `src/OVAL/probes/public/probe-common.h:13:9`!;
187 goto cleanup;
188 }
189 buf = new_buf;
190 ret = readcxx . . $ read(7e34d0a36f355389).(fd, buf + buf_used, buf_inc);
191 if (ret == -1) {
192 SEXP_tcxx . . $ SEXP_t# *msg;
193
194 msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "read(): '%s' %s.", whole_path, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
195 probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg);
196 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg);
197 probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.);
198 ret = -2;
199 goto cleanup;
200 }
201 buf_used += ret;
202 } while (ret == buf_inc);
203
204 if (buf_used == buf_size) {
205 void *new_buf = realloccxx . . $ realloc(417ab160f6baadc6).(buf, ++buf_size);
206 if (new_buf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
207 dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't re-allocate memory");
208 ret = PROBE_ENOMEMcxx . . $ `src/OVAL/probes/public/probe-common.h:13:9`!;
209 goto cleanup;
210 }
211 buf = new_buf;
212 }
213 buf[buf_used++] = '\0';
214
215 do {
216 substr_cnt = oscap_pcre_get_substringscxx . . $ oscap_pcre_get_substrings(60fafe1d399fec14).(buf, &ofs, pfd->compiled_regexcxx . . $ pfdata#compiled_regex., want_instance, &substrs);
217
218 if (substr_cnt < 0) {
219 SEXP_tcxx . . $ SEXP_t# *msg;
220 msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR.,
221 "Regular expression pattern match failed in file %s with error %d.",
222 whole_path, substr_cnt);
223 probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), msg);
224 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg);
225 probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd->ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.);
226 ret = -3;
227 goto cleanup;
228 }
229
230 if (substr_cnt > 0) {
231 int k;
232 instance_count++;
233
234 SEXP_list_addcxx . . $ SEXP_list_add(35a066576d9f6ea6).(items, create_itemcxx . . $ create_item(91a654989eed1720).(path, file, pfd->patterncxx . . $ pfdata#pattern.,
235 instance_count, substrs, substr_cnt, over));
236
237 for (k = 0; k < substr_cnt; ++k)
238 freecxx . . $ free(5d22bdacc48458e8).(substrs[k]);
239 freecxx . . $ free(5d22bdacc48458e8).(substrs);
240 }
241 } while (substr_cnt > 0 && ofs < buf_used);
242
243 probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(pfd->instance_entcxx . . $ pfdata#instance_ent., &instance_value_list);
244 instance_value = SEXP_list_firstcxx . . $ SEXP_list_first(2f7f980afaaae0f0).(instance_value_list);
245 negative_instance_value = SEXP_number_geti_64cxx . . $ SEXP_number_geti_64(f56a5dddf3580f63).(instance_value) < 0;
246 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(instance_value_list);
247 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(instance_value);
248
249 for(cur_inst = 0; cur_inst < instance_count; cur_inst++){
250 if (negative_instance_value)
251 next_inst = SEXP_number_newi_32cxx . . $ SEXP_number_newi_32(ac44525e09ce977a).(cur_inst - instance_count);
252
253 else
254 next_inst = SEXP_number_newi_32cxx . . $ SEXP_number_newi_32(ac44525e09ce977a).(cur_inst + 1);
255
256 if (probe_entobj_cmpcxx . . $ probe_entobj_cmp(e245451a1311e799).(pfd->instance_entcxx . . $ pfdata#instance_ent., next_inst) == OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.)
257 want_instance = 1;
258 else
259 want_instance = 0;
260
261 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(next_inst);
262
263 if (want_instance) {
264 int pic_ret = probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(pfd->ctxcxx . . $ pfdata#ctx., SEXP_list_nthcxx . . $ SEXP_list_nth(8cad6aa883a18669).(items, cur_inst + 1));
265 if (pic_ret == 2 || pic_ret == -1) {
266 ret = -4;
267 break;
268 }
269 }
270 else
271 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(SEXP_list_nthcxx . . $ SEXP_list_nth(8cad6aa883a18669).(items, cur_inst + 1));
272 }
273
274 cleanup:
275 if (fd != -1)
276 closecxx . . $ close(7864480464b09eea).(fd);
277 freecxx . . $ free(5d22bdacc48458e8).(buf);
278 if (whole_path != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
279 freecxx . . $ free(5d22bdacc48458e8).(whole_path);
280 freecxx . . $ free(5d22bdacc48458e8).(whole_path_with_prefix);
281
282 /* coverity[leaked_storage] - substrs is not leaked */
283 return ret;
284 }
285
286 int textfilecontent54_probe_offline_mode_supportedcxx . . $ textfilecontent54_probe_offline_mode_supported(b126dc7c1de90089).()
287 {
288 return PROBE_OFFLINE_OWNcxx . . $ PROBE_OFFLINE_OWN.;
289 }
290
291 int textfilecontent54_probe_maincxx . . $ textfilecontent54_probe_main(470536d3ffacaf10).(probe_ctxcxx . . $ probe_ctx# *ctx, void *arg)
292 {
293 SEXP_tcxx . . $ SEXP_t# *path_ent, *file_ent, *inst_ent, *bh_ent, *patt_ent, *filepath_ent, *probe_in;
294 SEXP_tcxx . . $ SEXP_t# *r0;
295 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! val;
296 struct pfdatacxx . . $ pfdata# pfd;
297 int ret = 0;
298 int errorffset = -1;
299 char *error;
300 OVAL_FTScxx . . $ OVAL_FTS# *ofts;
301 OVAL_FTSENTcxx . . $ OVAL_FTSENT# *ofts_ent;
302
303 (void)arg;
304
305 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&pfd, 0, sizeof(pfd));
306
307 probe_in = probe_ctx_getobjectcxx . . $ probe_ctx_getobject(4299b6b53fa804a5).(ctx);
308
309 oval_schema_version_tcxx . . $ oval_schema_version_t# over = probe_obj_get_platform_schema_versioncxx . . $ probe_obj_get_platform_schema_version(5bacca80194debea).(probe_in);
310 path_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "path", 1);
311 file_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "filename", 1);
312 inst_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "instance", 1);
313 patt_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "pattern", 1);
314 filepath_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "filepath", 1);
315 bh_ent = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "behaviors", 1);
316
317 /* we want (path+filename or filepath) + instance + pattern*/
318 if ( ((path_ent == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || file_ent == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && filepath_ent==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) ||
319 inst_ent==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ||
320 patt_ent==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
321 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (patt_ent);
322 ret = PROBE_ENOELMcxx . . $ `src/OVAL/probes/public/probe-common.h:9:9`!;
323 goto cleanup;
324 }
325
326 /* get pattern from SEXP */
327 SEXP_tcxx . . $ SEXP_t# *ent_val;
328 ent_val = probe_ent_getvalcxx . . $ probe_ent_getval(2f7f980afaaae0f0).(patt_ent);
329 pfd.patterncxx . . $ pfdata#pattern. = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(ent_val);
330 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(patt_ent);
331 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(ent_val);
332 if (pfd.patterncxx . . $ pfdata#pattern. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
333 ret = -1;
334 goto cleanup;
335 }
336
337 probe_tfc54behaviors_canonicalizecxx . . $ probe_tfc54behaviors_canonicalize(e661f441b24a5de6).(&bh_ent);
338
339 pfd.instance_entcxx . . $ pfdata#instance_ent. = inst_ent;
340 pfd.ctxcxx . . $ pfdata#ctx. = ctx;
341 pfd.re_optscxx . . $ pfdata#re_opts. = OSCAP_PCRE_OPTS_UTF8cxx . . $ OSCAP_PCRE_OPTS_UTF8.;
342 r0 = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(bh_ent, "ignore_case");
343 if (r0) {
344 val = SEXP_string_getbcxx . . $ SEXP_string_getb(85f078d1f48ac431).(r0);
345 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r0);
346 if (val)
347 pfd.re_optscxx . . $ pfdata#re_opts. |= OSCAP_PCRE_OPTS_CASELESScxx . . $ OSCAP_PCRE_OPTS_CASELESS.;
348 }
349 r0 = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(bh_ent, "multiline");
350 if (r0) {
351 val = SEXP_string_getbcxx . . $ SEXP_string_getb(85f078d1f48ac431).(r0);
352 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r0);
353 if (val)
354 pfd.re_optscxx . . $ pfdata#re_opts. |= OSCAP_PCRE_OPTS_MULTILINEcxx . . $ OSCAP_PCRE_OPTS_MULTILINE.;
355 }
356 r0 = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(bh_ent, "singleline");
357 if (r0) {
358 val = SEXP_string_getbcxx . . $ SEXP_string_getb(85f078d1f48ac431).(r0);
359 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r0);
360 if (val)
361 pfd.re_optscxx . . $ pfdata#re_opts. |= OSCAP_PCRE_OPTS_DOTALLcxx . . $ OSCAP_PCRE_OPTS_DOTALL.;
362 }
363
364 pfd.compiled_regexcxx . . $ pfdata#compiled_regex. = oscap_pcre_compilecxx . . $ oscap_pcre_compile(29ca11f2d36a957a).(pfd.patterncxx . . $ pfdata#pattern., pfd.re_optscxx . . $ pfdata#re_opts., &error, &errorffset);
365 if (pfd.compiled_regexcxx . . $ pfdata#compiled_regex. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
366 SEXP_tcxx . . $ SEXP_t# *msg;
367
368 msg = probe_msg_creatfcxx . . $ probe_msg_creatf(2da488f08a70551b).(OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "oscap_pcre_compile() '%s' %s.", pfd.patterncxx . . $ pfdata#pattern., error);
369 probe_cobj_add_msgcxx . . $ probe_cobj_add_msg(ef7ee42b5817e0be).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd.ctxcxx . . $ pfdata#ctx.), msg);
370 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(msg);
371 probe_cobj_set_flagcxx . . $ probe_cobj_set_flag(644bab5dffe689c).(probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(pfd.ctxcxx . . $ pfdata#ctx.), SYSCHAR_FLAG_ERRORcxx . . $ SYSCHAR_FLAG_ERROR.);
372 oscap_pcre_err_freecxx . . $ oscap_pcre_err_free(fda57c8427c60377).(error);
373 goto cleanup;
374 }
375
376 const char *prefix = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT");
377
378 if ((ofts = oval_fts_open_prefixedcxx . . $ oval_fts_open_prefixed(d2d91f0fe545c5d7).(prefix, path_ent, file_ent, filepath_ent, bh_ent, probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(ctx))) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
379 while ((ofts_ent = oval_fts_readcxx . . $ oval_fts_read(592d87f37bbdbe51).(ofts)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
380 if (ofts_ent->fts_infocxx . . $ $anonymous_type_ebdee0feb58b991e_1#fts_info. == FTS_Fcxx . . $ `<external>/345209348829246610/fts.h:126:9`!
381 || ofts_ent->fts_infocxx . . $ $anonymous_type_ebdee0feb58b991e_1#fts_info. == FTS_SLcxx . . $ `<external>/345209348829246610/fts.h:130:9`!) {
382 // todo: handle return code
383 process_filecxx . . $ process_file(1478ec65bdad9ed8).(prefix, ofts_ent->pathcxx . . $ $anonymous_type_ebdee0feb58b991e_1#path., ofts_ent->filecxx . . $ $anonymous_type_ebdee0feb58b991e_1#file., &pfd, over, ctx->blocked_pathscxx . . $ probe_ctx#blocked_paths.);
384 }
385 oval_ftsent_freecxx . . $ oval_ftsent_free(7e09326da17d8ab0).(ofts_ent);
386 }
387
388 oval_fts_closecxx . . $ oval_fts_close(cd898f79c195c42c).(ofts);
389 }
390
391 cleanup:
392 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(file_ent);
393 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(path_ent);
394 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(inst_ent);
395 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(bh_ent);
396 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(filepath_ent);
397 if (pfd.patterncxx . . $ pfdata#pattern. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
398 freecxx . . $ free(5d22bdacc48458e8).(pfd.patterncxx . . $ pfdata#pattern.);
399 if (pfd.compiled_regexcxx . . $ pfdata#compiled_regex. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
400 oscap_pcre_freecxx . . $ oscap_pcre_free(804bb72472b0846e).(pfd.compiled_regexcxx . . $ pfdata#compiled_regex.);
401 return ret;
402 }