Debian Codegraph @

src/OVAL/probes/unix/linux/partition_probe.c

raw symbols SCIP
1 /**
2 * @file partition_probe.c
3 * @brief partition probe implementation
4 * @author "Daniel Kopecek" <[email protected]>
5 *
6 */
7
8 /*
9 * Copyright 2011 Red Hat Inc., Durham, North Carolina.
10 * All Rights Reserved.
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 * Authors:
27 * "Daniel Kopecek" <[email protected]>
28 */
29
30 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
31 #include <config.h>cxx . . $ `<file>/build/config.h`/
32 #endif
33
34 #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!)
35 #undef _XOPEN_SOURCEcxx . . $ `<external>/18206667465210621810/features.h:228:10`!
36 #define _XOPEN_SOURCEcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:36:9`! /* for fdopen */
37 #include <sys/vfs.h>
38 #include <sys/types.h>
39 #include <sys/stat.h>
40 #include <fcntl.h>
41 #include <stdio.h>
42 #include <linux/fs.h>
43
44 #ifdef HAVE_PROC_MAGIC
45 #include <linux/magic.h>
46 #else /* RHEL5 work-around */
47 #define PROC_SUPER_MAGICcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:47:9`! 0x9fa0
48 #endif
49
50 #endif
51
52
53 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
54 #include <blkid/blkid.h>
55 #endif
56
57 #include <stdlib.h>
58 #include <string.h>
59 #include <stdint.h>
60 #include <limits.h>
61 #include <sys/statvfs.h>
62 #include <probe-api.h>cxx . . $ `<file>/src/OVAL/probes/public/probe-api.h`/
63 #include <probe/probe.h>cxx . . $ `<file>/src/OVAL/probes/probe/probe.h`/
64 #include <probe/option.h>cxx . . $ `<file>/src/OVAL/probes/probe/option.h`/
65 #include <mntent.h>
66
67 #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
68 #include "common/oscap_pcre.h"cxx . . $ `<file>/src/common/oscap_pcre.h`/
69 #include "partition_probe.h"cxx . . $ `<file>/src/OVAL/probes/unix/linux/partition_probe.h`/
70
71 #ifndef MTAB_PATH
72 # define MTAB_PATHcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:72:10`! "/proc/mounts"
73 #endif
74
75 #ifndef MTAB_LINE_MAX
76 # define MTAB_LINE_MAXcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:76:10`! 4096
77 #endif
78
79 const char *__OVAL_fs_typescxx . . $ __OVAL_fs_types.[][2] = {
80 { "adfs", "ADFS_SUPER_MAGIC" },
81 { "affs", "AFFS_SUPER_MAGIC" },
82 { "afs", "AFS_SUPER_MAGIC" },
83 { "autofs", "AUTOFS_SUPER_MAGIC" },
84 { "coda", "CODA_SUPER_MAGIC" },
85 { "cramfs", "CRAMFS_MAGIC" },
86 { "cramfs", "CRAMFS_MAGIC_WEND" },
87 { "debugfs", "DEBUGFS_MAGIC" },
88 { "sysfs", "SYSFS_MAGIC" },
89 { "securityfs", "SECURITYFS_MAGIC" },
90 { "selinuxfs", "SELINUX_MAGIC" },
91 { "ramfs", "RAMFS_MAGIC" },
92 { "tmpfs", "TMPFS_MAGIC" },
93 { "hugetlbfs", "HUGETLBFS_MAGIC" },
94 { "squashfs", "SQUASHFS_MAGIC" },
95 { "efs", "EFS_SUPER_MAGIC" },
96 { "ext2", "EXT2_SUPER_MAGIC" },
97 { "ext3", "EXT3_SUPER_MAGIC" },
98 { "xenfs", "XENFS_SUPER_MAGIC" },
99 { "ext4", "EXT4_SUPER_MAGIC" },
100 { "btrfs", "BTRFS_SUPER_MAGIC" },
101 { "hpfs", "HPFS_SUPER_MAGIC" },
102 { "iso9660", "ISOFS_SUPER_MAGIC" },
103 { "jffs2", "JFFS2_SUPER_MAGIC" },
104 { "anon", "ANON_INODE_FS_MAGIC" },
105 { "minix", "MINIX_SUPER_MAGIC" },
106 { "minix", "MINIX_SUPER_MAGIC2" },
107 { "minix2", "MINIX2_SUPER_MAGIC" },
108 { "minix2", "MINIX2_SUPER_MAGIC2" },
109 { "minix3", "MINIX3_SUPER_MAGIC" },
110 { "msdos", "MSDOS_SUPER_MAGIC" },
111 { "ncpfs", "NCP_SUPER_MAGIC" },
112 { "nfs", "NFS_SUPER_MAGIC" },
113 { "openprom", "OPENPROM_SUPER_MAGIC" },
114 { "proc", "PROC_SUPER_MAGIC" },
115 { "qnx4", "QNX4_SUPER_MAGIC" },
116 { "reiserfs", "REISERFS_SUPER_MAGIC" },
117 { "reiserfs", "REISERFS_SUPER_MAGIC_STRING" },
118 { "reiser2fs", "REISER2FS_SUPER_MAGIC_STRING" },
119 { "reiser2fs", "REISER2FS_JR_SUPER_MAGIC_STRING" },
120 { "smbfs", "SMB_SUPER_MAGIC" },
121 { "usbdevfs", "USBDEVICE_SUPER_MAGIC" },
122 { "usbfs", "USBDEVICE_SUPER_MAGIC" },
123 { "cgroup", "CGROUP_SUPER_MAGIC" },
124 { "futexfs", "FUTEXFS_SUPER_MAGIC" },
125 { "stack", "STACK_END_MAGIC" },
126 { "devpts", "DEVPTS_SUPER_MAGIC" },
127 { "sockfs", "SOCKFS_MAGIC" }
128 };
129
130 static const char *correct_fstypecxx . . $ correct_fstype(bff12ae9a608a69a).(char *type)
131 {
132 register size_t i;
133
134 for (i = 0; i < sizeof __OVAL_fs_typescxx . . $ __OVAL_fs_types./(sizeof(char *) * 2); ++i) {
135 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(__OVAL_fs_typescxx . . $ __OVAL_fs_types.[i][0], type) == 0)
136 return __OVAL_fs_typescxx . . $ __OVAL_fs_types.[i][1];
137 }
138
139 return "";
140 }
141
142 static uint8_tcxx . . $ uint8_t# add_mnt_optcxx . . $ add_mnt_opt(88b9ff2f01b424bb).(char ***mnt_opts, uint8_tcxx . . $ uint8_t# mnt_ocnt, char *opt)
143 {
144 void *new_mnt_opts = realloccxx . . $ realloc(417ab160f6baadc6).(*mnt_opts, sizeof(char *) * (mnt_ocnt + 2));
145 if (new_mnt_opts == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
146 return mnt_ocnt;
147 *mnt_opts = new_mnt_opts;
148 (*mnt_opts)[mnt_ocnt] = opt;
149 (*mnt_opts)[mnt_ocnt + 1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
150 return mnt_ocnt + 1;
151 }
152
153 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
154 static int collect_itemcxx . . $ collect_item(ee1286d0424e297).(probe_ctxcxx . . $ probe_ctx# *ctx, oval_schema_version_tcxx . . $ oval_schema_version_t# over, struct mntentcxx . . $ mntent# *mnt_ent, blkid_cachecxx . . $ blkid_cache# blkcache)
155 #else
156 static int collect_item(probe_ctx *ctx, oval_schema_version_t over, struct mntent *mnt_ent)
157 #endif
158 {
159 SEXP_tcxx . . $ SEXP_t# *item;
160 char *uuid = "", *tok, *save = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, **mnt_opts = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
161 char path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
162 uint8_tcxx . . $ uint8_t# mnt_ocnt;
163 struct statvfscxx . . $ statvfs# stvfs;
164
165 /*
166 * Get FS stats
167 */
168 const char *prefix = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT");
169 snprintfcxx . . $ snprintf(ea502d73e74c754c).(path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s%s", prefix ? prefix : "", mnt_ent->mnt_dircxx . . $ mntent#mnt_dir.);
170 if (statvfscxx . . $ statvfs(b2fdbc4bb2d0b440).(path, &stvfs) != 0) {
171 dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't statvfs %s: errno=%d, %s.", path, errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
172 return (-1);
173 }
174
175 /*
176 * Get UUID
177 */
178 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
179 uuid = blkid_get_tag_valuecxx . . $ blkid_get_tag_value(3dc1647d5ce8168c).(blkcache, "UUID", mnt_ent->mnt_fsnamecxx . . $ mntent#mnt_fsname.);
180 if (uuid == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
181 uuid = strdupcxx . . $ strdup(a8b8e32347182212).("");
182 }
183 #endif
184 /*
185 * Create a NULL-terminated array from the mount options
186 */
187 mnt_ocnt = 0;
188
189 tok = strtok_rcxx . . $ strtok_r(a42394c85d6397dd).(mnt_ent->mnt_optscxx . . $ mntent#mnt_opts., ",", &save);
190
191 do {
192 mnt_ocnt = add_mnt_optcxx . . $ add_mnt_opt(88b9ff2f01b424bb).(&mnt_opts, mnt_ocnt, tok);
193 } while ((tok = strtok_rcxx . . $ strtok_r(a42394c85d6397dd).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, ",", &save)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
194
195 /*
196 * Check for "remount", "bind" and "move" mount options
197 * These options can't be found in /proc/mounts,
198 * we must use flags got by statvfs().
199 */
200 if (stvfs.f_flagcxx . . $ statvfs#f_flag. & MS_REMOUNTcxx . . $ `<external>/17994627758457292539/mount.h:18:9`!) {
201 mnt_ocnt = add_mnt_optcxx . . $ add_mnt_opt(88b9ff2f01b424bb).(&mnt_opts, mnt_ocnt, "remount");
202 }
203 if (stvfs.f_flagcxx . . $ statvfs#f_flag. & MS_BINDcxx . . $ `<external>/17994627758457292539/mount.h:24:9`!) {
204 mnt_ocnt = add_mnt_optcxx . . $ add_mnt_opt(88b9ff2f01b424bb).(&mnt_opts, mnt_ocnt, "bind");
205 }
206 if (stvfs.f_flagcxx . . $ statvfs#f_flag. & MS_MOVEcxx . . $ `<external>/17994627758457292539/mount.h:25:9`!) {
207 mnt_ocnt = add_mnt_optcxx . . $ add_mnt_opt(88b9ff2f01b424bb).(&mnt_opts, mnt_ocnt, "move");
208 }
209
210 dDcxx . . $ `src/common/debug_priv.h:64:9`!("mnt_ocnt = %d, mnt_opts[mnt_ocnt]=%p", mnt_ocnt, mnt_opts == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : mnt_opts[mnt_ocnt]);
211
212 /*
213 * "Correct" the type (this won't be (hopefully) needed in a later version
214 * of OVAL)
215 */
216 if (oval_schema_version_cmpcxx . . $ oval_schema_version_cmp(b4d0c2bfb97f274f).(over, OVAL_SCHEMA_VERSIONcxx . . $ `src/OVAL/public/oval_schema_version.h:39:9`!(5.10)) < 0)
217 mnt_ent->mnt_typecxx . . $ mntent#mnt_type. = (char *)correct_fstypecxx . . $ correct_fstype(bff12ae9a608a69a).(mnt_ent->mnt_typecxx . . $ mntent#mnt_type.);
218
219 /*
220 * Create the item
221 */
222 item = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c).(OVAL_LINUX_PARTITIONcxx . . $ OVAL_LINUX_PARTITION., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
223 "mount_point", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., mnt_ent->mnt_dircxx . . $ mntent#mnt_dir.,
224 "device", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., mnt_ent->mnt_fsnamecxx . . $ mntent#mnt_fsname.,
225 "uuid", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., uuid,
226 "fs_type", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., mnt_ent->mnt_typecxx . . $ mntent#mnt_type.,
227 "mount_options", OVAL_DATATYPE_STRING_Mcxx . . $ OVAL_DATATYPE_STRING_M., mnt_opts,
228 "total_space", OVAL_DATATYPE_INTEGERcxx . . $ OVAL_DATATYPE_INTEGER., (int64_tcxx . . $ int64_t#)stvfs.f_blockscxx . . $ statvfs#f_blocks.,
229 "space_used", OVAL_DATATYPE_INTEGERcxx . . $ OVAL_DATATYPE_INTEGER., (int64_tcxx . . $ int64_t#)(stvfs.f_blockscxx . . $ statvfs#f_blocks. - stvfs.f_bfreecxx . . $ statvfs#f_bfree.),
230 "space_left", OVAL_DATATYPE_INTEGERcxx . . $ OVAL_DATATYPE_INTEGER., (int64_tcxx . . $ int64_t#)stvfs.f_bfreecxx . . $ statvfs#f_bfree.,
231 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
232
233 if (oval_schema_version_cmpcxx . . $ oval_schema_version_cmp(b4d0c2bfb97f274f).(over, OVAL_SCHEMA_VERSIONcxx . . $ `src/OVAL/public/oval_schema_version.h:39:9`!(5.11.2)) >= 0) {
234 SEXP_tcxx . . $ SEXP_t# *block_size = SEXP_number_newi_64cxx . . $ SEXP_number_newi_64(986154d47f221621).(stvfs.f_frsizecxx . . $ statvfs#f_frsize.);
235 probe_item_ent_addcxx . . $ probe_item_ent_add(9f488d3b029fc9d1).(item, "block_size", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, block_size);
236 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(block_size);
237 }
238
239 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
240 /*
241 * If the partition doesn't have an UUID assigned, set the uuid entity status to
242 * "does not exist" which means that the value was collected but does not exist
243 * on the system.
244 */
245 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(uuid, "") == 0) {
246 probe_itement_setstatuscxx . . $ probe_itement_setstatus(998e25cd01fde21b).(item, "uuid", 1, SYSCHAR_STATUS_DOES_NOT_EXISTcxx . . $ SYSCHAR_STATUS_DOES_NOT_EXIST.);
247 }
248 freecxx . . $ free(5d22bdacc48458e8).(uuid);
249 #else
250 /* Compiled without blkid library, we don't collect UUID */
251 probe_itement_setstatus(item, "uuid", 1, SYSCHAR_STATUS_NOT_COLLECTED);
252 #endif /* HAVE_BLKID_GET_TAG_VALUE */
253
254 probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(ctx, item);
255 freecxx . . $ free(5d22bdacc48458e8).(mnt_opts);
256
257 return (0);
258 }
259
260 int patition_probe_offline_mode_supportedcxx . . $ patition_probe_offline_mode_supported(b126dc7c1de90089).(void)
261 {
262 return PROBE_OFFLINE_OWNcxx . . $ PROBE_OFFLINE_OWN.;
263 }
264
265 int partition_probe_maincxx . . $ partition_probe_main(470536d3ffacaf10).(probe_ctxcxx . . $ probe_ctx# *ctx, void *probe_arg)
266 {
267 int probe_ret = 0;
268 SEXP_tcxx . . $ SEXP_t# *mnt_entity, *mnt_opval, *mnt_entval, *probe_in;
269 char mnt_path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!];
270 oval_operation_tcxx . . $ oval_operation_t# mnt_op;
271 FILEcxx . . $ FILE# *mnt_fp;
272 oval_schema_version_tcxx . . $ oval_schema_version_t# obj_over;
273
274 const char *prefix = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT");
275 snprintfcxx . . $ snprintf(ea502d73e74c754c).(mnt_path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s"MTAB_PATHcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:72:10`!, prefix ? prefix : "");
276
277 #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!)
278 int mnt_fd;
279 struct statfscxx . . $ statfs# stfs;
280
281 mnt_fd = opencxx . . $ open(e156e3aa1e5c4ad1).(mnt_path, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!);
282
283 if (mnt_fd < 0) {
284 if (!prefix)
285 dEcxx . . $ `src/common/debug_priv.h:63:9`!("Can't open %s: errno=%d, %s.", mnt_path, errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
286 return (prefix ? PROBE_ESUCCESScxx . . $ `src/OVAL/probes/public/probe-common.h:7:9`! : PROBE_ESYSTEMcxx . . $ `src/OVAL/probes/public/probe-api.h:436:9`!);
287 }
288
289 if (fstatfscxx . . $ fstatfs(cd92bacb16ee1aa).(mnt_fd, &stfs) != 0) {
290 closecxx . . $ close(7864480464b09eea).(mnt_fd);
291 return (prefix ? PROBE_ESUCCESScxx . . $ `src/OVAL/probes/public/probe-common.h:7:9`! : PROBE_ESYSTEMcxx . . $ `src/OVAL/probes/public/probe-api.h:436:9`!);
292 }
293
294 if (stfs.f_typecxx . . $ statfs#f_type. != PROC_SUPER_MAGICcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:47:9`!) {
295 closecxx . . $ close(7864480464b09eea).(mnt_fd);
296 return (prefix ? PROBE_ESUCCESScxx . . $ `src/OVAL/probes/public/probe-common.h:7:9`! : PROBE_EFATALcxx . . $ `src/OVAL/probes/public/probe-common.h:23:9`!);
297 }
298
299 mnt_fp = fdopencxx . . $ fdopen(8f4e2d7350ebd077).(mnt_fd, "r");
300
301 if (mnt_fp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
302 closecxx . . $ close(7864480464b09eea).(mnt_fd);
303 return (prefix ? PROBE_ESUCCESScxx . . $ `src/OVAL/probes/public/probe-common.h:7:9`! : PROBE_ESYSTEMcxx . . $ `src/OVAL/probes/public/probe-api.h:436:9`!);
304 }
305 #else
306 mnt_fp = fopen(mnt_path, "r");
307
308 if (mnt_fp == NULL) {
309 if (!prefix)
310 dE("Can't open %s: errno=%d, %s.", mnt_path, errno, strerror(errno));
311 return (prefix ? PROBE_ESUCCESS : PROBE_ESYSTEM);
312 }
313 #endif
314
315 probe_in = probe_ctx_getobjectcxx . . $ probe_ctx_getobject(4299b6b53fa804a5).(ctx);
316 obj_over = probe_obj_get_platform_schema_versioncxx . . $ probe_obj_get_platform_schema_version(5bacca80194debea).(probe_in);
317 mnt_entity = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3).(probe_in, "mount_point", 1);
318
319 if (mnt_entity == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
320 fclosecxx . . $ fclose(89bc1efcdac0ca22).(mnt_fp);
321 return (PROBE_ENOENTcxx . . $ `src/OVAL/probes/public/probe-common.h:20:9`!);
322 }
323
324 mnt_opval = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(mnt_entity, "operation");
325
326 if (mnt_opval != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
327 mnt_op = (oval_operation_tcxx . . $ oval_operation_t#)SEXP_number_geticxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:115:9`!(mnt_opval);
328 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(mnt_opval);
329 } else
330 mnt_op = OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.;
331
332 mnt_entval = probe_ent_getvalcxx . . $ probe_ent_getval(2f7f980afaaae0f0).(mnt_entity);
333
334 if (!SEXP_stringpcxx . . $ SEXP_stringp(85f078d1f48ac431).(mnt_entval)) {
335 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(mnt_entval);
336 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(mnt_entity);
337 fclosecxx . . $ fclose(89bc1efcdac0ca22).(mnt_fp);
338 return (PROBE_EINVALcxx . . $ `src/OVAL/probes/public/probe-common.h:8:9`!);
339 }
340
341 SEXP_string_cstr_rcxx . . $ SEXP_string_cstr_r(ca07af91a4fa826f).(mnt_entval, mnt_path, sizeof mnt_path);
342 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(mnt_entval);
343 SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(mnt_entity);
344
345 if (mnt_fp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
346 char buffer[MTAB_LINE_MAXcxx . . $ `src/OVAL/probes/unix/linux/partition_probe.c:76:10`!];
347 struct mntentcxx . . $ mntent# mnt_ent, *mnt_entp;
348
349 oscap_pcre_tcxx . . $ oscap_pcre_t# *re = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
350 char *estr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
351 int eoff = -1;
352 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
353 blkid_cachecxx . . $ blkid_cache# blkcache;
354
355 if (blkid_get_cachecxx . . $ blkid_get_cache(95dd987faea73c85).(&blkcache, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) {
356 endmntentcxx . . $ endmntent(89bc1efcdac0ca22).(mnt_fp);
357 return (PROBE_EUNKNOWNcxx . . $ `src/OVAL/probes/public/probe-common.h:24:9`!);
358 }
359 #endif
360 if (mnt_op == OVAL_OPERATION_PATTERN_MATCHcxx . . $ OVAL_OPERATION_PATTERN_MATCH.) {
361 re = oscap_pcre_compilecxx . . $ oscap_pcre_compile(29ca11f2d36a957a).(mnt_path, OSCAP_PCRE_OPTS_UTF8cxx . . $ OSCAP_PCRE_OPTS_UTF8., &estr, &eoff);
362
363 if (re == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
364 endmntentcxx . . $ endmntent(89bc1efcdac0ca22).(mnt_fp);
365 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
366 blkid_put_cachecxx . . $ blkid_put_cache(bbfd5c90a975f7c6).(blkcache);
367 #endif
368 oscap_pcre_err_freecxx . . $ oscap_pcre_err_free(fda57c8427c60377).(estr);
369 return (PROBE_EINVALcxx . . $ `src/OVAL/probes/public/probe-common.h:8:9`!);
370 }
371 }
372
373 while ((mnt_entp = getmntent_rcxx . . $ getmntent_r(99f6fc263b54d5c1).(mnt_fp, &mnt_ent,
374 buffer, sizeof buffer)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
375 {
376 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(mnt_entp->mnt_typecxx . . $ mntent#mnt_type., "rootfs") == 0)
377 continue;
378
379 if (mnt_op == OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.) {
380 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(mnt_entp->mnt_dircxx . . $ mntent#mnt_dir., mnt_path) == 0) {
381 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
382 collect_itemcxx . . $ collect_item(ee1286d0424e297).(ctx, obj_over, mnt_entp, blkcache);
383 #else
384 collect_item(ctx, obj_over, mnt_entp);
385 #endif
386 break;
387 }
388 } else if (mnt_op == OVAL_OPERATION_NOT_EQUALcxx . . $ OVAL_OPERATION_NOT_EQUAL.) {
389 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(mnt_entp->mnt_dircxx . . $ mntent#mnt_dir., mnt_path) != 0) {
390 if (
391 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
392 collect_itemcxx . . $ collect_item(ee1286d0424e297).(ctx, obj_over, mnt_entp, blkcache)
393 #else
394 collect_item(ctx, obj_over, mnt_entp)
395 #endif
396 != 0)
397 break;
398 }
399 } else if (mnt_op == OVAL_OPERATION_PATTERN_MATCHcxx . . $ OVAL_OPERATION_PATTERN_MATCH.) {
400 int rc;
401
402 rc = oscap_pcre_execcxx . . $ oscap_pcre_exec(7630dfd25fd504ec).(re, mnt_entp->mnt_dircxx . . $ mntent#mnt_dir.,
403 strlencxx . . $ strlen(751346f8406fd082).(mnt_entp->mnt_dircxx . . $ mntent#mnt_dir.), 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0);
404
405 if (rc > OSCAP_PCRE_ERR_NOMATCHcxx . . $ OSCAP_PCRE_ERR_NOMATCH.) {
406 if (
407 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
408 collect_itemcxx . . $ collect_item(ee1286d0424e297).(ctx, obj_over, mnt_entp, blkcache)
409 #else
410 collect_item(ctx, obj_over, mnt_entp)
411 #endif
412 != 0)
413 break;
414 }
415 /* XXX: check for pcre_exec error */
416 }
417 }
418
419 endmntentcxx . . $ endmntent(89bc1efcdac0ca22).(mnt_fp);
420
421 if (mnt_op == OVAL_OPERATION_PATTERN_MATCHcxx . . $ OVAL_OPERATION_PATTERN_MATCH.)
422 oscap_pcre_freecxx . . $ oscap_pcre_free(804bb72472b0846e).(re);
423 #if defined(HAVE_BLKID_GET_TAG_VALUEcxx . . $ `build/config.h:36:9`!)
424 blkid_put_cachecxx . . $ blkid_put_cache(bbfd5c90a975f7c6).(blkcache);
425 #endif
426 }
427
428 return (probe_ret);
429 }