| 1 | /** |
| 2 | * @file oval_state.c |
| 3 | * \brief Open Vulnerability and Assessment Language |
| 4 | * |
| 5 | * See more details at http://oval.mitre.org/ |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * Copyright 2009--2013 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 | * "David Niemoller" <[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 <stdlib.h> |
| 35 | #include <stdio.h> |
| 36 | #include <string.h> |
| 37 | |
| 38 | #include "oval_definitions_impl.h"cxx . . $ `<file>/src/OVAL/oval_definitions_impl.h`/ |
| 39 | #include "adt/oval_collection_impl.h"cxx . . $ `<file>/src/OVAL/adt/oval_collection_impl.h`/ |
| 40 | #include "oval_agent_api_impl.h"cxx . . $ `<file>/src/OVAL/oval_agent_api_impl.h`/ |
| 41 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 42 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 43 | #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/ |
| 44 | |
| 45 | typedef struct oval_statecxx . . $ oval_state# { |
| 46 | struct oval_definition_modelcxx . . $ oval_definition_model# *modelcxx . . $ oval_state#model.; |
| 47 | oval_subtype_tcxx . . $ oval_subtype_t# subtypecxx . . $ oval_state#subtype.; |
| 48 | char *commentcxx . . $ oval_state#comment.; |
| 49 | char *idcxx . . $ oval_state#id.; |
| 50 | int deprecatedcxx . . $ oval_state#deprecated.; |
| 51 | int versioncxx . . $ oval_state#version.; |
| 52 | oval_operator_tcxx . . $ oval_operator_t# operatorcxx . . $ oval_state#operator.; |
| 53 | struct oval_collectioncxx . . $ oval_collection# *notescxx . . $ oval_state#notes.; |
| 54 | struct oval_collectioncxx . . $ oval_collection# *contentscxx . . $ oval_state#contents.; |
| 55 | } oval_state_tcxx . . $ oval_state_t#; |
| 56 | |
| 57 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_state_iterator_has_morecxx . . $ oval_state_iterator_has_more(bbfacbd9c1bc3d63).(struct oval_state_iteratorcxx . . $ oval_state_iterator# *oc_state) |
| 58 | { |
| 59 | return oval_collection_iterator_has_morecxx . . $ oval_collection_iterator_has_more(de0650ab9b639739).((struct oval_iteratorcxx . . $ oval_iterator# *) |
| 60 | oc_state); |
| 61 | } |
| 62 | |
| 63 | struct oval_statecxx . . $ oval_state# *oval_state_iterator_nextcxx . . $ oval_state_iterator_next(f0883bc3981b419).(struct oval_state_iteratorcxx . . $ oval_state_iterator# |
| 64 | *oc_state) |
| 65 | { |
| 66 | return (struct oval_statecxx . . $ oval_state# *) |
| 67 | oval_collection_iterator_nextcxx . . $ oval_collection_iterator_next(344074693c9690a9).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_state); |
| 68 | } |
| 69 | |
| 70 | void oval_state_iterator_freecxx . . $ oval_state_iterator_free(37c8c23faa65426a).(struct oval_state_iteratorcxx . . $ oval_state_iterator# |
| 71 | *oc_state) |
| 72 | { |
| 73 | oval_collection_iterator_freecxx . . $ oval_collection_iterator_free(ee496816570b41f7).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_state); |
| 74 | } |
| 75 | |
| 76 | oval_family_tcxx . . $ oval_family_t# oval_state_get_familycxx . . $ oval_state_get_family(881d2a26d6a512d1).(struct oval_statecxx . . $ oval_state# *state) |
| 77 | { |
| 78 | return (oval_state_get_subtypecxx . . $ oval_state_get_subtype(41aca620b69caf1a).(state) / 1000) * 1000; |
| 79 | } |
| 80 | |
| 81 | oval_subtype_tcxx . . $ oval_subtype_t# oval_state_get_subtypecxx . . $ oval_state_get_subtype(41aca620b69caf1a).(struct oval_statecxx . . $ oval_state# * state) |
| 82 | { |
| 83 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 84 | |
| 85 | return ((struct oval_statecxx . . $ oval_state# *)state)->subtypecxx . . $ oval_state#subtype.; |
| 86 | } |
| 87 | |
| 88 | const char *oval_state_get_namecxx . . $ oval_state_get_name(64d4b690f703fd61).(struct oval_statecxx . . $ oval_state# *state) |
| 89 | { |
| 90 | return oval_subtype_get_textcxx . . $ oval_subtype_get_text(ee6b3dcae047e21f).(oval_state_get_subtypecxx . . $ oval_state_get_subtype(41aca620b69caf1a).(state)); |
| 91 | } |
| 92 | |
| 93 | struct oval_string_iteratorcxx . . $ oval_string_iterator# *oval_state_get_notescxx . . $ oval_state_get_notes(58c9cf75bdeda59d).(struct oval_statecxx . . $ oval_state# *state) |
| 94 | { |
| 95 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 96 | |
| 97 | return (struct oval_string_iteratorcxx . . $ oval_string_iterator# *)oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(state->notescxx . . $ oval_state#notes.); |
| 98 | } |
| 99 | |
| 100 | struct oval_state_content_iteratorcxx . . $ oval_state_content_iterator# *oval_state_get_contentscxx . . $ oval_state_get_contents(e38d902cdc6b5c2d).(struct oval_statecxx . . $ oval_state# *state) |
| 101 | { |
| 102 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 103 | |
| 104 | return (struct oval_state_content_iteratorcxx . . $ oval_state_content_iterator# *) |
| 105 | oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(state->contentscxx . . $ oval_state#contents.); |
| 106 | } |
| 107 | |
| 108 | char *oval_state_get_commentcxx . . $ oval_state_get_comment(3f993b0a468bf006).(struct oval_statecxx . . $ oval_state# *state) |
| 109 | { |
| 110 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 111 | |
| 112 | return ((struct oval_statecxx . . $ oval_state# *)state)->commentcxx . . $ oval_state#comment.; |
| 113 | } |
| 114 | |
| 115 | char *oval_state_get_idcxx . . $ oval_state_get_id(3f993b0a468bf006).(struct oval_statecxx . . $ oval_state# *state) |
| 116 | { |
| 117 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 118 | |
| 119 | return ((struct oval_statecxx . . $ oval_state# *)state)->idcxx . . $ oval_state#id.; |
| 120 | } |
| 121 | |
| 122 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_state_get_deprecatedcxx . . $ oval_state_get_deprecated(3cabe08f2d19fc38).(struct oval_statecxx . . $ oval_state# *state) |
| 123 | { |
| 124 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 125 | |
| 126 | return ((struct oval_statecxx . . $ oval_state# *)state)->deprecatedcxx . . $ oval_state#deprecated.; |
| 127 | } |
| 128 | |
| 129 | int oval_state_get_versioncxx . . $ oval_state_get_version(48b1e7ff30d26459).(struct oval_statecxx . . $ oval_state# *state) |
| 130 | { |
| 131 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 132 | |
| 133 | return state->versioncxx . . $ oval_state#version.; |
| 134 | } |
| 135 | |
| 136 | int oval_state_get_operatorcxx . . $ oval_state_get_operator(48b1e7ff30d26459).(struct oval_statecxx . . $ oval_state# *state) |
| 137 | { |
| 138 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 139 | |
| 140 | return state->operatorcxx . . $ oval_state#operator.; |
| 141 | } |
| 142 | |
| 143 | struct oval_statecxx . . $ oval_state# *oval_state_newcxx . . $ oval_state_new(a16da6d5657b0c91).(struct oval_definition_modelcxx . . $ oval_definition_model# *model, const char *id) |
| 144 | { |
| 145 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model); |
| 146 | oval_state_tcxx . . $ oval_state_t# *state; |
| 147 | |
| 148 | state = (oval_state_tcxx . . $ oval_state_t# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(oval_state_tcxx . . $ oval_state_t#)); |
| 149 | if (state == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 150 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | |
| 152 | state->deprecatedcxx . . $ oval_state#deprecated. = 0; |
| 153 | state->versioncxx . . $ oval_state#version. = 0; |
| 154 | state->operatorcxx . . $ oval_state#operator. = OVAL_OPERATOR_UNKNOWNcxx . . $ OVAL_OPERATOR_UNKNOWN.; |
| 155 | state->subtypecxx . . $ oval_state#subtype. = OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.; |
| 156 | state->commentcxx . . $ oval_state#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 157 | state->idcxx . . $ oval_state#id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(id); |
| 158 | state->notescxx . . $ oval_state#notes. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).(); |
| 159 | state->contentscxx . . $ oval_state#contents. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).(); |
| 160 | state->modelcxx . . $ oval_state#model. = model; |
| 161 | |
| 162 | oval_definition_model_add_statecxx . . $ oval_definition_model_add_state(1b858300cf94c4cd).(model, state); |
| 163 | |
| 164 | return state; |
| 165 | } |
| 166 | |
| 167 | struct oval_statecxx . . $ oval_state# *oval_state_clonecxx . . $ oval_state_clone(4b918e9848c3d95f).(struct oval_definition_modelcxx . . $ oval_definition_model# *new_model, struct oval_statecxx . . $ oval_state# *old_state) { |
| 168 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(old_state); |
| 169 | |
| 170 | oval_state_tcxx . . $ oval_state_t# *new_state = oval_definition_model_get_statecxx . . $ oval_definition_model_get_state(a16da6d5657b0c91).(new_model, old_state->idcxx . . $ oval_state#id.); |
| 171 | if (new_state == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 172 | new_state = oval_state_newcxx . . $ oval_state_new(a16da6d5657b0c91).(new_model, old_state->idcxx . . $ oval_state#id.); |
| 173 | oval_state_set_deprecatedcxx . . $ oval_state_set_deprecated(c410d811d11c46c5).(new_state, old_state->deprecatedcxx . . $ oval_state#deprecated.); |
| 174 | oval_state_set_versioncxx . . $ oval_state_set_version(adff128bea792ee2).(new_state, old_state->versioncxx . . $ oval_state#version.); |
| 175 | oval_state_set_operatorcxx . . $ oval_state_set_operator(3e79e328541dabf9).(new_state, old_state->operatorcxx . . $ oval_state#operator.); |
| 176 | oval_state_set_subtypecxx . . $ oval_state_set_subtype(d59ebe5edbb118cb).(new_state, old_state->subtypecxx . . $ oval_state#subtype.); |
| 177 | oval_state_set_commentcxx . . $ oval_state_set_comment(e1cd23973b21af10).(new_state, old_state->commentcxx . . $ oval_state#comment.); |
| 178 | |
| 179 | struct oval_string_iteratorcxx . . $ oval_string_iterator# *notes = oval_state_get_notescxx . . $ oval_state_get_notes(58c9cf75bdeda59d).(old_state); |
| 180 | while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) { |
| 181 | char *note = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(notes); |
| 182 | oval_state_add_notecxx . . $ oval_state_add_note(e1cd23973b21af10).(new_state, note); |
| 183 | } |
| 184 | oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(notes); |
| 185 | struct oval_state_content_iteratorcxx . . $ oval_state_content_iterator# *contents = oval_state_get_contentscxx . . $ oval_state_get_contents(e38d902cdc6b5c2d).(old_state); |
| 186 | while (oval_state_content_iterator_has_morecxx . . $ oval_state_content_iterator_has_more(344811bbb4806d19).(contents)) { |
| 187 | struct oval_state_contentcxx . . $ oval_state_content# *content = oval_state_content_iterator_nextcxx . . $ oval_state_content_iterator_next(43c3368aa9ccef0c).(contents); |
| 188 | oval_state_add_contentcxx . . $ oval_state_add_content(4d9c7c28f5b3c33e).(new_state, oval_state_content_clonecxx . . $ oval_state_content_clone(f4c3f85bb04e73ab).(new_model, content)); |
| 189 | } |
| 190 | oval_state_content_iterator_freecxx . . $ oval_state_content_iterator_free(526a40962d3af9e1).(contents); |
| 191 | } |
| 192 | return new_state; |
| 193 | } |
| 194 | |
| 195 | void oval_state_freecxx . . $ oval_state_free(11510fad1be1ea5e).(struct oval_statecxx . . $ oval_state# *state) |
| 196 | { |
| 197 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 198 | |
| 199 | if (state->commentcxx . . $ oval_state#comment. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 200 | freecxx . . $ free(5d22bdacc48458e8).(state->commentcxx . . $ oval_state#comment.); |
| 201 | if (state->idcxx . . $ oval_state#id. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 202 | freecxx . . $ free(5d22bdacc48458e8).(state->idcxx . . $ oval_state#id.); |
| 203 | oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(state->notescxx . . $ oval_state#notes., &freecxx . . $ free(5d22bdacc48458e8).); |
| 204 | oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(state->contentscxx . . $ oval_state#contents., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oval_state_content_freecxx . . $ oval_state_content_free(eae10a215fce6875).); |
| 205 | |
| 206 | state->commentcxx . . $ oval_state#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 207 | state->contentscxx . . $ oval_state#contents. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 208 | state->idcxx . . $ oval_state#id. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 209 | state->notescxx . . $ oval_state#notes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 210 | freecxx . . $ free(5d22bdacc48458e8).(state); |
| 211 | } |
| 212 | |
| 213 | void oval_state_set_subtypecxx . . $ oval_state_set_subtype(d59ebe5edbb118cb).(struct oval_statecxx . . $ oval_state# *state, oval_subtype_tcxx . . $ oval_subtype_t# subtype) |
| 214 | { |
| 215 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 216 | state->subtypecxx . . $ oval_state#subtype. = subtype; |
| 217 | } |
| 218 | |
| 219 | void oval_state_add_notecxx . . $ oval_state_add_note(e1cd23973b21af10).(struct oval_statecxx . . $ oval_state# *state, char *notes) |
| 220 | { |
| 221 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 222 | oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(state->notescxx . . $ oval_state#notes., (void *)oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(notes)); |
| 223 | } |
| 224 | |
| 225 | void oval_state_set_commentcxx . . $ oval_state_set_comment(e1cd23973b21af10).(struct oval_statecxx . . $ oval_state# *state, char *comm) |
| 226 | { |
| 227 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 228 | freecxx . . $ free(5d22bdacc48458e8).(state->commentcxx . . $ oval_state#comment.); |
| 229 | state->commentcxx . . $ oval_state#comment. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(comm); |
| 230 | } |
| 231 | |
| 232 | void oval_state_set_deprecatedcxx . . $ oval_state_set_deprecated(c410d811d11c46c5).(struct oval_statecxx . . $ oval_state# *state, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! deprecated) |
| 233 | { |
| 234 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 235 | state->deprecatedcxx . . $ oval_state#deprecated. = deprecated; |
| 236 | } |
| 237 | |
| 238 | void oval_state_set_versioncxx . . $ oval_state_set_version(adff128bea792ee2).(struct oval_statecxx . . $ oval_state# *state, int version) |
| 239 | { |
| 240 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 241 | state->versioncxx . . $ oval_state#version. = version; |
| 242 | } |
| 243 | |
| 244 | void oval_state_set_operatorcxx . . $ oval_state_set_operator(3e79e328541dabf9).(struct oval_statecxx . . $ oval_state# *state, oval_operator_tcxx . . $ oval_operator_t# operator) |
| 245 | { |
| 246 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 247 | state->operatorcxx . . $ oval_state#operator. = operator; |
| 248 | } |
| 249 | |
| 250 | void oval_state_add_contentcxx . . $ oval_state_add_content(4d9c7c28f5b3c33e).(struct oval_statecxx . . $ oval_state# *state, struct oval_state_contentcxx . . $ oval_state_content# *content) |
| 251 | { |
| 252 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(state); |
| 253 | oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(state->contentscxx . . $ oval_state#contents., content); |
| 254 | } |
| 255 | |
| 256 | oval_schema_version_tcxx . . $ oval_schema_version_t# oval_state_get_platform_schema_versioncxx . . $ oval_state_get_platform_schema_version(4df827b57b1119ed).(const struct oval_statecxx . . $ oval_state# *state) |
| 257 | { |
| 258 | oval_family_tcxx . . $ oval_family_t# family = oval_state_get_familycxx . . $ oval_state_get_family(881d2a26d6a512d1).((struct oval_statecxx . . $ oval_state# *)state); |
| 259 | const char *platform = oval_family_get_textcxx . . $ oval_family_get_text(e0888d2a111f8f85).(family); |
| 260 | return oval_definition_model_get_platform_schema_versioncxx . . $ oval_definition_model_get_platform_schema_version(4cbe2c112a234203).(state->modelcxx . . $ oval_state#model., platform); |
| 261 | } |
| 262 | |
| 263 | static void _oval_note_consumercxx . . $ _oval_note_consumer(75961c4613ebf8f5).(char *text, void *state) |
| 264 | { |
| 265 | oval_state_add_notecxx . . $ oval_state_add_note(e1cd23973b21af10).(state, text); |
| 266 | } |
| 267 | |
| 268 | static int _oval_state_parse_notescxx . . $ _oval_state_parse_notes(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *user) |
| 269 | { |
| 270 | struct oval_statecxx . . $ oval_state# *state = (struct oval_statecxx . . $ oval_state# *)user; |
| 271 | return oscap_parser_text_valuecxx . . $ oscap_parser_text_value(23cd2d9646b6359b).(reader, _oval_note_consumercxx . . $ _oval_note_consumer(75961c4613ebf8f5)., state); |
| 272 | } |
| 273 | |
| 274 | static void _oval_state_content_consumercxx . . $ _oval_state_content_consumer(7841fc97f46c6a84).(struct oval_state_contentcxx . . $ oval_state_content# *content, struct oval_statecxx . . $ oval_state# *state) { |
| 275 | oval_state_add_contentcxx . . $ oval_state_add_content(4d9c7c28f5b3c33e).(state, content); |
| 276 | } |
| 277 | |
| 278 | static int _oval_state_parse_tagcxx . . $ _oval_state_parse_tag(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *user) |
| 279 | { |
| 280 | __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(user); |
| 281 | |
| 282 | struct oval_statecxx . . $ oval_state# *state = (struct oval_statecxx . . $ oval_state# *)user; |
| 283 | char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader); |
| 284 | xmlCharcxx . . $ xmlChar# *namespace = xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader); |
| 285 | int return_code = 0; |
| 286 | if ((strcmpcxx . . $ strcmp(5ae29d726ae57f88).(tagname, "notes") == 0)) { |
| 287 | return_code = oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, &_oval_state_parse_notescxx . . $ _oval_state_parse_notes(cf369959597901d1)., state); |
| 288 | } else { |
| 289 | return_code = oval_state_content_parse_tagcxx . . $ oval_state_content_parse_tag(29f485c9b2aa6ded). |
| 290 | (reader, context, (oscap_consumer_funccxx . . $ oscap_consumer_func#) _oval_state_content_consumercxx . . $ _oval_state_content_consumer(7841fc97f46c6a84)., state); |
| 291 | } |
| 292 | freecxx . . $ free(5d22bdacc48458e8).(tagname); |
| 293 | freecxx . . $ free(5d22bdacc48458e8).(namespace); |
| 294 | return return_code; |
| 295 | } |
| 296 | |
| 297 | int oval_state_parse_tagcxx . . $ oval_state_parse_tag(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *usr) |
| 298 | { |
| 299 | struct oval_definition_modelcxx . . $ oval_definition_model# *model = context->definition_modelcxx . . $ oval_parser_context#definition_model.; |
| 300 | char *id = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id"); |
| 301 | struct oval_statecxx . . $ oval_state# *state = oval_definition_model_get_new_statecxx . . $ oval_definition_model_get_new_state(a16da6d5657b0c91).(model, id); |
| 302 | oval_subtype_tcxx . . $ oval_subtype_t# subtype = oval_subtype_parsecxx . . $ oval_subtype_parse(f7bb0059f83e9a03).(reader); |
| 303 | if (subtype == OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.) { |
| 304 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Unknown state type %s, using independent/unknown", id); |
| 305 | subtype = OVAL_INDEPENDENT_UNKNOWNcxx . . $ OVAL_INDEPENDENT_UNKNOWN.; |
| 306 | } |
| 307 | freecxx . . $ free(5d22bdacc48458e8).(id); |
| 308 | oval_state_set_subtypecxx . . $ oval_state_set_subtype(d59ebe5edbb118cb).(state, subtype); |
| 309 | char *comm = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment"); |
| 310 | if (comm != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 311 | oval_state_set_commentcxx . . $ oval_state_set_comment(e1cd23973b21af10).(state, comm); |
| 312 | freecxx . . $ free(5d22bdacc48458e8).(comm); |
| 313 | comm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 314 | } |
| 315 | int deprecated = oval_parser_boolean_attributecxx . . $ oval_parser_boolean_attribute(a53adaee35698733).(reader, "deprecated", 0); |
| 316 | oval_state_set_deprecatedcxx . . $ oval_state_set_deprecated(c410d811d11c46c5).(state, deprecated); |
| 317 | char *version = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version"); |
| 318 | oval_state_set_versioncxx . . $ oval_state_set_version(adff128bea792ee2).(state, atoicxx . . $ atoi(5c4306d8553b3696).(version)); |
| 319 | freecxx . . $ free(5d22bdacc48458e8).(version); |
| 320 | oval_operator_tcxx . . $ oval_operator_t# operator = oval_operator_parsecxx . . $ oval_operator_parse(68bd3d297b7c50e).(reader, "operator", OVAL_OPERATOR_ANDcxx . . $ OVAL_OPERATOR_AND.); |
| 321 | oval_state_set_operatorcxx . . $ oval_state_set_operator(3e79e328541dabf9).(state, operator); |
| 322 | |
| 323 | int return_code = oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, &_oval_state_parse_tagcxx . . $ _oval_state_parse_tag(cf369959597901d1)., state); |
| 324 | return return_code; |
| 325 | } |
| 326 | |
| 327 | xmlNodecxx . . $ xmlNode# *oval_state_to_domcxx . . $ oval_state_to_dom(77c1a7658257bab2).(struct oval_statecxx . . $ oval_state# *state, xmlDoccxx . . $ xmlDoc# * doc, xmlNodecxx . . $ xmlNode# * parent) |
| 328 | { |
| 329 | xmlNodecxx . . $ xmlNode# *state_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 330 | |
| 331 | /* get state name */ |
| 332 | oval_subtype_tcxx . . $ oval_subtype_t# subtype = oval_state_get_subtypecxx . . $ oval_state_get_subtype(41aca620b69caf1a).(state); |
| 333 | if (subtype == OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.) { |
| 334 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unable to export unknown state %s, skipping", oval_state_get_id(state)); |
| 335 | return state_node; |
| 336 | } |
| 337 | |
| 338 | const char *subtype_text = oval_subtype_get_textcxx . . $ oval_subtype_get_text(ee6b3dcae047e21f).(subtype); |
| 339 | char *state_name = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(strlencxx . . $ strlen(751346f8406fd082).(subtype_text) + 7); |
| 340 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(state_name, "%s_state", subtype_text); |
| 341 | |
| 342 | oval_family_tcxx . . $ oval_family_t# family = oval_state_get_familycxx . . $ oval_state_get_family(881d2a26d6a512d1).(state); |
| 343 | |
| 344 | /* search namespace & create child */ |
| 345 | xmlNscxx . . $ xmlNs# *ns_family = oval_family_to_namespacecxx . . $ oval_family_to_namespace(8189eb69f31875e4).(family, (const char *) OVAL_DEFINITIONS_NAMESPACEcxx . . $ `src/OVAL/oval_agent_api_impl.h:50:9`!, doc, parent); |
| 346 | state_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, ns_family, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! state_name, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 347 | freecxx . . $ free(5d22bdacc48458e8).(state_name); |
| 348 | |
| 349 | char *id = oval_state_get_idcxx . . $ oval_state_get_id(3f993b0a468bf006).(state); |
| 350 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(state_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! id); |
| 351 | |
| 352 | char version[10]; |
| 353 | *version = '\0'; |
| 354 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(version, sizeof(version), "%d", oval_state_get_versioncxx . . $ oval_state_get_version(48b1e7ff30d26459).(state)); |
| 355 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(state_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! version); |
| 356 | |
| 357 | oval_operator_tcxx . . $ oval_operator_t# operator = oval_state_get_operatorcxx . . $ oval_state_get_operator(48b1e7ff30d26459).(state); |
| 358 | const char *operator_text = oval_operator_get_textcxx . . $ oval_operator_get_text(31e5cd98682f5d2e).(operator); |
| 359 | if (operator != OVAL_OPERATOR_ANDcxx . . $ OVAL_OPERATOR_AND.) |
| 360 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(state_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "operator", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! operator_text); |
| 361 | |
| 362 | char *comm = oval_state_get_commentcxx . . $ oval_state_get_comment(3f993b0a468bf006).(state); |
| 363 | if (comm) |
| 364 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(state_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! comm); |
| 365 | |
| 366 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! deprecated = oval_state_get_deprecatedcxx . . $ oval_state_get_deprecated(3cabe08f2d19fc38).(state); |
| 367 | if (deprecated) |
| 368 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(state_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "deprecated", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 369 | |
| 370 | struct oval_string_iteratorcxx . . $ oval_string_iterator# *notes = oval_state_get_notescxx . . $ oval_state_get_notes(58c9cf75bdeda59d).(state); |
| 371 | if (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) { |
| 372 | xmlNscxx . . $ xmlNs# *ns_definitions = xmlSearchNsByHrefcxx . . $ xmlSearchNsByHref(d0fb0b6b99319c4).(doc, parent, OVAL_DEFINITIONS_NAMESPACEcxx . . $ `src/OVAL/oval_agent_api_impl.h:50:9`!); |
| 373 | xmlNodecxx . . $ xmlNode# *notes_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(state_node, ns_definitions, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "notes", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 374 | while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) { |
| 375 | char *note = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(notes); |
| 376 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(notes_node, ns_definitions, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "note", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! note); |
| 377 | } |
| 378 | } |
| 379 | oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(notes); |
| 380 | |
| 381 | struct oval_state_content_iteratorcxx . . $ oval_state_content_iterator# *contents = oval_state_get_contentscxx . . $ oval_state_get_contents(e38d902cdc6b5c2d).(state); |
| 382 | while (oval_state_content_iterator_has_morecxx . . $ oval_state_content_iterator_has_more(344811bbb4806d19).(contents)) { |
| 383 | struct oval_state_contentcxx . . $ oval_state_content# *content = oval_state_content_iterator_nextcxx . . $ oval_state_content_iterator_next(43c3368aa9ccef0c).(contents); |
| 384 | oval_state_content_to_domcxx . . $ oval_state_content_to_dom(96e33299e316026f).(content, doc, state_node); |
| 385 | } |
| 386 | oval_state_content_iterator_freecxx . . $ oval_state_content_iterator_free(526a40962d3af9e1).(contents); |
| 387 | return state_node; |
| 388 | } |