| 1 | /** |
| 2 | * @file filehash58_probe.c |
| 3 | * @brief filehash58 probe |
| 4 | * @author "Daniel Kopecek" <[email protected]> |
| 5 | * |
| 6 | * 2011/07/01 [email protected] |
| 7 | * This probe is able to process a filehash58_object as defined in OVAL 5.8 |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * Copyright 2011 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 | * "Daniel Kopecek" <[email protected]> |
| 31 | * "Petr Lautrbach" <[email protected]> |
| 32 | */ |
| 33 | |
| 34 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 35 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 36 | #endif |
| 37 | |
| 38 | #include "_seap.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_seap.h`/ |
| 39 | #include <probe-api.h>cxx . . $ `<file>/src/OVAL/probes/public/probe-api.h`/ |
| 40 | #include <stdlib.h> |
| 41 | #include <string.h> |
| 42 | #include <sys/types.h> |
| 43 | #include <sys/stat.h> |
| 44 | #include <fcntl.h> |
| 45 | #include <limits.h> |
| 46 | #include <pthread.h> |
| 47 | #include <errno.h> |
| 48 | #include <crapi/crapi.h>cxx . . $ `<file>/src/OVAL/probes/crapi/crapi.h`/ |
| 49 | #include <probe/probe.h>cxx . . $ `<file>/src/OVAL/probes/probe/probe.h`/ |
| 50 | #include <probe/option.h>cxx . . $ `<file>/src/OVAL/probes/probe/option.h`/ |
| 51 | |
| 52 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 53 | #include "oval_fts.h"cxx . . $ `<file>/src/OVAL/probes/oval_fts.h`/ |
| 54 | #include "util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 55 | #include "probe/entcmp.h"cxx . . $ `<file>/src/OVAL/probes/probe/entcmp.h`/ |
| 56 | #include "filehash58_probe.h"cxx . . $ `<file>/src/OVAL/probes/independent/filehash58_probe.h`/ |
| 57 | #include "oscap_helpers.h"cxx . . $ `<file>/src/common/public/oscap_helpers.h`/ |
| 58 | |
| 59 | #define FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/filehash58_probe.c:59:9`! '/' |
| 60 | |
| 61 | /* List of hash types listed in OVAL specification */ |
| 62 | static const char *OVAL_FILEHASH58_HASH_TYPEScxx . . $ OVAL_FILEHASH58_HASH_TYPES.[] = { |
| 63 | "MD5", |
| 64 | "SHA-1", |
| 65 | "SHA-224", |
| 66 | "SHA-256", |
| 67 | "SHA-384", |
| 68 | "SHA-512", |
| 69 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 70 | }; |
| 71 | |
| 72 | /* List of hash types supported by OpenSCAP */ |
| 73 | static const struct oscap_string_mapcxx . . $ oscap_string_map# CRAPI_ALG_MAPcxx . . $ CRAPI_ALG_MAP.[] = { |
| 74 | #ifdef OPENSCAP_ENABLE_MD5 |
| 75 | {CRAPI_DIGEST_MD5, "MD5"}, |
| 76 | #endif |
| 77 | #ifdef OPENSCAP_ENABLE_SHA1 |
| 78 | {CRAPI_DIGEST_SHA1, "SHA-1"}, |
| 79 | #endif |
| 80 | {CRAPI_DIGEST_SHA224cxx . . $ CRAPI_DIGEST_SHA224., "SHA-224"}, |
| 81 | {CRAPI_DIGEST_SHA256cxx . . $ CRAPI_DIGEST_SHA256., "SHA-256"}, |
| 82 | {CRAPI_DIGEST_SHA384cxx . . $ CRAPI_DIGEST_SHA384., "SHA-384"}, |
| 83 | {CRAPI_DIGEST_SHA512cxx . . $ CRAPI_DIGEST_SHA512., "SHA-512"}, |
| 84 | /* {CRAPI_DIGEST_RMD160, "RMD-160"}, OVAL doesn't support this */ |
| 85 | {0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!} |
| 86 | }; |
| 87 | |
| 88 | static const struct oscap_string_mapcxx . . $ oscap_string_map# CRAPI_ALG_MAP_SIZEcxx . . $ CRAPI_ALG_MAP_SIZE.[] = { |
| 89 | #ifdef OPENSCAP_ENABLE_MD5 |
| 90 | {16, "MD5"}, |
| 91 | #endif |
| 92 | #ifdef OPENSCAP_ENABLE_SHA1 |
| 93 | {20, "SHA-1"}, |
| 94 | #endif |
| 95 | {28, "SHA-224"}, |
| 96 | {32, "SHA-256"}, |
| 97 | {48, "SHA-384"}, |
| 98 | {64, "SHA-512"}, |
| 99 | /* {20, "RMD-160"}, OVAL doesn't support this */ |
| 100 | {0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!} |
| 101 | }; |
| 102 | |
| 103 | |
| 104 | static int mem2hexcxx . . $ mem2hex(17363ab32eacdcb9). (uint8_tcxx . . $ uint8_t# *mem, size_t mlen, char *str, size_t slen) |
| 105 | { |
| 106 | const char ch[] = "0123456789abcdef"; |
| 107 | register size_t i; |
| 108 | |
| 109 | if (slen < (mlen * 2) + 1) { |
| 110 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = ENOBUFScxx . . $ `<external>/17922322188510340118/errno.h:89:9`!; |
| 111 | return (-1); |
| 112 | } |
| 113 | |
| 114 | for (i = 0; i < mlen; ++i) { |
| 115 | str[i*2 ] = ch[(mem[i] & 0xf0) >> 4]; |
| 116 | str[i*2+1] = ch[(mem[i] & 0x0f)]; |
| 117 | } |
| 118 | |
| 119 | str[i*2] = '\0'; |
| 120 | |
| 121 | return (0); |
| 122 | } |
| 123 | |
| 124 | static int filehash58_cbcxx . . $ filehash58_cb(47aa398fde4fc20c).(const char *prefix, const char *p, const char *f, const char *h, probe_ctxcxx . . $ probe_ctx# *ctx) |
| 125 | { |
| 126 | SEXP_tcxx . . $ SEXP_t# *itm; |
| 127 | |
| 128 | char pbuf[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!+1]; |
| 129 | size_t plen, flen; |
| 130 | |
| 131 | int fd; |
| 132 | |
| 133 | if (f == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 134 | return (0); |
| 135 | |
| 136 | /* |
| 137 | * Prepare path |
| 138 | */ |
| 139 | plen = strlencxx . . $ strlen(751346f8406fd082). (p); |
| 140 | flen = strlencxx . . $ strlen(751346f8406fd082). (f); |
| 141 | |
| 142 | if (plen + flen + 1 > PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) |
| 143 | return (-1); |
| 144 | |
| 145 | memcpycxx . . $ memcpy(cc817cb175f282d). (pbuf, p, sizeof (char) * plen); |
| 146 | |
| 147 | if (p[plen - 1] != FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/filehash58_probe.c:59:9`!) { |
| 148 | pbuf[plen] = FILE_SEPARATORcxx . . $ `src/OVAL/probes/independent/filehash58_probe.c:59:9`!; |
| 149 | ++plen; |
| 150 | } |
| 151 | |
| 152 | memcpycxx . . $ memcpy(cc817cb175f282d). (pbuf + plen, f, sizeof (char) * flen); |
| 153 | pbuf[plen+flen] = '\0'; |
| 154 | |
| 155 | if (probe_path_is_blockedcxx . . $ probe_path_is_blocked(6f786adec44f4a13).(pbuf, ctx->blocked_pathscxx . . $ probe_ctx#blocked_paths.)) { |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | * Open the file |
| 161 | */ |
| 162 | if (prefix == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 163 | fd = opencxx . . $ open(e156e3aa1e5c4ad1).(pbuf, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!); |
| 164 | } else { |
| 165 | char *path_with_prefix = oscap_path_joincxx . . $ oscap_path_join(a713fe7b9a57cf96).(prefix, pbuf); |
| 166 | fd = opencxx . . $ open(e156e3aa1e5c4ad1).(path_with_prefix, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!); |
| 167 | freecxx . . $ free(5d22bdacc48458e8).(path_with_prefix); |
| 168 | } |
| 169 | |
| 170 | if (fd < 0) { |
| 171 | #define __ERRBUF_SIZEcxx . . $ `src/OVAL/probes/independent/filehash58_probe.c:171:11`! 128 |
| 172 | char errbuf[__ERRBUF_SIZEcxx . . $ `src/OVAL/probes/independent/filehash58_probe.c:171:11`!] = {0}; |
| 173 | oscap_strerror_rcxx . . $ oscap_strerror_r(c3cf521967a2a310).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, errbuf, sizeof errbuf - 1); |
| 174 | |
| 175 | itm = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c). (OVAL_INDEPENDENT_FILE_HASH58cxx . . $ OVAL_INDEPENDENT_FILE_HASH58., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 176 | "filepath", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pbuf, |
| 177 | "path", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., p, |
| 178 | "filename", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., f, |
| 179 | "hash_type",OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., h, |
| 180 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 181 | probe_item_add_msgcxx . . $ probe_item_add_msg(c5b7a86259de5bd8).(itm, OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., |
| 182 | "Can't open \"%s\": %s (errno=%d).", pbuf, errbuf, errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!); |
| 183 | probe_item_setstatuscxx . . $ probe_item_setstatus(112b785eb420e6c0).(itm, SYSCHAR_STATUS_ERRORcxx . . $ SYSCHAR_STATUS_ERROR.); |
| 184 | |
| 185 | probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(ctx, itm); |
| 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | uint8_tcxx . . $ uint8_t# hash_dst[1025]; |
| 190 | size_t hash_dstlen = sizeof(hash_dst); |
| 191 | char hash_str[2051]; |
| 192 | crapi_alg_tcxx . . $ crapi_alg_t# hash_type; |
| 193 | |
| 194 | hash_type = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(CRAPI_ALG_MAPcxx . . $ CRAPI_ALG_MAP., h); |
| 195 | if (hash_type == 0) { |
| 196 | char *msg = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("This version of OpenSCAP doesn't support the '%s' hash algorithm.", h); |
| 197 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("%s", msg); |
| 198 | itm = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c). (OVAL_INDEPENDENT_FILE_HASH58cxx . . $ OVAL_INDEPENDENT_FILE_HASH58., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 199 | "filepath", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pbuf, |
| 200 | "path", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., p, |
| 201 | "filename", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., f, |
| 202 | "hash_type", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., h, |
| 203 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 204 | probe_item_add_msgcxx . . $ probe_item_add_msg(c5b7a86259de5bd8).(itm, OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., "%s", msg); |
| 205 | freecxx . . $ free(5d22bdacc48458e8).(msg); |
| 206 | probe_item_setstatuscxx . . $ probe_item_setstatus(112b785eb420e6c0).(itm, SYSCHAR_STATUS_ERRORcxx . . $ SYSCHAR_STATUS_ERROR.); |
| 207 | probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(ctx, itm); |
| 208 | closecxx . . $ close(7864480464b09eea).(fd); |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | hash_dstlen = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(CRAPI_ALG_MAP_SIZEcxx . . $ CRAPI_ALG_MAP_SIZE., h); |
| 213 | |
| 214 | /* |
| 215 | * Compute hash value |
| 216 | */ |
| 217 | if (crapi_mdigest_fdcxx . . $ crapi_mdigest_fd(cac4efb70f20a0fb).(fd, 1, hash_type, hash_dst, &hash_dstlen) != 0) { |
| 218 | closecxx . . $ close(7864480464b09eea). (fd); |
| 219 | return (-1); |
| 220 | } |
| 221 | |
| 222 | closecxx . . $ close(7864480464b09eea). (fd); |
| 223 | |
| 224 | hash_str[0] = '\0'; |
| 225 | mem2hexcxx . . $ mem2hex(17363ab32eacdcb9).(hash_dst, hash_dstlen, hash_str, sizeof(hash_str)); |
| 226 | |
| 227 | /* |
| 228 | * Create and add the item |
| 229 | */ |
| 230 | itm = probe_item_createcxx . . $ probe_item_create(36b16a6622050a9c).(OVAL_INDEPENDENT_FILE_HASH58cxx . . $ OVAL_INDEPENDENT_FILE_HASH58., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 231 | "filepath", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., pbuf, |
| 232 | "path", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., p, |
| 233 | "filename", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., f, |
| 234 | "hash_type",OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., h, |
| 235 | "hash", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING., hash_str, |
| 236 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 237 | |
| 238 | if (hash_dstlen == 0) { |
| 239 | probe_item_add_msgcxx . . $ probe_item_add_msg(c5b7a86259de5bd8).(itm, OVAL_MESSAGE_LEVEL_ERRORcxx . . $ OVAL_MESSAGE_LEVEL_ERROR., |
| 240 | "Unable to compute %s hash value of \"%s\".", h, pbuf); |
| 241 | probe_item_setstatuscxx . . $ probe_item_setstatus(112b785eb420e6c0).(itm, SYSCHAR_STATUS_ERRORcxx . . $ SYSCHAR_STATUS_ERROR.); |
| 242 | } |
| 243 | |
| 244 | probe_item_collectcxx . . $ probe_item_collect(11bb80e0c30650d7).(ctx, itm); |
| 245 | |
| 246 | return (0); |
| 247 | } |
| 248 | |
| 249 | int filehash58_probe_offline_mode_supportedcxx . . $ filehash58_probe_offline_mode_supported(b126dc7c1de90089).() |
| 250 | { |
| 251 | return PROBE_OFFLINE_OWNcxx . . $ PROBE_OFFLINE_OWN.; |
| 252 | } |
| 253 | |
| 254 | void *filehash58_probe_initcxx . . $ filehash58_probe_init(50c7df7de5344ebb).(void) |
| 255 | { |
| 256 | /* |
| 257 | * Initialize mutex. |
| 258 | */ |
| 259 | pthread_mutex_tcxx . . $ pthread_mutex_t# *filehash58_probe_mutex = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(pthread_mutex_tcxx . . $ pthread_mutex_t#)); |
| 260 | switch (pthread_mutex_initcxx . . $ pthread_mutex_init(db9d29dab44ea1aa).(filehash58_probe_mutex, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 261 | case 0: |
| 262 | return ((void *)filehash58_probe_mutex); |
| 263 | default: |
| 264 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("Can't initialize mutex: errno=%u, %s.", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 265 | freecxx . . $ free(5d22bdacc48458e8).(filehash58_probe_mutex); |
| 266 | } |
| 267 | |
| 268 | return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 269 | } |
| 270 | |
| 271 | void filehash58_probe_finicxx . . $ filehash58_probe_fini(5d22bdacc48458e8).(void *arg) |
| 272 | { |
| 273 | /* |
| 274 | * Destroy mutex. |
| 275 | */ |
| 276 | pthread_mutex_tcxx . . $ pthread_mutex_t# *filehash58_probe_mutex = (pthread_mutex_tcxx . . $ pthread_mutex_t# *)arg; |
| 277 | (void) pthread_mutex_destroycxx . . $ pthread_mutex_destroy(d89ae235521888f9).(filehash58_probe_mutex); |
| 278 | freecxx . . $ free(5d22bdacc48458e8).(filehash58_probe_mutex); |
| 279 | } |
| 280 | |
| 281 | int filehash58_probe_maincxx . . $ filehash58_probe_main(470536d3ffacaf10).(probe_ctxcxx . . $ probe_ctx# *ctx, void *arg) |
| 282 | { |
| 283 | SEXP_tcxx . . $ SEXP_t# *probe_in; |
| 284 | SEXP_tcxx . . $ SEXP_t# *path, *filename, *behaviors, *filepath, *hash_type; |
| 285 | char hash_type_str[128]; |
| 286 | int err = 0; |
| 287 | |
| 288 | OVAL_FTScxx . . $ OVAL_FTS# *ofts; |
| 289 | OVAL_FTSENTcxx . . $ OVAL_FTSENT# *ofts_ent; |
| 290 | |
| 291 | pthread_mutex_tcxx . . $ pthread_mutex_t# *filehash58_probe_mutex = (pthread_mutex_tcxx . . $ pthread_mutex_t# *)arg; |
| 292 | if (filehash58_probe_mutex == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 293 | return (PROBE_EINITcxx . . $ `src/OVAL/probes/public/probe-common.h:12:9`!); |
| 294 | } |
| 295 | |
| 296 | probe_in = probe_ctx_getobjectcxx . . $ probe_ctx_getobject(4299b6b53fa804a5).(ctx); |
| 297 | |
| 298 | path = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3). (probe_in, "path", 1); |
| 299 | filename = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3). (probe_in, "filename", 1); |
| 300 | behaviors = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3). (probe_in, "behaviors", 1); |
| 301 | filepath = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3). (probe_in, "filepath", 1); |
| 302 | hash_type = probe_obj_getentcxx . . $ probe_obj_getent(7907a01f2ff841f3). (probe_in, "hash_type", 1); |
| 303 | |
| 304 | /* we want hash_type and either path+filename or filepath */ |
| 305 | if ( ! hash_type || |
| 306 | ((path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || filename == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && filepath==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ) |
| 307 | ) { |
| 308 | err = PROBE_ENOENTcxx . . $ `src/OVAL/probes/public/probe-common.h:20:9`!; |
| 309 | goto cleanup; |
| 310 | } |
| 311 | |
| 312 | PROBE_ENT_STRVALcxx . . $ `src/OVAL/probes/public/probe-api.h:487:9`!(hash_type, hash_type_str, sizeof hash_type_str, err = PROBE_ENOVALcxx . . $ `src/OVAL/probes/public/probe-common.h:10:9`!;, err = PROBE_ENOVALcxx . . $ `src/OVAL/probes/public/probe-common.h:10:9`!;); |
| 313 | if (err != 0) |
| 314 | goto cleanup; |
| 315 | |
| 316 | probe_filebehaviors_canonicalizecxx . . $ probe_filebehaviors_canonicalize(e661f441b24a5de6).(&behaviors); |
| 317 | |
| 318 | switch (pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(filehash58_probe_mutex)) { |
| 319 | case 0: |
| 320 | break; |
| 321 | default: |
| 322 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("Can't lock mutex(%p): %u, %s.", filehash58_probe_mutex, errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 323 | |
| 324 | err = PROBE_EFATALcxx . . $ `src/OVAL/probes/public/probe-common.h:23:9`!; |
| 325 | goto cleanup; |
| 326 | } |
| 327 | |
| 328 | const char *prefix = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT"); |
| 329 | if ((ofts = oval_fts_open_prefixedcxx . . $ oval_fts_open_prefixed(d2d91f0fe545c5d7).(prefix, path, filename, filepath, behaviors, probe_ctx_getresultcxx . . $ probe_ctx_getresult(4299b6b53fa804a5).(ctx))) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 330 | 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`!) { |
| 331 | /* find hash types to compare with entity, think "not satisfy" */ |
| 332 | for (int i = 0; OVAL_FILEHASH58_HASH_TYPEScxx . . $ OVAL_FILEHASH58_HASH_TYPES.[i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; i++) { |
| 333 | const char *oval_filehash58_hash_type = OVAL_FILEHASH58_HASH_TYPEScxx . . $ OVAL_FILEHASH58_HASH_TYPES.[i]; |
| 334 | SEXP_tcxx . . $ SEXP_t# *oval_filehash58_hash_type_sexp = SEXP_string_newcxx . . $ SEXP_string_new(a588a58d7514eee2).(oval_filehash58_hash_type, strlencxx . . $ strlen(751346f8406fd082).(oval_filehash58_hash_type)); |
| 335 | if (probe_entobj_cmpcxx . . $ probe_entobj_cmp(e245451a1311e799).(hash_type, oval_filehash58_hash_type_sexp) == OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.) { |
| 336 | filehash58_cbcxx . . $ filehash58_cb(47aa398fde4fc20c).(prefix, ofts_ent->pathcxx . . $ $anonymous_type_ebdee0feb58b991e_1#path., ofts_ent->filecxx . . $ $anonymous_type_ebdee0feb58b991e_1#file., oval_filehash58_hash_type, ctx); |
| 337 | } |
| 338 | |
| 339 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(oval_filehash58_hash_type_sexp); |
| 340 | } |
| 341 | oval_ftsent_freecxx . . $ oval_ftsent_free(7e09326da17d8ab0).(ofts_ent); |
| 342 | } |
| 343 | |
| 344 | oval_fts_closecxx . . $ oval_fts_close(cd898f79c195c42c).(ofts); |
| 345 | } |
| 346 | |
| 347 | cleanup: |
| 348 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (behaviors); |
| 349 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (path); |
| 350 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filename); |
| 351 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (filepath); |
| 352 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4). (hash_type); |
| 353 | |
| 354 | switch (pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(filehash58_probe_mutex)) { |
| 355 | case 0: |
| 356 | break; |
| 357 | default: |
| 358 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("Can't unlock mutex(%p): %u, %s.", filehash58_probe_mutex, errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 359 | |
| 360 | err = PROBE_EFATALcxx . . $ `src/OVAL/probes/public/probe-common.h:23:9`!; |
| 361 | } |
| 362 | |
| 363 | return err; |
| 364 | } |