| 1 | /* |
| 2 | * Copyright 2011--2014 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * Tomas Heinrich <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 24 | #include <libxml/tree.h> |
| 25 | #include "oval_definitions_impl.h"cxx . . $ `<file>/src/OVAL/oval_definitions_impl.h`/ |
| 26 | #include "oval_agent_api_impl.h"cxx . . $ `<file>/src/OVAL/oval_agent_api_impl.h`/ |
| 27 | #include "oval_system_characteristics_impl.h"cxx . . $ `<file>/src/OVAL/oval_system_characteristics_impl.h`/ |
| 28 | #include "adt/oval_collection_impl.h"cxx . . $ `<file>/src/OVAL/adt/oval_collection_impl.h`/ |
| 29 | #include "oval_parser_impl.h"cxx . . $ `<file>/src/OVAL/oval_parser_impl.h`/ |
| 30 | |
| 31 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 32 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 33 | #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/ |
| 34 | |
| 35 | typedef struct oval_record_fieldcxx . . $ oval_record_field# { |
| 36 | oval_record_field_type_tcxx . . $ oval_record_field_type_t# record_field_typecxx . . $ oval_record_field#record_field_type.; |
| 37 | char *namecxx . . $ oval_record_field#name.; |
| 38 | char *valuecxx . . $ oval_record_field#value.; |
| 39 | oval_datatype_tcxx . . $ oval_datatype_t# datatypecxx . . $ oval_record_field#datatype.; |
| 40 | int maskcxx . . $ oval_record_field#mask.; |
| 41 | } oval_record_field_tcxx . . $ oval_record_field_t#; |
| 42 | |
| 43 | typedef struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# { |
| 44 | oval_record_field_type_tcxx . . $ oval_record_field_type_t# record_field_typecxx . . $ oval_record_field_STATE#record_field_type.; |
| 45 | char *namecxx . . $ oval_record_field_STATE#name.; |
| 46 | char *valuecxx . . $ oval_record_field_STATE#value.; |
| 47 | oval_datatype_tcxx . . $ oval_datatype_t# datatypecxx . . $ oval_record_field_STATE#datatype.; |
| 48 | int maskcxx . . $ oval_record_field_STATE#mask.; |
| 49 | oval_operation_tcxx . . $ oval_operation_t# operationcxx . . $ oval_record_field_STATE#operation.; |
| 50 | struct oval_variablecxx . . $ oval_variable# *variablecxx . . $ oval_record_field_STATE#variable.; |
| 51 | oval_check_tcxx . . $ oval_check_t# var_checkcxx . . $ oval_record_field_STATE#var_check.; |
| 52 | oval_check_tcxx . . $ oval_check_t# ent_checkcxx . . $ oval_record_field_STATE#ent_check.; |
| 53 | } oval_record_field_STATE_tcxx . . $ oval_record_field_STATE_t#; |
| 54 | |
| 55 | typedef struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# { |
| 56 | oval_record_field_type_tcxx . . $ oval_record_field_type_t# record_field_typecxx . . $ oval_record_field_ITEM#record_field_type.; |
| 57 | char *namecxx . . $ oval_record_field_ITEM#name.; |
| 58 | char *valuecxx . . $ oval_record_field_ITEM#value.; |
| 59 | oval_datatype_tcxx . . $ oval_datatype_t# datatypecxx . . $ oval_record_field_ITEM#datatype.; |
| 60 | int maskcxx . . $ oval_record_field_ITEM#mask.; |
| 61 | oval_syschar_status_tcxx . . $ oval_syschar_status_t# statuscxx . . $ oval_record_field_ITEM#status.; |
| 62 | } oval_record_field_ITEM_tcxx . . $ oval_record_field_ITEM_t#; |
| 63 | |
| 64 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_record_field_iterator_has_morecxx . . $ oval_record_field_iterator_has_more(f257abe5c2e43c5d).(struct oval_record_field_iteratorcxx . . $ oval_record_field_iterator# *itr) |
| 65 | { |
| 66 | return oval_collection_iterator_has_morecxx . . $ oval_collection_iterator_has_more(de0650ab9b639739).((struct oval_iteratorcxx . . $ oval_iterator# *) itr); |
| 67 | } |
| 68 | |
| 69 | struct oval_record_fieldcxx . . $ oval_record_field# *oval_record_field_iterator_nextcxx . . $ oval_record_field_iterator_next(7c2c0ee515333432).(struct oval_record_field_iteratorcxx . . $ oval_record_field_iterator# *itr) |
| 70 | { |
| 71 | return (struct oval_record_fieldcxx . . $ oval_record_field# *) |
| 72 | oval_collection_iterator_nextcxx . . $ oval_collection_iterator_next(344074693c9690a9).((struct oval_iteratorcxx . . $ oval_iterator# *) itr); |
| 73 | } |
| 74 | |
| 75 | void oval_record_field_iterator_freecxx . . $ oval_record_field_iterator_free(6968805da7579f07).(struct oval_record_field_iteratorcxx . . $ oval_record_field_iterator# *itr) |
| 76 | { |
| 77 | oval_collection_iterator_freecxx . . $ oval_collection_iterator_free(ee496816570b41f7).((struct oval_iteratorcxx . . $ oval_iterator# *) itr); |
| 78 | } |
| 79 | |
| 80 | struct oval_record_fieldcxx . . $ oval_record_field# *oval_record_field_newcxx . . $ oval_record_field_new(d4e9acdf0800a817).(oval_record_field_type_tcxx . . $ oval_record_field_type_t# type) |
| 81 | { |
| 82 | struct oval_record_fieldcxx . . $ oval_record_field# *rf; |
| 83 | |
| 84 | switch (type) { |
| 85 | case OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.: |
| 86 | { |
| 87 | struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *rfs; |
| 88 | |
| 89 | rfs = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*rfs)); |
| 90 | if (rfs == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 91 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 92 | |
| 93 | rfs->operationcxx . . $ oval_record_field_STATE#operation. = OVAL_OPERATION_UNKNOWNcxx . . $ OVAL_OPERATION_UNKNOWN.; |
| 94 | rfs->variablecxx . . $ oval_record_field_STATE#variable. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 95 | rfs->var_checkcxx . . $ oval_record_field_STATE#var_check. = OVAL_CHECK_UNKNOWNcxx . . $ OVAL_CHECK_UNKNOWN.; |
| 96 | rfs->ent_checkcxx . . $ oval_record_field_STATE#ent_check. = OVAL_CHECK_UNKNOWNcxx . . $ OVAL_CHECK_UNKNOWN.; |
| 97 | rf = (struct oval_record_fieldcxx . . $ oval_record_field# *) rfs; |
| 98 | break; |
| 99 | } |
| 100 | case OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.: |
| 101 | { |
| 102 | struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# *rfi; |
| 103 | |
| 104 | rfi = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*rfi)); |
| 105 | if (rfi == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 106 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 107 | |
| 108 | rfi->statuscxx . . $ oval_record_field_ITEM#status. = SYSCHAR_STATUS_UNKNOWNcxx . . $ SYSCHAR_STATUS_UNKNOWN.; |
| 109 | rf = (struct oval_record_fieldcxx . . $ oval_record_field# *) rfi; |
| 110 | break; |
| 111 | } |
| 112 | default: |
| 113 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Unsupported record field type: %d.", type); |
| 114 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 115 | } |
| 116 | |
| 117 | rf->record_field_typecxx . . $ oval_record_field#record_field_type. = type; |
| 118 | rf->namecxx . . $ oval_record_field#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 119 | rf->valuecxx . . $ oval_record_field#value. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 120 | rf->datatypecxx . . $ oval_record_field#datatype. = OVAL_DATATYPE_UNKNOWNcxx . . $ OVAL_DATATYPE_UNKNOWN.; |
| 121 | rf->maskcxx . . $ oval_record_field#mask. = 0; |
| 122 | |
| 123 | return rf; |
| 124 | } |
| 125 | |
| 126 | struct oval_record_fieldcxx . . $ oval_record_field# *oval_record_field_clonecxx . . $ oval_record_field_clone(2c314695471b524c).(struct oval_record_fieldcxx . . $ oval_record_field# *old_rf) |
| 127 | { |
| 128 | struct oval_record_fieldcxx . . $ oval_record_field# *new_rf; |
| 129 | |
| 130 | switch (old_rf->record_field_typecxx . . $ oval_record_field#record_field_type.) { |
| 131 | case OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.: |
| 132 | { |
| 133 | struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *new_rfs, *old_rfs; |
| 134 | |
| 135 | new_rfs = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*new_rfs)); |
| 136 | if (new_rfs == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 137 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 138 | |
| 139 | old_rfs = (struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) old_rf; |
| 140 | new_rfs->operationcxx . . $ oval_record_field_STATE#operation. = old_rfs->operationcxx . . $ oval_record_field_STATE#operation.; |
| 141 | new_rfs->variablecxx . . $ oval_record_field_STATE#variable. = old_rfs->variablecxx . . $ oval_record_field_STATE#variable.; |
| 142 | new_rfs->var_checkcxx . . $ oval_record_field_STATE#var_check. = old_rfs->var_checkcxx . . $ oval_record_field_STATE#var_check.; |
| 143 | new_rfs->ent_checkcxx . . $ oval_record_field_STATE#ent_check. = old_rfs->ent_checkcxx . . $ oval_record_field_STATE#ent_check.; |
| 144 | new_rf = (struct oval_record_fieldcxx . . $ oval_record_field# *) new_rfs; |
| 145 | break; |
| 146 | } |
| 147 | case OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.: |
| 148 | { |
| 149 | struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# *new_rfi, *old_rfi; |
| 150 | |
| 151 | new_rfi = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*new_rfi)); |
| 152 | if (new_rfi == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 153 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 154 | |
| 155 | old_rfi = (struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# *) old_rf; |
| 156 | new_rfi->statuscxx . . $ oval_record_field_ITEM#status. = old_rfi->statuscxx . . $ oval_record_field_ITEM#status.; |
| 157 | new_rf = (struct oval_record_fieldcxx . . $ oval_record_field# *) new_rfi; |
| 158 | break; |
| 159 | } |
| 160 | default: |
| 161 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Unsupported record field type: %d.", old_rf->record_field_type); |
| 162 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 163 | } |
| 164 | |
| 165 | new_rf->record_field_typecxx . . $ oval_record_field#record_field_type. = old_rf->record_field_typecxx . . $ oval_record_field#record_field_type.; |
| 166 | new_rf->namecxx . . $ oval_record_field#name. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(old_rf->namecxx . . $ oval_record_field#name.); |
| 167 | new_rf->valuecxx . . $ oval_record_field#value. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(old_rf->valuecxx . . $ oval_record_field#value.); |
| 168 | new_rf->datatypecxx . . $ oval_record_field#datatype. = old_rf->datatypecxx . . $ oval_record_field#datatype.; |
| 169 | new_rf->maskcxx . . $ oval_record_field#mask. = old_rf->maskcxx . . $ oval_record_field#mask.; |
| 170 | |
| 171 | return new_rf; |
| 172 | } |
| 173 | |
| 174 | void oval_record_field_freecxx . . $ oval_record_field_free(4e70384b3dd0de8a).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 175 | { |
| 176 | if (rf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 177 | return; |
| 178 | |
| 179 | if (rf->namecxx . . $ oval_record_field#name. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 180 | freecxx . . $ free(5d22bdacc48458e8).(rf->namecxx . . $ oval_record_field#name.); |
| 181 | if (rf->valuecxx . . $ oval_record_field#value. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 182 | freecxx . . $ free(5d22bdacc48458e8).(rf->valuecxx . . $ oval_record_field#value.); |
| 183 | |
| 184 | rf->namecxx . . $ oval_record_field#name. = rf->valuecxx . . $ oval_record_field#value. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 185 | freecxx . . $ free(5d22bdacc48458e8).(rf); |
| 186 | } |
| 187 | |
| 188 | void oval_record_field_set_namecxx . . $ oval_record_field_set_name(cdcb55b60b263754).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, char *name) |
| 189 | { |
| 190 | rf->namecxx . . $ oval_record_field#name. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(name); |
| 191 | } |
| 192 | |
| 193 | void oval_record_field_set_valuecxx . . $ oval_record_field_set_value(cdcb55b60b263754).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, char *value) |
| 194 | { |
| 195 | rf->valuecxx . . $ oval_record_field#value. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(value); |
| 196 | } |
| 197 | |
| 198 | void oval_record_field_set_datatypecxx . . $ oval_record_field_set_datatype(793203213d2fd93c).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, oval_datatype_tcxx . . $ oval_datatype_t# dt) |
| 199 | { |
| 200 | rf->datatypecxx . . $ oval_record_field#datatype. = dt; |
| 201 | } |
| 202 | |
| 203 | void oval_record_field_set_maskcxx . . $ oval_record_field_set_mask(f95316f11611f559).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, int mask) |
| 204 | { |
| 205 | rf->maskcxx . . $ oval_record_field#mask. = mask; |
| 206 | } |
| 207 | |
| 208 | void oval_record_field_set_operationcxx . . $ oval_record_field_set_operation(1e4b9922d72963c7).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, oval_operation_tcxx . . $ oval_operation_t# operation) |
| 209 | { |
| 210 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 211 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (set operation): %d.", rf->record_field_type); |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->operationcxx . . $ oval_record_field_STATE#operation. = operation; |
| 216 | } |
| 217 | |
| 218 | void oval_record_field_set_variablecxx . . $ oval_record_field_set_variable(aeca58efc878cbf4).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, struct oval_variablecxx . . $ oval_variable# *var) |
| 219 | { |
| 220 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 221 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (set variable): %d.", rf->record_field_type); |
| 222 | return; |
| 223 | } |
| 224 | |
| 225 | ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->variablecxx . . $ oval_record_field_STATE#variable. = var; |
| 226 | } |
| 227 | |
| 228 | void oval_record_field_set_var_checkcxx . . $ oval_record_field_set_var_check(1b3a7859aa5a7b91).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, oval_check_tcxx . . $ oval_check_t# var_check) |
| 229 | { |
| 230 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 231 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (set var_check): %d.", rf->record_field_type); |
| 232 | return; |
| 233 | } |
| 234 | |
| 235 | ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->var_checkcxx . . $ oval_record_field_STATE#var_check. = var_check; |
| 236 | } |
| 237 | |
| 238 | void oval_record_field_set_ent_checkcxx . . $ oval_record_field_set_ent_check(1b3a7859aa5a7b91).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, oval_check_tcxx . . $ oval_check_t# ent_check) |
| 239 | { |
| 240 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 241 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (set ent_check): %d.", rf->record_field_type); |
| 242 | return; |
| 243 | } |
| 244 | |
| 245 | ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->ent_checkcxx . . $ oval_record_field_STATE#ent_check. = ent_check; |
| 246 | } |
| 247 | |
| 248 | void oval_record_field_set_statuscxx . . $ oval_record_field_set_status(ecb2a7557e889490).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, oval_syschar_status_tcxx . . $ oval_syschar_status_t# status) |
| 249 | { |
| 250 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.) { |
| 251 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (set status): %d.", rf->record_field_type); |
| 252 | return; |
| 253 | } |
| 254 | |
| 255 | ((struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# *) rf)->statuscxx . . $ oval_record_field_ITEM#status. = status; |
| 256 | } |
| 257 | |
| 258 | oval_record_field_type_tcxx . . $ oval_record_field_type_t# oval_record_field_get_typecxx . . $ oval_record_field_get_type(ecb30557f2d1d66b).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 259 | { |
| 260 | return rf->record_field_typecxx . . $ oval_record_field#record_field_type.; |
| 261 | } |
| 262 | |
| 263 | char *oval_record_field_get_namecxx . . $ oval_record_field_get_name(f090a65955c953b6).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 264 | { |
| 265 | return rf->namecxx . . $ oval_record_field#name.; |
| 266 | } |
| 267 | |
| 268 | char *oval_record_field_get_valuecxx . . $ oval_record_field_get_value(f090a65955c953b6).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 269 | { |
| 270 | return rf->valuecxx . . $ oval_record_field#value.; |
| 271 | } |
| 272 | |
| 273 | oval_datatype_tcxx . . $ oval_datatype_t# oval_record_field_get_datatypecxx . . $ oval_record_field_get_datatype(5e8d642923d2495b).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 274 | { |
| 275 | return rf->datatypecxx . . $ oval_record_field#datatype.; |
| 276 | } |
| 277 | |
| 278 | int oval_record_field_get_maskcxx . . $ oval_record_field_get_mask(66ea631d9b7d4804).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 279 | { |
| 280 | return rf->maskcxx . . $ oval_record_field#mask.; |
| 281 | } |
| 282 | |
| 283 | oval_operation_tcxx . . $ oval_operation_t# oval_record_field_get_operationcxx . . $ oval_record_field_get_operation(caaa327258e6d219).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 284 | { |
| 285 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 286 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (get operation): %d.", rf->record_field_type); |
| 287 | return OVAL_OPERATION_UNKNOWNcxx . . $ OVAL_OPERATION_UNKNOWN.; |
| 288 | } |
| 289 | |
| 290 | return ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->operationcxx . . $ oval_record_field_STATE#operation.; |
| 291 | } |
| 292 | |
| 293 | struct oval_variablecxx . . $ oval_variable# *oval_record_field_get_variablecxx . . $ oval_record_field_get_variable(dfe0208103c09cd0).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 294 | { |
| 295 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 296 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (get variable): %d.", rf->record_field_type); |
| 297 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 298 | } |
| 299 | |
| 300 | return ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->variablecxx . . $ oval_record_field_STATE#variable.; |
| 301 | } |
| 302 | |
| 303 | oval_check_tcxx . . $ oval_check_t# oval_record_field_get_var_checkcxx . . $ oval_record_field_get_var_check(e2c47bbf8284f3bf).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 304 | { |
| 305 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 306 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (get var_check): %d.", rf->record_field_type); |
| 307 | return OVAL_CHECK_UNKNOWNcxx . . $ OVAL_CHECK_UNKNOWN.; |
| 308 | } |
| 309 | |
| 310 | return ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->var_checkcxx . . $ oval_record_field_STATE#var_check.; |
| 311 | } |
| 312 | |
| 313 | oval_check_tcxx . . $ oval_check_t# oval_record_field_get_ent_checkcxx . . $ oval_record_field_get_ent_check(e2c47bbf8284f3bf).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 314 | { |
| 315 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.) { |
| 316 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (get ent_check): %d.", rf->record_field_type); |
| 317 | return OVAL_CHECK_UNKNOWNcxx . . $ OVAL_CHECK_UNKNOWN.; |
| 318 | } |
| 319 | |
| 320 | return ((struct oval_record_field_STATEcxx . . $ oval_record_field_STATE# *) rf)->ent_checkcxx . . $ oval_record_field_STATE#ent_check.; |
| 321 | } |
| 322 | |
| 323 | oval_syschar_status_tcxx . . $ oval_syschar_status_t# oval_record_field_get_statuscxx . . $ oval_record_field_get_status(f13cb40034c51ab2).(struct oval_record_fieldcxx . . $ oval_record_field# *rf) |
| 324 | { |
| 325 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.) { |
| 326 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Wrong record field type (get status): %d.", rf->record_field_type); |
| 327 | return SYSCHAR_STATUS_UNKNOWNcxx . . $ SYSCHAR_STATUS_UNKNOWN.; |
| 328 | } |
| 329 | |
| 330 | return ((struct oval_record_field_ITEMcxx . . $ oval_record_field_ITEM# *) rf)->statuscxx . . $ oval_record_field_ITEM#status.; |
| 331 | } |
| 332 | |
| 333 | static void _oval_record_field_value_consumercxx . . $ _oval_record_field_value_consumer(75961c4613ebf8f5).(char *value, void *rf) |
| 334 | { |
| 335 | oval_record_field_set_valuecxx . . $ oval_record_field_set_value(cdcb55b60b263754).(rf, value); |
| 336 | } |
| 337 | |
| 338 | int oval_record_field_parse_tagcxx . . $ oval_record_field_parse_tag(83f56dced9df2cd3).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, |
| 339 | oscap_consumer_funccxx . . $ oscap_consumer_func# consumer, void *user, |
| 340 | oval_record_field_type_tcxx . . $ oval_record_field_type_t# record_field_type) |
| 341 | { |
| 342 | int ret = 0, mask; |
| 343 | char *name; |
| 344 | oval_datatype_tcxx . . $ oval_datatype_t# datatype; |
| 345 | struct oval_record_fieldcxx . . $ oval_record_field# *rf; |
| 346 | |
| 347 | rf = oval_record_field_newcxx . . $ oval_record_field_new(d4e9acdf0800a817).(record_field_type); |
| 348 | if (rf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 349 | return -1; |
| 350 | |
| 351 | name = (char *) xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "name"); |
| 352 | datatype = oval_datatype_parsecxx . . $ oval_datatype_parse(439a79c16bdf367b).(reader, "datatype", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING.); |
| 353 | mask = oval_parser_boolean_attributecxx . . $ oval_parser_boolean_attribute(a53adaee35698733).(reader, "mask", 0); |
| 354 | |
| 355 | oval_record_field_set_namecxx . . $ oval_record_field_set_name(cdcb55b60b263754).(rf, name); |
| 356 | xmlFreecxx . . $ xmlFree.(name); |
| 357 | oval_record_field_set_datatypecxx . . $ oval_record_field_set_datatype(793203213d2fd93c).(rf, datatype); |
| 358 | oval_record_field_set_maskcxx . . $ oval_record_field_set_mask(f95316f11611f559).(rf, mask); |
| 359 | |
| 360 | switch (record_field_type) { |
| 361 | case OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.: |
| 362 | { |
| 363 | oval_operation_tcxx . . $ oval_operation_t# opr; |
| 364 | oval_check_tcxx . . $ oval_check_t# var_check; |
| 365 | oval_check_tcxx . . $ oval_check_t# ent_check; |
| 366 | char *var_ref; |
| 367 | |
| 368 | opr = oval_operation_parsecxx . . $ oval_operation_parse(a65696f3feb28be6).(reader, "operation", OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.); |
| 369 | oval_record_field_set_operationcxx . . $ oval_record_field_set_operation(1e4b9922d72963c7).(rf, opr); |
| 370 | var_check = oval_check_parsecxx . . $ oval_check_parse(def8dff2972e216b).(reader, "var_check", OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.); |
| 371 | oval_record_field_set_var_checkcxx . . $ oval_record_field_set_var_check(1b3a7859aa5a7b91).(rf, var_check); |
| 372 | ent_check = oval_check_parsecxx . . $ oval_check_parse(def8dff2972e216b).(reader, "entity_check", OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.); |
| 373 | oval_record_field_set_ent_checkcxx . . $ oval_record_field_set_ent_check(1b3a7859aa5a7b91).(rf, ent_check); |
| 374 | |
| 375 | var_ref = (char *) xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "var_ref"); |
| 376 | if (var_ref == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 377 | ret = oscap_parser_text_valuecxx . . $ oscap_parser_text_value(23cd2d9646b6359b).(reader, &_oval_record_field_value_consumercxx . . $ _oval_record_field_value_consumer(75961c4613ebf8f5)., rf); |
| 378 | } else { |
| 379 | struct oval_definition_modelcxx . . $ oval_definition_model# *model; |
| 380 | struct oval_variablecxx . . $ oval_variable# *var; |
| 381 | |
| 382 | model = context->definition_modelcxx . . $ oval_parser_context#definition_model.; |
| 383 | var = oval_definition_model_get_new_variablecxx . . $ oval_definition_model_get_new_variable(d0b65e206dc01f0d).(model, var_ref, OVAL_VARIABLE_UNKNOWNcxx . . $ OVAL_VARIABLE_UNKNOWN.); |
| 384 | oval_record_field_set_variablecxx . . $ oval_record_field_set_variable(aeca58efc878cbf4).(rf, var); |
| 385 | xmlFreecxx . . $ xmlFree.(var_ref); |
| 386 | } |
| 387 | break; |
| 388 | } |
| 389 | case OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.: |
| 390 | { |
| 391 | oval_syschar_status_tcxx . . $ oval_syschar_status_t# status; |
| 392 | |
| 393 | status = oval_syschar_status_parsecxx . . $ oval_syschar_status_parse(4720313583a348e8).(reader, "status", SYSCHAR_STATUS_EXISTScxx . . $ SYSCHAR_STATUS_EXISTS.); |
| 394 | oval_record_field_set_statuscxx . . $ oval_record_field_set_status(ecb2a7557e889490).(rf, status); |
| 395 | ret = oscap_parser_text_valuecxx . . $ oscap_parser_text_value(23cd2d9646b6359b).(reader, &_oval_record_field_value_consumercxx . . $ _oval_record_field_value_consumer(75961c4613ebf8f5)., rf); |
| 396 | break; |
| 397 | } |
| 398 | default: |
| 399 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Impossible happened."); |
| 400 | } |
| 401 | |
| 402 | (*consumer) (rf, user); |
| 403 | |
| 404 | return ret; |
| 405 | } |
| 406 | |
| 407 | xmlNodecxx . . $ xmlNode# *oval_record_field_to_domcxx . . $ oval_record_field_to_dom(8e1fee8fc719207f).(struct oval_record_fieldcxx . . $ oval_record_field# *rf, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! parent_mask, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, xmlNscxx . . $ xmlNs# *namespace) |
| 408 | { |
| 409 | char *name, *value; |
| 410 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rf_mask, masked; |
| 411 | xmlNodecxx . . $ xmlNode# *node, *root_node; |
| 412 | oval_datatype_tcxx . . $ oval_datatype_t# datatype; |
| 413 | |
| 414 | if (rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE. |
| 415 | && rf->record_field_typecxx . . $ oval_record_field#record_field_type. != OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.) { |
| 416 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Unsupported record field type: %d.", rf->record_field_type); |
| 417 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 418 | } |
| 419 | |
| 420 | |
| 421 | |
| 422 | root_node = xmlDocGetRootElementcxx . . $ xmlDocGetRootElement(53aa9a676bd496f2).(doc); |
| 423 | name = oval_record_field_get_namecxx . . $ oval_record_field_get_name(f090a65955c953b6).(rf); |
| 424 | rf_mask = oval_record_field_get_maskcxx . . $ oval_record_field_get_mask(66ea631d9b7d4804).(rf); |
| 425 | if (!xmlStrcmpcxx . . $ xmlStrcmp(e46526da1a64e2fc).(root_node->namecxx . . $ _xmlNode#name., BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! OVAL_ROOT_ELM_RESULTScxx . . $ `src/OVAL/oval_parser_impl.h:40:9`!) |
| 426 | && (rf_mask || parent_mask)) { |
| 427 | value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 428 | masked = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 429 | } else { |
| 430 | value = oval_record_field_get_valuecxx . . $ oval_record_field_get_value(f090a65955c953b6).(rf); |
| 431 | masked = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 432 | } |
| 433 | |
| 434 | node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, namespace, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "field", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! value); |
| 435 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "name", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! name); |
| 436 | datatype = oval_record_field_get_datatypecxx . . $ oval_record_field_get_datatype(5e8d642923d2495b).(rf); |
| 437 | if (datatype != OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING.) |
| 438 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "datatype", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_datatype_get_textcxx . . $ oval_datatype_get_text(a950b89baeb79474).(datatype)); |
| 439 | if (rf_mask) |
| 440 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "mask", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 441 | |
| 442 | switch (rf->record_field_typecxx . . $ oval_record_field#record_field_type.) { |
| 443 | case OVAL_RECORD_FIELD_STATEcxx . . $ OVAL_RECORD_FIELD_STATE.: |
| 444 | { |
| 445 | struct oval_variablecxx . . $ oval_variable# *var; |
| 446 | oval_check_tcxx . . $ oval_check_t# var_check; |
| 447 | oval_check_tcxx . . $ oval_check_t# ent_check; |
| 448 | |
| 449 | if (!masked) { |
| 450 | oval_operation_tcxx . . $ oval_operation_t# opr; |
| 451 | |
| 452 | opr = oval_record_field_get_operationcxx . . $ oval_record_field_get_operation(caaa327258e6d219).(rf); |
| 453 | if (opr != OVAL_OPERATION_EQUALScxx . . $ OVAL_OPERATION_EQUALS.) |
| 454 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "operation", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_operation_get_textcxx . . $ oval_operation_get_text(bf6188043a942ccf).(opr)); |
| 455 | } |
| 456 | var = oval_record_field_get_variablecxx . . $ oval_record_field_get_variable(dfe0208103c09cd0).(rf); |
| 457 | if (var != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 458 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "var_ref", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_variable_get_idcxx . . $ oval_variable_get_id(341a3c7e6ea3818b).(var)); |
| 459 | var_check = oval_record_field_get_var_checkcxx . . $ oval_record_field_get_var_check(e2c47bbf8284f3bf).(rf); |
| 460 | if (var_check != OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.) |
| 461 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "var_check", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_check_get_textcxx . . $ oval_check_get_text(738477922eea9c02).(var_check)); |
| 462 | ent_check = oval_record_field_get_ent_checkcxx . . $ oval_record_field_get_ent_check(e2c47bbf8284f3bf).(rf); |
| 463 | if (ent_check != OVAL_CHECK_ALLcxx . . $ OVAL_CHECK_ALL.) |
| 464 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "entity_check", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_check_get_textcxx . . $ oval_check_get_text(738477922eea9c02).(ent_check)); |
| 465 | break; |
| 466 | } |
| 467 | case OVAL_RECORD_FIELD_ITEMcxx . . $ OVAL_RECORD_FIELD_ITEM.: |
| 468 | { |
| 469 | oval_syschar_status_tcxx . . $ oval_syschar_status_t# status; |
| 470 | |
| 471 | status = oval_record_field_get_statuscxx . . $ oval_record_field_get_status(f13cb40034c51ab2).(rf); |
| 472 | if (status != SYSCHAR_STATUS_EXISTScxx . . $ SYSCHAR_STATUS_EXISTS.) |
| 473 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "status", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! oval_syschar_status_get_textcxx . . $ oval_syschar_status_get_text(f50b4a8fd3bcb7d8).(status)); |
| 474 | break; |
| 475 | } |
| 476 | default: |
| 477 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Impossible happened."); |
| 478 | } |
| 479 | |
| 480 | return node; |
| 481 | } |