Debian Codegraph @

src/OVAL/oval_varModel.c

raw symbols SCIP
1 /**
2 * @file oval_varModel.c
3 * \brief Open Vulnerability and Assessment Language
4 *
5 * See more details at http://oval.mitre.org/
6 */
7
8 /*
9 * Copyright 2009--2014 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 <string.h>
35 #include <time.h>
36
37 #include "oval_definitions_impl.h"cxx . . $ `<file>/src/OVAL/oval_definitions_impl.h`/
38 #include "oval_agent_api_impl.h"cxx . . $ `<file>/src/OVAL/oval_agent_api_impl.h`/
39 #include "oval_parser_impl.h"cxx . . $ `<file>/src/OVAL/oval_parser_impl.h`/
40 #include "adt/oval_string_map_impl.h"cxx . . $ `<file>/src/OVAL/adt/oval_string_map_impl.h`/
41 #include "oval_system_characteristics_impl.h"cxx . . $ `<file>/src/OVAL/oval_system_characteristics_impl.h`/
42 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
43 #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
44 #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/
45 #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/
46 #include "oscap_source.h"cxx . . $ `<file>/src/source/public/oscap_source.h`/
47 #include "source/oscap_source_priv.h"cxx . . $ `<file>/src/source/oscap_source_priv.h`/
48
49 typedef struct _oval_variable_model_framecxx . . $ _oval_variable_model_frame# {
50 char *idcxx . . $ _oval_variable_model_frame#id.;
51 char *commentcxx . . $ _oval_variable_model_frame#comment.;
52 struct oval_collectioncxx . . $ oval_collection# *valuescxx . . $ _oval_variable_model_frame#values.;
53 oval_datatype_tcxx . . $ oval_datatype_t# datatypecxx . . $ _oval_variable_model_frame#datatype.;
54 } _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t#;
55
56 typedef struct oval_variable_modelcxx . . $ oval_variable_model# {
57 struct oval_generatorcxx . . $ oval_generator# *generatorcxx . . $ oval_variable_model#generator.;
58 struct oval_string_mapcxx . . $ oval_string_map# *varmapcxx . . $ oval_variable_model#varmap.;
59 } oval_variable_model_tcxx . . $ oval_variable_model_t#;
60
61 static _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *_oval_variable_model_frame_newcxx . . $ _oval_variable_model_frame_new(a27244b77af20f95).(char *id, const char *comm, oval_datatype_tcxx . . $ oval_datatype_t# datatype);
62 static int _oval_variable_model_parse_tagcxx . . $ _oval_variable_model_parse_tag(6e3b6ec89b15c13d).(xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context,
63 struct oval_variable_modelcxx . . $ oval_variable_model# *model);
64 static void _oval_variable_model_frame_freecxx . . $ _oval_variable_model_frame_free(52a3f459f9e44044).(_oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# * frame);
65 static int _oval_variable_model_parse_variable_valuescxx . . $ _oval_variable_model_parse_variable_values(dce8d0051dd75cea).(xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context,
66 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# * frame);
67 static int _oval_variable_model_parse_variablecxx . . $ _oval_variable_model_parse_variable(6e3b6ec89b15c13d).(xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context,
68 struct oval_variable_modelcxx . . $ oval_variable_model# *model);
69 static int _oval_variable_model_parse_variablescxx . . $ _oval_variable_model_parse_variables(6e3b6ec89b15c13d).(xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context,
70 struct oval_variable_modelcxx . . $ oval_variable_model# *model);
71 static int _oval_variable_model_parsecxx . . $ _oval_variable_model_parse(85381c989cfb3d88).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, xmlTextReadercxx . . $ xmlTextReader# * reader, void *user_param);
72
73 static _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *_oval_variable_model_frame_newcxx . . $ _oval_variable_model_frame_new(a27244b77af20f95).(char *id, const char *comm, oval_datatype_tcxx . . $ oval_datatype_t# datatype)
74 {
75 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame = (_oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(_oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t#));
76 if (frame == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
77 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
78 frame->idcxx . . $ _oval_variable_model_frame#id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(id);
79 frame->commentcxx . . $ _oval_variable_model_frame#comment. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(comm);
80 frame->datatypecxx . . $ _oval_variable_model_frame#datatype. = datatype;
81 frame->valuescxx . . $ _oval_variable_model_frame#values. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).();
82 return frame;
83 }
84
85 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_variable_model_iterator_has_morecxx . . $ oval_variable_model_iterator_has_more(4ecf502c50f92d8e).(struct oval_variable_model_iteratorcxx . . $ oval_variable_model_iterator# *itr)
86 {
87 return oval_collection_iterator_has_morecxx . . $ oval_collection_iterator_has_more(de0650ab9b639739).((struct oval_iteratorcxx . . $ oval_iterator# *) itr);
88 }
89
90 struct oval_variable_modelcxx . . $ oval_variable_model# *oval_variable_model_iterator_nextcxx . . $ oval_variable_model_iterator_next(883bbd22cc5fc798).(struct oval_variable_model_iteratorcxx . . $ oval_variable_model_iterator# *itr)
91 {
92 return (struct oval_variable_modelcxx . . $ oval_variable_model# *) oval_collection_iterator_nextcxx . . $ oval_collection_iterator_next(344074693c9690a9).((struct oval_iteratorcxx . . $ oval_iterator# *) itr);
93 }
94
95 void oval_variable_model_iterator_freecxx . . $ oval_variable_model_iterator_free(2dd836cbecd801ed).(struct oval_variable_model_iteratorcxx . . $ oval_variable_model_iterator# *itr)
96 {
97 oval_collection_iterator_freecxx . . $ oval_collection_iterator_free(ee496816570b41f7).((struct oval_iteratorcxx . . $ oval_iterator# *) itr);
98 }
99
100 static void _oval_variable_model_frame_freecxx . . $ _oval_variable_model_frame_free(52a3f459f9e44044).(_oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# * frame)
101 {
102 if (frame) {
103 if (frame->idcxx . . $ _oval_variable_model_frame#id.)
104 freecxx . . $ free(5d22bdacc48458e8).(frame->idcxx . . $ _oval_variable_model_frame#id.);
105 if (frame->commentcxx . . $ _oval_variable_model_frame#comment.)
106 freecxx . . $ free(5d22bdacc48458e8).(frame->commentcxx . . $ _oval_variable_model_frame#comment.);
107 oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(frame->valuescxx . . $ _oval_variable_model_frame#values., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oval_value_freecxx . . $ oval_value_free(d25d962808f14280).);
108 frame->idcxx . . $ _oval_variable_model_frame#id. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
109 frame->commentcxx . . $ _oval_variable_model_frame#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
110 frame->valuescxx . . $ _oval_variable_model_frame#values. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
111 frame->datatypecxx . . $ _oval_variable_model_frame#datatype. = 0;
112 freecxx . . $ free(5d22bdacc48458e8).(frame);
113 }
114 }
115
116 struct oval_variable_modelcxx . . $ oval_variable_model# *oval_variable_model_newcxx . . $ oval_variable_model_new(76160d4386b12e53).()
117 {
118 oval_variable_model_tcxx . . $ oval_variable_model_t# *model = (oval_variable_model_tcxx . . $ oval_variable_model_t# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(oval_variable_model_tcxx . . $ oval_variable_model_t#));
119 if (model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
120 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
121 model->generatorcxx . . $ oval_variable_model#generator. = oval_generator_newcxx . . $ oval_generator_new(1db813de85019778).();
122 model->varmapcxx . . $ oval_variable_model#varmap. = oval_string_map_newcxx . . $ oval_string_map_new(c786b134e882bd29).();
123 return model;
124 }
125
126 struct oval_variable_modelcxx . . $ oval_variable_model# *oval_variable_model_clonecxx . . $ oval_variable_model_clone(ab9763729a7f110b).(struct oval_variable_modelcxx . . $ oval_variable_model# *old_model)
127 {
128 struct oval_variable_modelcxx . . $ oval_variable_model# *new_model = oval_variable_model_newcxx . . $ oval_variable_model_new(76160d4386b12e53).();
129 struct oval_string_iteratorcxx . . $ oval_string_iterator# *old_varids = oval_variable_model_get_variable_idscxx . . $ oval_variable_model_get_variable_ids(7ca1cb012924580c).(old_model);
130 while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(old_varids)) {
131 char *varid = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(old_varids);
132 oval_datatype_tcxx . . $ oval_datatype_t# datatype = oval_variable_model_get_datatypecxx . . $ oval_variable_model_get_datatype(a3bce65bce035fc2).(old_model, varid);
133 struct oval_value_iteratorcxx . . $ oval_value_iterator# *values = oval_variable_model_get_valuescxx . . $ oval_variable_model_get_values(7835a8c12cf6c717).(old_model, varid);
134 const char *comm = oval_variable_model_get_commentcxx . . $ oval_variable_model_get_comment(35c5e26165e51c63).(old_model, varid);
135 while (oval_value_iterator_has_morecxx . . $ oval_value_iterator_has_more(753adc45e63e3dec).(values)) {
136 struct oval_valuecxx . . $ oval_value# *ov;
137 char *text;
138
139 ov = oval_value_iterator_nextcxx . . $ oval_value_iterator_next(c6f435863c40c2c6).(values);
140 text = oval_value_get_textcxx . . $ oval_value_get_text(cab4e37bbd1656d5).(ov);
141 oval_variable_model_addcxx . . $ oval_variable_model_add(51a0d0e6df9ce20d).(new_model, varid, comm, datatype, text);
142 }
143 oval_value_iterator_freecxx . . $ oval_value_iterator_free(1b9ed96dce1b7286).(values);
144 } oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(old_varids);
145 return new_model;
146 }
147
148 void oval_variable_model_freecxx . . $ oval_variable_model_free(64ecb8c3b3b2877a).(struct oval_variable_modelcxx . . $ oval_variable_model# *model)
149 {
150 if (model) {
151 oval_string_map_freecxx . . $ oval_string_map_free(e4310474f4dc2f59).(model->varmapcxx . . $ oval_variable_model#varmap., (oscap_destruct_funccxx . . $ oscap_destruct_func#) _oval_variable_model_frame_freecxx . . $ _oval_variable_model_frame_free(52a3f459f9e44044).);
152 model->varmapcxx . . $ oval_variable_model#varmap. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
153 oval_generator_freecxx . . $ oval_generator_free(645b75e3a0637956).(model->generatorcxx . . $ oval_variable_model#generator.);
154 freecxx . . $ free(5d22bdacc48458e8).(model);
155 }
156 }
157
158 struct oval_generatorcxx . . $ oval_generator# *oval_variable_model_get_generatorcxx . . $ oval_variable_model_get_generator(66a7caf5fa5568d8).(struct oval_variable_modelcxx . . $ oval_variable_model# *model)
159 {
160 return model->generatorcxx . . $ oval_variable_model#generator.;
161 }
162
163 void oval_variable_model_set_generatorcxx . . $ oval_variable_model_set_generator(bbd965279d5b3394).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, struct oval_generatorcxx . . $ oval_generator# *generator)
164 {
165 oval_generator_freecxx . . $ oval_generator_free(645b75e3a0637956).(model->generatorcxx . . $ oval_variable_model#generator.);
166 model->generatorcxx . . $ oval_variable_model#generator. = generator;
167 }
168
169 void oval_variable_model_addcxx . . $ oval_variable_model_add(51a0d0e6df9ce20d).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, char *varid, const char *comm,
170 oval_datatype_tcxx . . $ oval_datatype_t# datatype, char *value)
171 {
172 struct oval_valuecxx . . $ oval_value# *ov;
173
174 struct _oval_variable_model_framecxx . . $ _oval_variable_model_frame# *frame =
175 (struct _oval_variable_model_framecxx . . $ _oval_variable_model_frame# *)oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., varid);
176 if (frame == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
177 frame = _oval_variable_model_frame_newcxx . . $ _oval_variable_model_frame_new(a27244b77af20f95).(varid, comm, datatype);
178 oval_string_map_putcxx . . $ oval_string_map_put(95b46de789826acc).(model->varmapcxx . . $ oval_variable_model#varmap., varid, frame);
179 }
180 ov = oval_value_newcxx . . $ oval_value_new(c58b1d972ef552d6).(datatype, value);
181 oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(frame->valuescxx . . $ _oval_variable_model_frame#values., ov);
182 }
183
184 #define NAMESPACE_VARIABLEScxx . . $ `src/OVAL/oval_varModel.c:184:9`! "http://oval.mitre.org/XMLSchema/oval-variables-5"
185
186 static int _oval_variable_model_parse_variable_valuescxx . . $ _oval_variable_model_parse_variable_values(dce8d0051dd75cea).
187 (xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# * frame) {
188 char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader);
189 char *namespace = (char *)xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader);
190 int return_code;
191 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_variable_ns = oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(NAMESPACE_VARIABLEScxx . . $ `src/OVAL/oval_varModel.c:184:9`!, namespace) == 0;
192 if (is_variable_ns && oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).("value", tagname) == 0) {
193 struct oval_valuecxx . . $ oval_value# *ov;
194
195 return_code = xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader);
196 char *value = (char *)xmlTextReaderValuecxx . . $ xmlTextReaderValue(3322afb275581432).(reader);
197 ov = oval_value_newcxx . . $ oval_value_new(c58b1d972ef552d6).(frame->datatypecxx . . $ _oval_variable_model_frame#datatype., value);
198 oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(frame->valuescxx . . $ _oval_variable_model_frame#values., ov);
199 freecxx . . $ free(5d22bdacc48458e8).(value);
200 } else {
201 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unprocessed tag: <%s:%s>.", namespace, tagname);
202 oval_parser_skip_tagcxx . . $ oval_parser_skip_tag(b61d4daae99e998a).(reader, context);
203 return_code = 0;
204 }
205 freecxx . . $ free(5d22bdacc48458e8).(tagname);
206 freecxx . . $ free(5d22bdacc48458e8).(namespace);
207 return return_code;
208 }
209
210 static int _oval_variable_model_parse_variablecxx . . $ _oval_variable_model_parse_variable(6e3b6ec89b15c13d).
211 (xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, struct oval_variable_modelcxx . . $ oval_variable_model# *model) {
212 char *id = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id");
213 char *comm = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment");
214 oval_datatype_tcxx . . $ oval_datatype_t# datatype = oval_datatype_parsecxx . . $ oval_datatype_parse(439a79c16bdf367b).(reader, "datatype", OVAL_DATATYPE_STRINGcxx . . $ OVAL_DATATYPE_STRING.);
215 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame = oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., id);
216 int return_code = 1;
217 if (frame) {
218 if (frame->datatypecxx . . $ _oval_variable_model_frame#datatype. != datatype) {
219 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unmatched variable datatypes: %s:%s.",
220 oval_datatype_get_text(frame->datatype), oval_datatype_get_text(datatype));
221 oval_parser_skip_tagcxx . . $ oval_parser_skip_tag(b61d4daae99e998a).(reader, context);
222 return_code = 0;
223 }
224 frame = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
225 } else {
226 frame = _oval_variable_model_frame_newcxx . . $ _oval_variable_model_frame_new(a27244b77af20f95).(id, comm, datatype);
227 oval_string_map_putcxx . . $ oval_string_map_put(95b46de789826acc).(model->varmapcxx . . $ oval_variable_model#varmap., id, frame);
228 }
229 return_code =
230 oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, (oval_xml_tag_parsercxx . . $ oval_xml_tag_parser#) _oval_variable_model_parse_variable_valuescxx . . $ _oval_variable_model_parse_variable_values(dce8d0051dd75cea)., frame);
231 freecxx . . $ free(5d22bdacc48458e8).(id);
232 freecxx . . $ free(5d22bdacc48458e8).(comm);
233 return return_code;
234 }
235
236 static int _oval_variable_model_parse_variablescxx . . $ _oval_variable_model_parse_variables(6e3b6ec89b15c13d).
237 (xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, struct oval_variable_modelcxx . . $ oval_variable_model# *model) {
238 char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader);
239 char *namespace = (char *)xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader);
240 int return_code;
241 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_variable_ns = oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(NAMESPACE_VARIABLEScxx . . $ `src/OVAL/oval_varModel.c:184:9`!, namespace) == 0;
242 if (is_variable_ns && oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).("variable", tagname) == 0) {
243 return_code = _oval_variable_model_parse_variablecxx . . $ _oval_variable_model_parse_variable(6e3b6ec89b15c13d).(reader, context, model);
244 } else {
245 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unprocessed tag: <%s:%s>.", namespace, tagname);
246 oval_parser_skip_tagcxx . . $ oval_parser_skip_tag(b61d4daae99e998a).(reader, context);
247
248 /*oscap_seterr */
249 return_code = 0;
250 }
251 freecxx . . $ free(5d22bdacc48458e8).(tagname);
252 freecxx . . $ free(5d22bdacc48458e8).(namespace);
253 return return_code;
254 }
255
256 static int _oval_variable_model_parse_tagcxx . . $ _oval_variable_model_parse_tag(6e3b6ec89b15c13d).
257 (xmlTextReadercxx . . $ xmlTextReader# * reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, struct oval_variable_modelcxx . . $ oval_variable_model# *model) {
258 char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader);
259 char *namespace = (char *)xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader);
260 int return_code;
261 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_variable_ns = oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(NAMESPACE_VARIABLEScxx . . $ `src/OVAL/oval_varModel.c:184:9`!, namespace) == 0;
262 if (is_variable_ns && oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).("generator", tagname) == 0) {
263 struct oval_generatorcxx . . $ oval_generator# *gen;
264
265 gen = oval_variable_model_get_generatorcxx . . $ oval_variable_model_get_generator(66a7caf5fa5568d8).(context->variable_modelcxx . . $ oval_parser_context#variable_model.);
266 return_code = oval_generator_parse_tagcxx . . $ oval_generator_parse_tag(cf369959597901d1).(reader, context, gen);
267 } else if (is_variable_ns && oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).("variables", tagname) == 0) {
268 return_code =
269 oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, (oval_xml_tag_parsercxx . . $ oval_xml_tag_parser#) _oval_variable_model_parse_variablescxx . . $ _oval_variable_model_parse_variables(6e3b6ec89b15c13d)., model);
270 } else {
271 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unprocessed tag: <%s:%s>.", namespace, tagname);
272 oval_parser_skip_tagcxx . . $ oval_parser_skip_tag(b61d4daae99e998a).(reader, context);
273 return_code = 0;
274 }
275 freecxx . . $ free(5d22bdacc48458e8).(tagname);
276 freecxx . . $ free(5d22bdacc48458e8).(namespace);
277 return return_code;
278 }
279
280 static int _oval_variable_model_parsecxx . . $ _oval_variable_model_parse(85381c989cfb3d88).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, xmlTextReadercxx . . $ xmlTextReader# * reader, void *user_param)
281 {
282 int return_code = 0;
283 struct oval_parser_contextcxx . . $ oval_parser_context# context;
284 context.variable_modelcxx . . $ oval_parser_context#variable_model. = model;
285 context.readercxx . . $ oval_parser_context#reader. = reader;
286 context.user_datacxx . . $ oval_parser_context#user_data. = user_param;
287 char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader);
288 char *namespace = (char *)xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader);
289 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! is_variables = (oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(NAMESPACE_VARIABLEScxx . . $ `src/OVAL/oval_varModel.c:184:9`!, namespace) == 0) && (oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(OVAL_ROOT_ELM_VARIABLEScxx . . $ `src/OVAL/oval_parser_impl.h:42:9`!, tagname) == 0);
290 if (is_variables) {
291 return_code =
292 oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, &context, (oval_xml_tag_parsercxx . . $ oval_xml_tag_parser#) _oval_variable_model_parse_tagcxx . . $ _oval_variable_model_parse_tag(6e3b6ec89b15c13d)., model);
293 } else {
294 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unprocessed tag: <%s:%s>.", namespace, tagname);
295 return_code = oval_parser_skip_tagcxx . . $ oval_parser_skip_tag(b61d4daae99e998a).(reader, &context);
296 }
297 freecxx . . $ free(5d22bdacc48458e8).(tagname);
298 freecxx . . $ free(5d22bdacc48458e8).(namespace);
299 return return_code;
300 }
301
302 struct oval_variable_modelcxx . . $ oval_variable_model# *oval_variable_model_import_sourcecxx . . $ oval_variable_model_import_source(46e0a903906bd39).(struct oscap_sourcecxx . . $ oscap_source# *source)
303 {
304 int ret;
305 xmlTextReadercxx . . $ xmlTextReader# *reader = oscap_source_get_xmlTextReadercxx . . $ oscap_source_get_xmlTextReader(9a7ef22a0934f79d).(source);
306 if (reader == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
307 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
308 }
309
310 xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader);
311 struct oval_variable_modelcxx . . $ oval_variable_model# *model = oval_variable_model_newcxx . . $ oval_variable_model_new(76160d4386b12e53).();
312 ret = _oval_variable_model_parsecxx . . $ _oval_variable_model_parse(85381c989cfb3d88).(model, reader, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
313 if (ret != 1) {
314 oval_variable_model_freecxx . . $ oval_variable_model_free(64ecb8c3b3b2877a).(model);
315 model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
316 }
317 xmlFreeTextReadercxx . . $ xmlFreeTextReader(724dbfdba9ec3ce8).(reader);
318 return model;
319
320 }
321
322 static xmlNodecxx . . $ xmlNode# *oval_variable_model_to_domcxx . . $ oval_variable_model_to_dom(3d216f2bdec7d590).(struct oval_variable_modelcxx . . $ oval_variable_model# * variable_model,
323 xmlDocPtrcxx . . $ xmlDocPtr# doc, xmlNodecxx . . $ xmlNode# * parent, void *user_arg)
324 {
325
326 xmlNodePtrcxx . . $ xmlNodePtr# root_node;
327
328 if (parent) {
329 root_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! OVAL_ROOT_ELM_VARIABLEScxx . . $ `src/OVAL/oval_parser_impl.h:42:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
330 } else {
331 root_node = xmlNewNodecxx . . $ xmlNewNode(cc9f3f2e425bac4).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! OVAL_ROOT_ELM_VARIABLEScxx . . $ `src/OVAL/oval_parser_impl.h:42:9`!);
332 xmlDocSetRootElementcxx . . $ xmlDocSetRootElement(ad0e42d5f79fdac5).(doc, root_node);
333 }
334
335 xmlNewNsPropcxx . . $ xmlNewNsProp(9b3cf13d34b7936f).(root_node, lookup_xsi_nscxx . . $ lookup_xsi_ns(3e517de3a327c4f9).(doc), BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "schemaLocation", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! OVAL_VAR_SCHEMA_LOCATIONcxx . . $ `src/OVAL/oval_agent_api_impl.h:82:9`!);
336
337 xmlNscxx . . $ xmlNs# *ns_common = xmlNewNscxx . . $ xmlNewNs(f962c8aae91c9a10).(root_node, OVAL_COMMON_NAMESPACEcxx . . $ `src/OVAL/oval_agent_api_impl.h:40:9`!, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "oval");
338 xmlNscxx . . $ xmlNs# *ns_variables = xmlNewNscxx . . $ xmlNewNs(f962c8aae91c9a10).(root_node, OVAL_VARIABLES_NAMESPACEcxx . . $ `src/OVAL/oval_agent_api_impl.h:58:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
339
340 xmlSetNscxx . . $ xmlSetNs(cd680be8abdf9ad3).(root_node, ns_common);
341 xmlSetNscxx . . $ xmlSetNs(cd680be8abdf9ad3).(root_node, ns_variables);
342
343 oval_generator_to_domcxx . . $ oval_generator_to_dom(56faf3182cb06d7f).(variable_model->generatorcxx . . $ oval_variable_model#generator., doc, root_node);
344
345 xmlNodecxx . . $ xmlNode# *variables = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(root_node, ns_variables, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "variables", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
346
347
348 struct oval_string_iteratorcxx . . $ oval_string_iterator# *varids = oval_variable_model_get_variable_idscxx . . $ oval_variable_model_get_variable_ids(7ca1cb012924580c).(variable_model);
349 while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(varids)) {
350 char *varid = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(varids);
351 oval_datatype_tcxx . . $ oval_datatype_t# datatype = oval_variable_model_get_datatypecxx . . $ oval_variable_model_get_datatype(a3bce65bce035fc2).(variable_model, varid);
352 const char *comm = oval_variable_model_get_commentcxx . . $ oval_variable_model_get_comment(35c5e26165e51c63).(variable_model, varid);
353
354 xmlNodecxx . . $ xmlNode# *variable = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(variables, ns_variables, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "variable", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
355 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(variable, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! varid);
356 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(variable, 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));
357 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(variable, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! comm);
358
359 struct oval_value_iteratorcxx . . $ oval_value_iterator# *value_itr = oval_variable_model_get_valuescxx . . $ oval_variable_model_get_values(7835a8c12cf6c717).(variable_model, varid);
360 while (oval_value_iterator_has_morecxx . . $ oval_value_iterator_has_more(753adc45e63e3dec).(value_itr)) {
361 struct oval_valuecxx . . $ oval_value# *value;
362 char *text;
363
364 value = oval_value_iterator_nextcxx . . $ oval_value_iterator_next(c6f435863c40c2c6).(value_itr);
365 text = oval_value_get_textcxx . . $ oval_value_get_text(cab4e37bbd1656d5).(value);
366 xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(variable, ns_variables, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "value", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! text);
367 }
368 oval_value_iterator_freecxx . . $ oval_value_iterator_free(1b9ed96dce1b7286).(value_itr);
369 }
370 oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(varids);
371
372 return root_node;
373 }
374
375 int oval_variable_model_exportcxx . . $ oval_variable_model_export(85539664f1111985).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, const char *file)
376 {
377
378 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
379
380 LIBXML_TEST_VERSIONcxx . . $ `<external>/12558958530574576205/xmlversion.h:40:9`!;
381
382 xmlDocPtrcxx . . $ xmlDocPtr# doc = xmlNewDoccxx . . $ xmlNewDoc(6ad5ddcc52642397).(BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "1.0");
383 if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
384 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
385 return -1;
386 }
387
388 oval_variable_model_to_domcxx . . $ oval_variable_model_to_dom(3d216f2bdec7d590).(model, doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
389 return oscap_xml_save_filename_freecxx . . $ oscap_xml_save_filename_free(4641885591a9fcee).(file, doc);
390 }
391
392 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_variable_model_has_variablecxx . . $ oval_variable_model_has_variable(9e6e5f54a4942b54).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, const char * id)
393 {
394 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
395 struct oval_string_iteratorcxx . . $ oval_string_iterator# * str_it = (struct oval_string_iteratorcxx . . $ oval_string_iterator# *)oval_string_map_keyscxx . . $ oval_string_map_keys(52dd2feb99c28df0).(model->varmapcxx . . $ oval_variable_model#varmap.);
396 while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(str_it)) {
397 if (!oscap_strcmpcxx . . $ oscap_strcmp(5ae29d726ae57f88).(oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(str_it), id)) {
398 oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(str_it);
399 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
400 }
401 }
402 oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(str_it);
403 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
404 }
405
406 struct oval_string_iteratorcxx . . $ oval_string_iterator# *oval_variable_model_get_variable_idscxx . . $ oval_variable_model_get_variable_ids(7ca1cb012924580c).(struct oval_variable_modelcxx . . $ oval_variable_model# *model)
407 {
408 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
409 return (struct oval_string_iteratorcxx . . $ oval_string_iterator# *)oval_string_map_keyscxx . . $ oval_string_map_keys(52dd2feb99c28df0).(model->varmapcxx . . $ oval_variable_model#varmap.);
410 }
411 oval_datatype_tcxx . . $ oval_datatype_t# oval_variable_model_get_datatypecxx . . $ oval_variable_model_get_datatype(a3bce65bce035fc2).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, char *varid)
412 {
413
414 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
415 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame = oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., varid);
416 return (frame) ? frame->datatypecxx . . $ _oval_variable_model_frame#datatype. : OVAL_DATATYPE_UNKNOWNcxx . . $ OVAL_DATATYPE_UNKNOWN.;
417 }
418
419 const char *oval_variable_model_get_commentcxx . . $ oval_variable_model_get_comment(35c5e26165e51c63).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, char *varid)
420 {
421 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
422 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame = oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., varid);
423 return (frame) ? frame->commentcxx . . $ _oval_variable_model_frame#comment. : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
424 }
425
426 struct oval_value_iteratorcxx . . $ oval_value_iterator# *oval_variable_model_get_valuescxx . . $ oval_variable_model_get_values(7835a8c12cf6c717).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, char *varid)
427 {
428 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
429 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame = oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., varid);
430 return (frame) ? (struct oval_value_iteratorcxx . . $ oval_value_iterator# *) oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(frame->valuescxx . . $ _oval_variable_model_frame#values.) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
431 }
432
433 struct oval_collectioncxx . . $ oval_collection# *oval_variable_model_get_values_refcxx . . $ oval_variable_model_get_values_ref(bb110993029e878c).(struct oval_variable_modelcxx . . $ oval_variable_model# *model, char *varid)
434 {
435 _oval_variable_model_frame_tcxx . . $ _oval_variable_model_frame_t# *frame;
436
437 frame = oval_string_map_get_valuecxx . . $ oval_string_map_get_value(c9e9819de236f3d5).(model->varmapcxx . . $ oval_variable_model#varmap., varid);
438 return (frame) ? frame->valuescxx . . $ _oval_variable_model_frame#values. : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
439 }