| 1 | /** |
| 2 | * @file entcmp.c |
| 3 | * @author "Tomas Heinrich" <[email protected]> |
| 4 | * |
| 5 | * @addtogroup PROBEAPI |
| 6 | * @{ |
| 7 | */ |
| 8 | /* |
| 9 | * Copyright 2009 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 | * Tomas Heinrich <[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 | #include <sexp.h>cxx . . $ `<file>/src/OVAL/probes/SEAP/public/sexp.h`/ |
| 35 | #include <assert.h> |
| 36 | #include <string.h> |
| 37 | #include <stdarg.h> |
| 38 | #include <errno.h> |
| 39 | #ifdef OS_WINDOWS |
| 40 | #include <winsock2.h> |
| 41 | #else |
| 42 | #include <arpa/inet.h> |
| 43 | #include <sys/socket.h> |
| 44 | #endif |
| 45 | |
| 46 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 47 | #include "entcmp.h"cxx . . $ `<file>/src/OVAL/probes/probe/entcmp.h`/ |
| 48 | #include "../_probe-api.h"cxx . . $ `<file>/src/OVAL/probes/_probe-api.h`/ |
| 49 | #include "../../results/oval_cmp_basic_impl.h"cxx . . $ `<file>/src/OVAL/results/oval_cmp_basic_impl.h`/ |
| 50 | #include "../../results/oval_cmp_evr_string_impl.h"cxx . . $ `<file>/src/OVAL/results/oval_cmp_evr_string_impl.h`/ |
| 51 | #include "../../results/oval_cmp_ip_address_impl.h"cxx . . $ `<file>/src/OVAL/results/oval_cmp_ip_address_impl.h`/ |
| 52 | |
| 53 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_binarycxx . . $ probe_ent_cmp_binary(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 54 | { |
| 55 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 56 | char *s1, *s2; |
| 57 | |
| 58 | s1 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 59 | s2 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 60 | |
| 61 | result = oval_binary_cmpcxx . . $ oval_binary_cmp(1cc2eda1f1bc9b56).(s1, s2, op); |
| 62 | |
| 63 | freecxx . . $ free(5d22bdacc48458e8).(s1); |
| 64 | freecxx . . $ free(5d22bdacc48458e8).(s2); |
| 65 | |
| 66 | return result; |
| 67 | } |
| 68 | |
| 69 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_boolcxx . . $ probe_ent_cmp_bool(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 70 | { |
| 71 | int v1, v2; |
| 72 | |
| 73 | v1 = SEXP_number_geti_32cxx . . $ SEXP_number_geti_32(e77439d026b7e3ce).(val1); |
| 74 | v2 = SEXP_number_geti_32cxx . . $ SEXP_number_geti_32(e77439d026b7e3ce).(val2); |
| 75 | |
| 76 | return oval_boolean_cmpcxx . . $ oval_boolean_cmp(56d242478234f315).(v1, v2, op); |
| 77 | } |
| 78 | |
| 79 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_evrcxx . . $ probe_ent_cmp_evr(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 80 | { |
| 81 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 82 | char *s1 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 83 | char *s2 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 84 | |
| 85 | result = oval_evr_string_cmpcxx . . $ oval_evr_string_cmp(1cc2eda1f1bc9b56).(s1, s2, op); |
| 86 | |
| 87 | freecxx . . $ free(5d22bdacc48458e8).(s1); |
| 88 | freecxx . . $ free(5d22bdacc48458e8).(s2); |
| 89 | return result; |
| 90 | } |
| 91 | |
| 92 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_debian_evrcxx . . $ probe_ent_cmp_debian_evr(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 93 | { |
| 94 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 95 | char *s1 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 96 | char *s2 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 97 | |
| 98 | result = oval_debian_evr_string_cmpcxx . . $ oval_debian_evr_string_cmp(1cc2eda1f1bc9b56).(s1, s2, op); |
| 99 | |
| 100 | freecxx . . $ free(5d22bdacc48458e8).(s1); |
| 101 | freecxx . . $ free(5d22bdacc48458e8).(s2); |
| 102 | return result; |
| 103 | } |
| 104 | |
| 105 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_filesetrevcxx . . $ probe_ent_cmp_filesetrev(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 106 | { |
| 107 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 108 | |
| 109 | // todo: |
| 110 | |
| 111 | return result; |
| 112 | } |
| 113 | |
| 114 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_floatcxx . . $ probe_ent_cmp_float(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 115 | { |
| 116 | double v1, v2; |
| 117 | |
| 118 | v1 = SEXP_number_getfcxx . . $ SEXP_number_getf(6d586db1a89708ed).(val1); |
| 119 | v2 = SEXP_number_getfcxx . . $ SEXP_number_getf(6d586db1a89708ed).(val2); |
| 120 | |
| 121 | return oval_float_cmpcxx . . $ oval_float_cmp(fdbee3ef524f2c1c).(v1, v2, op); |
| 122 | } |
| 123 | |
| 124 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_intcxx . . $ probe_ent_cmp_int(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 125 | { |
| 126 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 127 | int64_tcxx . . $ int64_t# v1, v2; |
| 128 | |
| 129 | v1 = SEXP_number_geti_64cxx . . $ SEXP_number_geti_64(f56a5dddf3580f63).(val1); |
| 130 | v2 = SEXP_number_geti_64cxx . . $ SEXP_number_geti_64(f56a5dddf3580f63).(val2); |
| 131 | |
| 132 | result = oval_int_cmpcxx . . $ oval_int_cmp(9cddff872de8d216).(v1, v2, op); |
| 133 | |
| 134 | return result; |
| 135 | } |
| 136 | |
| 137 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_ioscxx . . $ probe_ent_cmp_ios(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 138 | { |
| 139 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 140 | |
| 141 | // todo: |
| 142 | |
| 143 | return result; |
| 144 | } |
| 145 | |
| 146 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_versioncxx . . $ probe_ent_cmp_version(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 147 | { |
| 148 | char *state_version = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 149 | char *sys_version = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 150 | |
| 151 | oval_result_tcxx . . $ oval_result_t# result = oval_versiontype_cmpcxx . . $ oval_versiontype_cmp(1cc2eda1f1bc9b56).(state_version, sys_version, op); |
| 152 | |
| 153 | freecxx . . $ free(5d22bdacc48458e8).(state_version); |
| 154 | freecxx . . $ free(5d22bdacc48458e8).(sys_version); |
| 155 | return result; |
| 156 | } |
| 157 | |
| 158 | oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_stringcxx . . $ probe_ent_cmp_string(860db4bd217a028b).(SEXP_tcxx . . $ SEXP_t# * val1, SEXP_tcxx . . $ SEXP_t# * val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 159 | { |
| 160 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 161 | char *s1, *s2; |
| 162 | |
| 163 | s1 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 164 | s2 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 165 | |
| 166 | result = oval_string_cmpcxx . . $ oval_string_cmp(1cc2eda1f1bc9b56).(s1, s2, op); |
| 167 | |
| 168 | freecxx . . $ free(5d22bdacc48458e8).(s1); |
| 169 | freecxx . . $ free(5d22bdacc48458e8).(s2); |
| 170 | |
| 171 | return result; |
| 172 | } |
| 173 | |
| 174 | static oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_ipaddrcxx . . $ probe_ent_cmp_ipaddr(4dcd41b7fbbbaa71).(int af, SEXP_tcxx . . $ SEXP_t# *val1, SEXP_tcxx . . $ SEXP_t# *val2, oval_operation_tcxx . . $ oval_operation_t# op) |
| 175 | { |
| 176 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 177 | char *addr1 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val1); |
| 178 | char *addr2 = SEXP_string_cstrcxx . . $ SEXP_string_cstr(c831a2fa12818dfe).(val2); |
| 179 | |
| 180 | result = oval_ipaddr_cmpcxx . . $ oval_ipaddr_cmp(70c1ad763aee40a3).(af, addr1, addr2, op); |
| 181 | |
| 182 | freecxx . . $ free(5d22bdacc48458e8).(addr1); |
| 183 | freecxx . . $ free(5d22bdacc48458e8).(addr2); |
| 184 | return result; |
| 185 | } |
| 186 | |
| 187 | static inline oval_result_tcxx . . $ oval_result_t# probe_ent_cmp_singlecxx . . $ probe_ent_cmp_single(1d581a6d11832962).(SEXP_tcxx . . $ SEXP_t# *state_ent, oval_datatype_tcxx . . $ oval_datatype_t# state_data_type, SEXP_tcxx . . $ SEXP_t# *sysent, oval_operation_tcxx . . $ oval_operation_t# op) |
| 188 | { |
| 189 | // This compares a single entity of a state with a single entity of a sysitem |
| 190 | // This is very similar to oval_ent_cmp_str, we hope to get a rid of this soon |
| 191 | |
| 192 | switch (state_data_type) { |
| 193 | case OVAL_DATATYPE_BINARYcxx . . $ OVAL_DATATYPE_BINARY.: |
| 194 | return probe_ent_cmp_binarycxx . . $ probe_ent_cmp_binary(860db4bd217a028b).(state_ent, sysent, op); |
| 195 | case OVAL_DATATYPE_BOOLEANcxx . . $ OVAL_DATATYPE_BOOLEAN.: |
| 196 | return probe_ent_cmp_boolcxx . . $ probe_ent_cmp_bool(860db4bd217a028b).(state_ent, sysent, op); |
| 197 | case OVAL_DATATYPE_EVR_STRINGcxx . . $ OVAL_DATATYPE_EVR_STRING.: |
| 198 | return probe_ent_cmp_evrcxx . . $ probe_ent_cmp_evr(860db4bd217a028b).(state_ent, sysent, op); |
| 199 | case OVAL_DATATYPE_DEBIAN_EVR_STRINGcxx . . $ OVAL_DATATYPE_DEBIAN_EVR_STRING.: |
| 200 | return probe_ent_cmp_debian_evrcxx . . $ probe_ent_cmp_debian_evr(860db4bd217a028b).(state_ent, sysent, op); |
| 201 | case OVAL_DATATYPE_FILESET_REVISIONcxx . . $ OVAL_DATATYPE_FILESET_REVISION.: |
| 202 | return probe_ent_cmp_filesetrevcxx . . $ probe_ent_cmp_filesetrev(860db4bd217a028b).(state_ent, sysent, op); |
| 203 | case OVAL_DATATYPE_FLOATcxx . . $ OVAL_DATATYPE_FLOAT.: |
| 204 | return probe_ent_cmp_floatcxx . . $ probe_ent_cmp_float(860db4bd217a028b).(state_ent, sysent, op); |
| 205 | case OVAL_DATATYPE_IOS_VERSIONcxx . . $ OVAL_DATATYPE_IOS_VERSION.: |
| 206 | return probe_ent_cmp_ioscxx . . $ probe_ent_cmp_ios(860db4bd217a028b).(state_ent, sysent, op); |
| 207 | case OVAL_DATATYPE_VERSIONcxx . . $ OVAL_DATATYPE_VERSION.: |
| 208 | return probe_ent_cmp_versioncxx . . $ probe_ent_cmp_version(860db4bd217a028b).(state_ent, sysent, op); |
| 209 | case OVAL_DATATYPE_INTEGERcxx . . $ OVAL_DATATYPE_INTEGER.: |
| 210 | return probe_ent_cmp_intcxx . . $ probe_ent_cmp_int(860db4bd217a028b).(state_ent, sysent, op); |
| 211 | case OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING.: |
| 212 | return probe_ent_cmp_stringcxx . . $ probe_ent_cmp_string(860db4bd217a028b).(state_ent, sysent, op); |
| 213 | case OVAL_DATATYPE_IPV4ADDRcxx . . $ OVAL_DATATYPE_IPV4ADDR.: |
| 214 | return probe_ent_cmp_ipaddrcxx . . $ probe_ent_cmp_ipaddr(4dcd41b7fbbbaa71).(AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!, state_ent, sysent, op); |
| 215 | case OVAL_DATATYPE_IPV6ADDRcxx . . $ OVAL_DATATYPE_IPV6ADDR.: |
| 216 | return probe_ent_cmp_ipaddrcxx . . $ probe_ent_cmp_ipaddr(4dcd41b7fbbbaa71).(AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!, state_ent, sysent, op); |
| 217 | default: |
| 218 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Unexpected data type: %d", state_data_type); |
| 219 | break; |
| 220 | } |
| 221 | |
| 222 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 223 | } |
| 224 | |
| 225 | static oval_result_tcxx . . $ oval_result_t# probe_ent_cmpcxx . . $ probe_ent_cmp(e245451a1311e799).(SEXP_tcxx . . $ SEXP_t# * ent, SEXP_tcxx . . $ SEXP_t# * val2) |
| 226 | { |
| 227 | oval_operation_tcxx . . $ oval_operation_t# op; |
| 228 | oval_datatype_tcxx . . $ oval_datatype_t# dtype; |
| 229 | SEXP_tcxx . . $ SEXP_t# *stmp, *val1, *vals, *res_lst, *r0; |
| 230 | int val_cnt, is_var; |
| 231 | oval_check_tcxx . . $ oval_check_t# ochk; |
| 232 | oval_result_tcxx . . $ oval_result_t# ores, result; |
| 233 | |
| 234 | ores = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 235 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 236 | vals = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 237 | val_cnt = probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(ent, &vals); |
| 238 | |
| 239 | if (probe_ent_attrexistscxx . . $ probe_ent_attrexists(7326d2b72b90fa4d).(ent, "var_ref")) { |
| 240 | is_var = 1; |
| 241 | } else { |
| 242 | if (val_cnt != 1) { |
| 243 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(vals); |
| 244 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 245 | } |
| 246 | |
| 247 | is_var = 0; |
| 248 | } |
| 249 | |
| 250 | dtype = probe_ent_getdatatypecxx . . $ probe_ent_getdatatype(576ef4d818d367a9).(ent); |
| 251 | stmp = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(ent, "operation"); |
| 252 | if (stmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 253 | op = OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.; |
| 254 | else |
| 255 | op = SEXP_number_geti_32cxx . . $ SEXP_number_geti_32(e77439d026b7e3ce).(stmp); |
| 256 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 257 | res_lst = SEXP_list_newcxx . . $ SEXP_list_new(902e4f76566c8810).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 258 | |
| 259 | SEXP_list_foreachcxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:470:9`!(val1, vals) { |
| 260 | if (SEXP_typeofcxx . . $ SEXP_typeof(dfe0d2bfa8d6f3af).(val1) != SEXP_typeofcxx . . $ SEXP_typeof(dfe0d2bfa8d6f3af).(val2)) { |
| 261 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Types of values to compare don't match: val1: %d, val2: %d", |
| 262 | SEXP_typeof(val1), SEXP_typeof(val2)); |
| 263 | |
| 264 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(vals); |
| 265 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(val1); |
| 266 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(res_lst); |
| 267 | |
| 268 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 269 | } |
| 270 | |
| 271 | ores = probe_ent_cmp_singlecxx . . $ probe_ent_cmp_single(1d581a6d11832962).(val1, dtype, val2, op); |
| 272 | |
| 273 | SEXP_list_addcxx . . $ SEXP_list_add(35a066576d9f6ea6).(res_lst, r0 = SEXP_number_newi_32cxx . . $ SEXP_number_newi_32(ac44525e09ce977a).(ores)); |
| 274 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r0); |
| 275 | } |
| 276 | |
| 277 | if (is_var) { |
| 278 | stmp = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(ent, "var_check"); |
| 279 | if (stmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 280 | ochk = OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.; |
| 281 | } else { |
| 282 | ochk = SEXP_number_geti_32cxx . . $ SEXP_number_geti_32(e77439d026b7e3ce).(stmp); |
| 283 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 284 | } |
| 285 | |
| 286 | result = probe_ent_result_bychkcxx . . $ probe_ent_result_bychk(b32db698aeb51a68).(res_lst, ochk); |
| 287 | } else { |
| 288 | result = ores; |
| 289 | } |
| 290 | |
| 291 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(res_lst); |
| 292 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(vals); |
| 293 | |
| 294 | return result; |
| 295 | } |
| 296 | |
| 297 | static oval_result_tcxx . . $ oval_result_t# _probe_entste_cmp_recordcxx . . $ _probe_entste_cmp_record(e245451a1311e799).(SEXP_tcxx . . $ SEXP_t# *ent_ste, SEXP_tcxx . . $ SEXP_t# *ent_itm) |
| 298 | { |
| 299 | oval_result_tcxx . . $ oval_result_t# res; |
| 300 | oval_operation_tcxx . . $ oval_operation_t# op; |
| 301 | oval_check_tcxx . . $ oval_check_t# ochk; |
| 302 | SEXP_tcxx . . $ SEXP_t# *stmp, *ste_res, *ste_record_fields, *ste_rf, *itm_record_fields; |
| 303 | int val_cnt; |
| 304 | |
| 305 | stmp = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(ent_ste, "operation"); |
| 306 | if (stmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 307 | op = OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.; |
| 308 | } else { |
| 309 | op = SEXP_number_getucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:145:10`!(stmp); |
| 310 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 311 | if (op != OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.) |
| 312 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 313 | } |
| 314 | |
| 315 | val_cnt = probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(ent_ste, &ste_record_fields); |
| 316 | if (val_cnt <= 0) { |
| 317 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(ste_record_fields); |
| 318 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 319 | } |
| 320 | val_cnt = probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(ent_itm, &itm_record_fields); |
| 321 | if (val_cnt <= 0) { |
| 322 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(ste_record_fields); |
| 323 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(itm_record_fields); |
| 324 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 325 | } |
| 326 | |
| 327 | ste_res = SEXP_list_newcxx . . $ SEXP_list_new(902e4f76566c8810).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 328 | |
| 329 | SEXP_list_foreachcxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:470:9`!(ste_rf, ste_record_fields) { |
| 330 | SEXP_tcxx . . $ SEXP_t# *itm_rf, *itm_res; |
| 331 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! matched; |
| 332 | |
| 333 | char *sname = probe_ent_getnamecxx . . $ probe_ent_getname(c831a2fa12818dfe).(ste_rf); |
| 334 | itm_res = SEXP_list_newcxx . . $ SEXP_list_new(902e4f76566c8810).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 335 | matched = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 336 | |
| 337 | SEXP_list_foreachcxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:470:9`!(itm_rf, itm_record_fields) { |
| 338 | char *iname = probe_ent_getnamecxx . . $ probe_ent_getname(c831a2fa12818dfe).(itm_rf); |
| 339 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(sname, iname)) { |
| 340 | freecxx . . $ free(5d22bdacc48458e8).(iname); |
| 341 | continue; |
| 342 | } |
| 343 | freecxx . . $ free(5d22bdacc48458e8).(iname); |
| 344 | matched = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 345 | |
| 346 | res = probe_entste_cmpcxx . . $ probe_entste_cmp(e245451a1311e799).(ste_rf, itm_rf); |
| 347 | /* todo: _oval_result_to_sexp() */ |
| 348 | stmp = SEXP_number_newucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:133:9`!(res); |
| 349 | SEXP_list_addcxx . . $ SEXP_list_add(35a066576d9f6ea6).(itm_res, stmp); |
| 350 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 351 | } |
| 352 | |
| 353 | freecxx . . $ free(5d22bdacc48458e8).(sname); |
| 354 | |
| 355 | if (!matched) { |
| 356 | stmp = SEXP_number_newucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:133:9`!(OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.); |
| 357 | SEXP_list_addcxx . . $ SEXP_list_add(35a066576d9f6ea6).(itm_res, stmp); |
| 358 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 359 | } |
| 360 | |
| 361 | stmp = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(ste_rf, "entity_check"); |
| 362 | if (stmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 363 | ochk = OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.; |
| 364 | } else { |
| 365 | ochk = SEXP_number_getucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:145:10`!(stmp); |
| 366 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 367 | } |
| 368 | |
| 369 | res = probe_ent_result_bychkcxx . . $ probe_ent_result_bychk(b32db698aeb51a68).(itm_res, ochk); |
| 370 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(itm_res); |
| 371 | stmp = SEXP_number_newucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:133:9`!(res); |
| 372 | SEXP_list_addcxx . . $ SEXP_list_add(35a066576d9f6ea6).(ste_res, stmp); |
| 373 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 374 | } |
| 375 | |
| 376 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(ste_record_fields); |
| 377 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(itm_record_fields); |
| 378 | |
| 379 | stmp = probe_ent_getattrvalcxx . . $ probe_ent_getattrval(42b37380d22a3312).(ent_ste, "entity_check"); |
| 380 | if (stmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 381 | ochk = OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.; |
| 382 | } else { |
| 383 | ochk = SEXP_number_getucxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:145:10`!(stmp); |
| 384 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(stmp); |
| 385 | } |
| 386 | |
| 387 | res = probe_ent_result_bychkcxx . . $ probe_ent_result_bychk(b32db698aeb51a68).(ste_res, ochk); |
| 388 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(ste_res); |
| 389 | |
| 390 | return res; |
| 391 | } |
| 392 | |
| 393 | oval_result_tcxx . . $ oval_result_t# probe_entste_cmpcxx . . $ probe_entste_cmp(e245451a1311e799).(SEXP_tcxx . . $ SEXP_t# * ent_ste, SEXP_tcxx . . $ SEXP_t# * ent_itm) |
| 394 | { |
| 395 | oval_datatype_tcxx . . $ oval_datatype_t# ste_dt; |
| 396 | oval_syschar_status_tcxx . . $ oval_syschar_status_t# item_status; |
| 397 | oval_result_tcxx . . $ oval_result_t# ores; |
| 398 | SEXP_tcxx . . $ SEXP_t# *val2; |
| 399 | int valcnt; |
| 400 | |
| 401 | item_status = probe_ent_getstatuscxx . . $ probe_ent_getstatus(b361a2e29ea6a769).(ent_itm); |
| 402 | switch (item_status) { |
| 403 | case SYSCHAR_STATUS_DOES_NOT_EXISTcxx . . $ SYSCHAR_STATUS_DOES_NOT_EXIST.: |
| 404 | return OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 405 | case SYSCHAR_STATUS_ERRORcxx . . $ SYSCHAR_STATUS_ERROR.: |
| 406 | case SYSCHAR_STATUS_NOT_COLLECTEDcxx . . $ SYSCHAR_STATUS_NOT_COLLECTED.: |
| 407 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 408 | default: |
| 409 | break; |
| 410 | } |
| 411 | |
| 412 | ste_dt = probe_ent_getdatatypecxx . . $ probe_ent_getdatatype(576ef4d818d367a9).(ent_ste); |
| 413 | if (ste_dt != probe_ent_getdatatypecxx . . $ probe_ent_getdatatype(576ef4d818d367a9).(ent_itm)) |
| 414 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 415 | |
| 416 | if (ste_dt == OVAL_DATATYPE_RECORDcxx . . $ OVAL_DATATYPE_RECORD.) |
| 417 | /* records require special handling */ |
| 418 | return _probe_entste_cmp_recordcxx . . $ _probe_entste_cmp_record(e245451a1311e799).(ent_ste, ent_itm); |
| 419 | |
| 420 | valcnt = probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(ent_ste, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 421 | if (valcnt == 0) |
| 422 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 423 | |
| 424 | val2 = probe_ent_getvalcxx . . $ probe_ent_getval(2f7f980afaaae0f0).(ent_itm); |
| 425 | ores = probe_ent_cmpcxx . . $ probe_ent_cmp(e245451a1311e799).(ent_ste, val2); |
| 426 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(val2); |
| 427 | |
| 428 | if (ores == OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.) |
| 429 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 430 | return ores; |
| 431 | } |
| 432 | |
| 433 | oval_result_tcxx . . $ oval_result_t# probe_entobj_cmpcxx . . $ probe_entobj_cmp(e245451a1311e799).(SEXP_tcxx . . $ SEXP_t# * ent_obj, SEXP_tcxx . . $ SEXP_t# * val) |
| 434 | { |
| 435 | oval_result_tcxx . . $ oval_result_t# ores; |
| 436 | SEXP_tcxx . . $ SEXP_t# *r0 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 437 | int valcnt; |
| 438 | |
| 439 | valcnt = probe_ent_getvalscxx . . $ probe_ent_getvals(87c285983fc46746).(ent_obj, &r0); |
| 440 | SEXP_freecxx . . $ SEXP_free(c6b28547479798f4).(r0); |
| 441 | if (valcnt == 0) { |
| 442 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("valcnt == 0."); |
| 443 | return OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 444 | } |
| 445 | |
| 446 | ores = probe_ent_cmpcxx . . $ probe_ent_cmp(e245451a1311e799).(ent_obj, val); |
| 447 | #if defined(OSCAP_VERBOSE_DEBUG) |
| 448 | dI("Result of entobj comparison: %s.", oval_result_get_text(ores)); |
| 449 | #endif |
| 450 | if (ores == OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.) |
| 451 | return OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 452 | return ores; |
| 453 | } |
| 454 | |
| 455 | struct _oresultscxx . . $ _oresults# { |
| 456 | int true_cntcxx . . $ _oresults#true_cnt., false_cntcxx . . $ _oresults#false_cnt., unknown_cntcxx . . $ _oresults#unknown_cnt., error_cntcxx . . $ _oresults#error_cnt., noteval_cntcxx . . $ _oresults#noteval_cnt., notappl_cntcxx . . $ _oresults#notappl_cnt.; |
| 457 | }; |
| 458 | |
| 459 | static int results_parsercxx . . $ results_parser(75345e4bf6806140).(SEXP_tcxx . . $ SEXP_t# * res_lst, struct _oresultscxx . . $ _oresults# *ores) |
| 460 | { |
| 461 | oval_result_tcxx . . $ oval_result_t# r; |
| 462 | SEXP_tcxx . . $ SEXP_t# *res; |
| 463 | |
| 464 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(ores, 0, sizeof(struct _oresultscxx . . $ _oresults#)); |
| 465 | |
| 466 | SEXP_list_foreachcxx . . $ `src/OVAL/probes/SEAP/public/sexp-manip.h:470:9`!(res, res_lst) { |
| 467 | r = SEXP_number_geti_32cxx . . $ SEXP_number_geti_32(e77439d026b7e3ce).(res); |
| 468 | switch (r) { |
| 469 | case OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.: |
| 470 | ++(ores->true_cntcxx . . $ _oresults#true_cnt.); |
| 471 | break; |
| 472 | case OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.: |
| 473 | ++(ores->false_cntcxx . . $ _oresults#false_cnt.); |
| 474 | break; |
| 475 | case OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.: |
| 476 | ++(ores->unknown_cntcxx . . $ _oresults#unknown_cnt.); |
| 477 | break; |
| 478 | case OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.: |
| 479 | ++(ores->error_cntcxx . . $ _oresults#error_cnt.); |
| 480 | break; |
| 481 | case OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.: |
| 482 | ++(ores->noteval_cntcxx . . $ _oresults#noteval_cnt.); |
| 483 | break; |
| 484 | case OVAL_RESULT_NOT_APPLICABLEcxx . . $ OVAL_RESULT_NOT_APPLICABLE.: |
| 485 | ++(ores->notappl_cntcxx . . $ _oresults#notappl_cnt.); |
| 486 | break; |
| 487 | default: |
| 488 | return -1; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | // todo: already implemented elsewhere; consolidate |
| 496 | oval_result_tcxx . . $ oval_result_t# probe_ent_result_bychkcxx . . $ probe_ent_result_bychk(b32db698aeb51a68).(SEXP_tcxx . . $ SEXP_t# * res_lst, oval_check_tcxx . . $ oval_check_t# check) |
| 497 | { |
| 498 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 499 | struct _oresultscxx . . $ _oresults# ores; |
| 500 | |
| 501 | if (SEXP_list_lengthcxx . . $ SEXP_list_length(7b7039adf1662ab5).(res_lst) == 0) |
| 502 | return OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 503 | |
| 504 | if (results_parsercxx . . $ results_parser(75345e4bf6806140).(res_lst, &ores) != 0) { |
| 505 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 506 | } |
| 507 | |
| 508 | if (ores.notappl_cntcxx . . $ _oresults#notappl_cnt. > 0 && |
| 509 | ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0 && |
| 510 | ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.true_cntcxx . . $ _oresults#true_cnt. == 0) |
| 511 | return OVAL_RESULT_NOT_APPLICABLEcxx . . $ OVAL_RESULT_NOT_APPLICABLE.; |
| 512 | |
| 513 | switch (check) { |
| 514 | case OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.: |
| 515 | if (ores.true_cntcxx . . $ _oresults#true_cnt. > 0 && |
| 516 | ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 517 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 518 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. > 0) { |
| 519 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 520 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 521 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 522 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 523 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 524 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 525 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 526 | } |
| 527 | break; |
| 528 | case OVAL_CHECK_AT_LEAST_ONEcxx . . $ OVAL_CHECK_AT_LEAST_ONE.: |
| 529 | if (ores.true_cntcxx . . $ _oresults#true_cnt. > 0) { |
| 530 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 531 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. > 0 && |
| 532 | ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && |
| 533 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 534 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 535 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 536 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 537 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 538 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 539 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 540 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 541 | } |
| 542 | break; |
| 543 | case OVAL_CHECK_NONE_EXISTcxx . . $ OVAL_CHECK_NONE_EXIST.: |
| 544 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("The 'none exist' CheckEnumeration value has been deprecated. " |
| 545 | "Converted to check='none satisfy'."); |
| 546 | /* FALLTHROUGH */ |
| 547 | case OVAL_CHECK_NONE_SATISFYcxx . . $ OVAL_CHECK_NONE_SATISFY.: |
| 548 | if (ores.true_cntcxx . . $ _oresults#true_cnt. > 0) { |
| 549 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 550 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 551 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 552 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 553 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 554 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 555 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 556 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. > 0 && |
| 557 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && |
| 558 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0 && ores.true_cntcxx . . $ _oresults#true_cnt. == 0) { |
| 559 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 560 | } |
| 561 | break; |
| 562 | case OVAL_CHECK_ONLY_ONEcxx . . $ OVAL_CHECK_ONLY_ONE.: |
| 563 | if (ores.true_cntcxx . . $ _oresults#true_cnt. == 1 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 564 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 565 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. > 1) { |
| 566 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 567 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 568 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 569 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 570 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 571 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 572 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 573 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. != 1 && ores.false_cntcxx . . $ _oresults#false_cnt. > 0) { |
| 574 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 575 | } |
| 576 | break; |
| 577 | default: |
| 578 | break; |
| 579 | } |
| 580 | |
| 581 | return result; |
| 582 | } |
| 583 | |
| 584 | // todo: already implemented elsewhere; consolidate |
| 585 | oval_result_tcxx . . $ oval_result_t# probe_ent_result_byoprcxx . . $ probe_ent_result_byopr(c1aad969648ee96f).(SEXP_tcxx . . $ SEXP_t# * res_lst, oval_operator_tcxx . . $ oval_operator_t# operator) |
| 586 | { |
| 587 | oval_result_tcxx . . $ oval_result_t# result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 588 | struct _oresultscxx . . $ _oresults# ores; |
| 589 | |
| 590 | if (SEXP_list_lengthcxx . . $ SEXP_list_length(7b7039adf1662ab5).(res_lst) == 0) |
| 591 | return OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 592 | |
| 593 | if (results_parsercxx . . $ results_parser(75345e4bf6806140).(res_lst, &ores) != 0) { |
| 594 | return OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 595 | } |
| 596 | |
| 597 | if (ores.notappl_cntcxx . . $ _oresults#notappl_cnt. > 0 && |
| 598 | ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0 && |
| 599 | ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.true_cntcxx . . $ _oresults#true_cnt. == 0) |
| 600 | return OVAL_RESULT_NOT_APPLICABLEcxx . . $ OVAL_RESULT_NOT_APPLICABLE.; |
| 601 | |
| 602 | switch (operator) { |
| 603 | case OVAL_OPERATOR_ANDcxx . . $ OVAL_OPERATOR_AND.: |
| 604 | if (ores.true_cntcxx . . $ _oresults#true_cnt. > 0 && |
| 605 | ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 606 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 607 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. > 0) { |
| 608 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 609 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 610 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 611 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 612 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 613 | } else if (ores.false_cntcxx . . $ _oresults#false_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 614 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 615 | } |
| 616 | break; |
| 617 | case OVAL_OPERATOR_ONEcxx . . $ OVAL_OPERATOR_ONE.: |
| 618 | if (ores.true_cntcxx . . $ _oresults#true_cnt. == 1 && |
| 619 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 620 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 621 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 622 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. >= 2 && |
| 623 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 624 | ores.error_cntcxx . . $ _oresults#error_cnt. >= 0 && |
| 625 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. >= 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. >= 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 626 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 627 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && |
| 628 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 629 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && |
| 630 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 631 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 632 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && |
| 633 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 634 | ores.error_cntcxx . . $ _oresults#error_cnt. > 0 && |
| 635 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. >= 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. >= 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 636 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 637 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && |
| 638 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 639 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && |
| 640 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. >= 1 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. >= 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 641 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 642 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. < 2 && |
| 643 | ores.false_cntcxx . . $ _oresults#false_cnt. >= 0 && |
| 644 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && |
| 645 | ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0 && ores.notappl_cntcxx . . $ _oresults#notappl_cnt. >= 0) { |
| 646 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 647 | } |
| 648 | break; |
| 649 | case OVAL_OPERATOR_ORcxx . . $ OVAL_OPERATOR_OR.: |
| 650 | if (ores.true_cntcxx . . $ _oresults#true_cnt. > 0) { |
| 651 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 652 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && |
| 653 | ores.false_cntcxx . . $ _oresults#false_cnt. > 0 && |
| 654 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 655 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 656 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 657 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 658 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 659 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 660 | } else if (ores.true_cntcxx . . $ _oresults#true_cnt. == 0 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 661 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 662 | } |
| 663 | break; |
| 664 | case OVAL_OPERATOR_XORcxx . . $ OVAL_OPERATOR_XOR.: |
| 665 | if ((ores.true_cntcxx . . $ _oresults#true_cnt. % 2) == 1 && ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 666 | result = OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE.; |
| 667 | } else if ((ores.true_cntcxx . . $ _oresults#true_cnt. % 2) == 0 && |
| 668 | ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. == 0) { |
| 669 | result = OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE.; |
| 670 | } else if (ores.error_cntcxx . . $ _oresults#error_cnt. > 0) { |
| 671 | result = OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR.; |
| 672 | } else if (ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. > 0) { |
| 673 | result = OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN.; |
| 674 | } else if (ores.error_cntcxx . . $ _oresults#error_cnt. == 0 && ores.unknown_cntcxx . . $ _oresults#unknown_cnt. == 0 && ores.noteval_cntcxx . . $ _oresults#noteval_cnt. > 0) { |
| 675 | result = OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED.; |
| 676 | } |
| 677 | break; |
| 678 | default: |
| 679 | break; |
| 680 | } |
| 681 | |
| 682 | return result; |
| 683 | } |
| 684 | |
| 685 | /// @} |