Debian Codegraph @

src/OVAL/oval_object.c

raw symbols SCIP
1 /**
2 * @file oval_object.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 <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/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
42 #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/
43 #include "public/oval_schema_version.h"cxx . . $ `<file>/src/OVAL/public/oval_schema_version.h`/
44
45 typedef struct oval_objectcxx . . $ oval_object# {
46 struct oval_definition_modelcxx . . $ oval_definition_model# *modelcxx . . $ oval_object#model.;
47 oval_subtype_tcxx . . $ oval_subtype_t# subtypecxx . . $ oval_object#subtype.;
48 struct oval_objectcxx . . $ oval_object# *base_obj_refcxx . . $ oval_object#base_obj_ref.;
49 struct oval_collectioncxx . . $ oval_collection# *notescxx . . $ oval_object#notes.;
50 char *commentcxx . . $ oval_object#comment.;
51 char *idcxx . . $ oval_object#id.;
52 int deprecatedcxx . . $ oval_object#deprecated.;
53 int versioncxx . . $ oval_object#version.;
54 struct oval_collectioncxx . . $ oval_collection# *object_contentcxx . . $ oval_object#object_content.;
55 struct oval_collectioncxx . . $ oval_collection# *behaviorscxx . . $ oval_object#behaviors.;
56 } oval_object_tcxx . . $ oval_object_t#;
57
58 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_object_iterator_has_morecxx . . $ oval_object_iterator_has_more(9147d04dca65c7).(struct oval_object_iteratorcxx . . $ oval_object_iterator# *oc_object)
59 {
60 return oval_collection_iterator_has_morecxx . . $ oval_collection_iterator_has_more(de0650ab9b639739).((struct oval_iteratorcxx . . $ oval_iterator# *)
61 oc_object);
62 }
63
64 struct oval_objectcxx . . $ oval_object# *oval_object_iterator_nextcxx . . $ oval_object_iterator_next(85e8e8a3fd76bfb).(struct oval_object_iteratorcxx . . $ oval_object_iterator#
65 *oc_object)
66 {
67 return (struct oval_objectcxx . . $ oval_object# *)
68 oval_collection_iterator_nextcxx . . $ oval_collection_iterator_next(344074693c9690a9).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_object);
69 }
70
71 void oval_object_iterator_freecxx . . $ oval_object_iterator_free(bcb47d61bf2b3914).(struct oval_object_iteratorcxx . . $ oval_object_iterator#
72 *oc_object)
73 {
74 oval_collection_iterator_freecxx . . $ oval_collection_iterator_free(ee496816570b41f7).((struct oval_iteratorcxx . . $ oval_iterator# *)oc_object);
75 }
76
77 oval_family_tcxx . . $ oval_family_t# oval_object_get_familycxx . . $ oval_object_get_family(ca92bd70c023aab6).(struct oval_objectcxx . . $ oval_object# *object)
78 {
79 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
80
81 return ((object->subtypecxx . . $ oval_object#subtype.) / 1000) * 1000;
82 }
83
84 oval_subtype_tcxx . . $ oval_subtype_t# oval_object_get_subtypecxx . . $ oval_object_get_subtype(770582e2dbb3228b).(struct oval_objectcxx . . $ oval_object# * object)
85 {
86 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
87
88 return ((struct oval_objectcxx . . $ oval_object# *)object)->subtypecxx . . $ oval_object#subtype.;
89 }
90
91 const char *oval_object_get_namecxx . . $ oval_object_get_name(e7597f92e1394775).(struct oval_objectcxx . . $ oval_object# *object)
92 {
93
94 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
95
96 return oval_subtype_get_textcxx . . $ oval_subtype_get_text(ee6b3dcae047e21f).(object->subtypecxx . . $ oval_object#subtype.);
97 }
98
99 struct oval_string_iteratorcxx . . $ oval_string_iterator# *oval_object_get_notescxx . . $ oval_object_get_notes(19eb20f3a8ca8cf2).(struct oval_objectcxx . . $ oval_object# *object)
100 {
101 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
102
103 return (struct oval_string_iteratorcxx . . $ oval_string_iterator# *)oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(object->notescxx . . $ oval_object#notes.);
104 }
105
106 char *oval_object_get_commentcxx . . $ oval_object_get_comment(c789946d38fecc83).(struct oval_objectcxx . . $ oval_object# *object)
107 {
108 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
109
110 return ((struct oval_objectcxx . . $ oval_object# *)object)->commentcxx . . $ oval_object#comment.;
111 }
112
113 char *oval_object_get_idcxx . . $ oval_object_get_id(c789946d38fecc83).(struct oval_objectcxx . . $ oval_object# *object)
114 {
115 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
116
117 return ((struct oval_objectcxx . . $ oval_object# *)object)->idcxx . . $ oval_object#id.;
118 }
119
120 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_object_get_deprecatedcxx . . $ oval_object_get_deprecated(45aca3e82f3d6f).(struct oval_objectcxx . . $ oval_object# *object)
121 {
122 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
123
124 return ((struct oval_objectcxx . . $ oval_object# *)object)->deprecatedcxx . . $ oval_object#deprecated.;
125 }
126
127 int oval_object_get_versioncxx . . $ oval_object_get_version(bf69a7a2a8143feb).(struct oval_objectcxx . . $ oval_object# *object)
128 {
129 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
130
131 return ((struct oval_objectcxx . . $ oval_object# *)object)->versioncxx . . $ oval_object#version.;
132 }
133
134 oval_schema_version_tcxx . . $ oval_schema_version_t# oval_object_get_platform_schema_versioncxx . . $ oval_object_get_platform_schema_version(675ce9961ccdabad).(struct oval_objectcxx . . $ oval_object# *object)
135 {
136 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
137 if (object->modelcxx . . $ oval_object#model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
138 return OVAL_SCHEMA_VERSION_INVALIDcxx . . $ `src/OVAL/public/oval_schema_version.h:38:9`!;
139 }
140 oval_family_tcxx . . $ oval_family_t# family = oval_object_get_familycxx . . $ oval_object_get_family(ca92bd70c023aab6).(object);
141 const char *platform = oval_family_get_textcxx . . $ oval_family_get_text(e0888d2a111f8f85).(family);
142 return oval_definition_model_get_platform_schema_versioncxx . . $ oval_definition_model_get_platform_schema_version(4cbe2c112a234203).(object->modelcxx . . $ oval_object#model., platform);
143 }
144
145 struct oval_object_content_iteratorcxx . . $ oval_object_content_iterator# *oval_object_get_object_contentscxx . . $ oval_object_get_object_contents(1183628165c9500f).(struct
146 oval_objectcxx . . $ oval_object#
147 *object)
148 {
149 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
150
151 return (struct oval_object_content_iteratorcxx . . $ oval_object_content_iterator# *)
152 oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(object->object_contentcxx . . $ oval_object#object_content.);
153 }
154
155 struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator# *oval_object_get_behaviorscxx . . $ oval_object_get_behaviors(8abf45ce13e878b7).(struct oval_objectcxx . . $ oval_object# *object)
156 {
157 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
158
159 return (struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator# *)
160 oval_collection_iteratorcxx . . $ oval_collection_iterator(8bdeb6a25e21af3e).(object->behaviorscxx . . $ oval_object#behaviors.);
161 }
162
163 struct oval_objectcxx . . $ oval_object# *oval_object_newcxx . . $ oval_object_new(2c583c84850ee973).(struct oval_definition_modelcxx . . $ oval_definition_model# *model, const char *id)
164 {
165 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(model);
166 oval_object_tcxx . . $ oval_object_t# *object;
167
168 object = (oval_object_tcxx . . $ oval_object_t# *) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(oval_object_tcxx . . $ oval_object_t#));
169 if (object == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
170 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
171
172 object->commentcxx . . $ oval_object#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
173 object->idcxx . . $ oval_object#id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(id);
174 object->subtypecxx . . $ oval_object#subtype. = OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.;
175 object->base_obj_refcxx . . $ oval_object#base_obj_ref. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
176 object->deprecatedcxx . . $ oval_object#deprecated. = 0;
177 object->versioncxx . . $ oval_object#version. = 0;
178 object->behaviorscxx . . $ oval_object#behaviors. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).();
179 object->notescxx . . $ oval_object#notes. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).();
180 object->object_contentcxx . . $ oval_object#object_content. = oval_collection_newcxx . . $ oval_collection_new(18476da3f812812d).();
181 object->modelcxx . . $ oval_object#model. = model;
182
183 oval_definition_model_add_objectcxx . . $ oval_definition_model_add_object(3e834f4e76cae4a4).(model, object);
184
185 return object;
186 }
187
188 struct oval_objectcxx . . $ oval_object# *oval_object_clone2cxx . . $ oval_object_clone2(70289d537d5bc930).(struct oval_definition_modelcxx . . $ oval_definition_model# *new_model, struct oval_objectcxx . . $ oval_object# *old_object, char *new_id)
189 {
190 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(old_object);
191
192 struct oval_objectcxx . . $ oval_object# *new_object;
193
194 if (new_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
195 new_id = old_object->idcxx . . $ oval_object#id.;
196
197 new_object = oval_definition_model_get_objectcxx . . $ oval_definition_model_get_object(2c583c84850ee973).(new_model, new_id);
198 if (new_object == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
199 new_object = oval_object_newcxx . . $ oval_object_new(2c583c84850ee973).(new_model, new_id);
200 oval_object_set_commentcxx . . $ oval_object_set_comment(8b8abd2903695873).(new_object, old_object->commentcxx . . $ oval_object#comment.);
201 oval_object_set_subtypecxx . . $ oval_object_set_subtype(a6faa0a9511e37be).(new_object, old_object->subtypecxx . . $ oval_object#subtype.);
202 oval_object_set_deprecatedcxx . . $ oval_object_set_deprecated(2ce2a94ab4b816c).(new_object, old_object->deprecatedcxx . . $ oval_object#deprecated.);
203 oval_object_set_versioncxx . . $ oval_object_set_version(1f9983c5d139e83f).(new_object, old_object->versioncxx . . $ oval_object#version.);
204
205 struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator# *behaviors = oval_object_get_behaviorscxx . . $ oval_object_get_behaviors(8abf45ce13e878b7).(old_object);
206 while (oval_behavior_iterator_has_morecxx . . $ oval_behavior_iterator_has_more(3d3ff23bd26ad9ab).(behaviors)) {
207 struct oval_behaviorcxx . . $ oval_behavior# *behavior = oval_behavior_iterator_nextcxx . . $ oval_behavior_iterator_next(13cbfab487b431e4).(behaviors);
208 oval_object_add_behaviorcxx . . $ oval_object_add_behavior(2ea0afd2c9a0056b).(new_object, oval_behavior_clonecxx . . $ oval_behavior_clone(398e385dc1412c01).(new_model, behavior));
209 }
210 oval_behavior_iterator_freecxx . . $ oval_behavior_iterator_free(3c04ebb55bfb1ccb).(behaviors);
211 struct oval_string_iteratorcxx . . $ oval_string_iterator# *notes = oval_object_get_notescxx . . $ oval_object_get_notes(19eb20f3a8ca8cf2).(old_object);
212 while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) {
213 char *note = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(notes);
214 oval_object_add_notecxx . . $ oval_object_add_note(8b8abd2903695873).(new_object, note);
215 }
216 oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(notes);
217 struct oval_object_content_iteratorcxx . . $ oval_object_content_iterator# *object_contents = oval_object_get_object_contentscxx . . $ oval_object_get_object_contents(1183628165c9500f).(old_object);
218 while (oval_object_content_iterator_has_morecxx . . $ oval_object_content_iterator_has_more(94988246e4c8fa99).(object_contents)) {
219 struct oval_object_contentcxx . . $ oval_object_content# *object_content = oval_object_content_iterator_nextcxx . . $ oval_object_content_iterator_next(eb16ce6ae0e4b7fc).(object_contents);
220 oval_object_add_object_contentcxx . . $ oval_object_add_object_content(cbf7628e77ea6a92).(new_object,
221 oval_object_content_clonecxx . . $ oval_object_content_clone(24b7b396d9f105d7).(new_model, object_content));
222 }
223 oval_object_content_iterator_freecxx . . $ oval_object_content_iterator_free(de918ccd59b4e784).(object_contents);
224 }
225 return new_object;
226 }
227
228 struct oval_objectcxx . . $ oval_object# *oval_object_clonecxx . . $ oval_object_clone(cda8d9effee3e98b).(struct oval_definition_modelcxx . . $ oval_definition_model# *new_model, struct oval_objectcxx . . $ oval_object# *old_object)
229 {
230 return oval_object_clone2cxx . . $ oval_object_clone2(70289d537d5bc930).(new_model, old_object, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
231 }
232
233 void oval_object_freecxx . . $ oval_object_free(e6e762e45c770aa4).(struct oval_objectcxx . . $ oval_object# *object)
234 {
235 if (object == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
236 return;
237
238 if (object->commentcxx . . $ oval_object#comment. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
239 freecxx . . $ free(5d22bdacc48458e8).(object->commentcxx . . $ oval_object#comment.);
240 if (object->idcxx . . $ oval_object#id. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
241 freecxx . . $ free(5d22bdacc48458e8).(object->idcxx . . $ oval_object#id.);
242 oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(object->behaviorscxx . . $ oval_object#behaviors., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oval_behavior_freecxx . . $ oval_behavior_free(b764472751a50bf).);
243 oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(object->notescxx . . $ oval_object#notes., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).);
244 oval_collection_free_itemscxx . . $ oval_collection_free_items(637ec69504f927f1).(object->object_contentcxx . . $ oval_object#object_content., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oval_object_content_freecxx . . $ oval_object_content_free(86b45f77129fa34e).);
245
246 object->commentcxx . . $ oval_object#comment. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
247 object->idcxx . . $ oval_object#id. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
248 object->behaviorscxx . . $ oval_object#behaviors. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
249 object->notescxx . . $ oval_object#notes. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
250 object->object_contentcxx . . $ oval_object#object_content. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
251 freecxx . . $ free(5d22bdacc48458e8).(object);
252 }
253
254 void oval_object_set_subtypecxx . . $ oval_object_set_subtype(a6faa0a9511e37be).(struct oval_objectcxx . . $ oval_object# *object, oval_subtype_tcxx . . $ oval_subtype_t# subtype)
255 {
256 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
257 object->subtypecxx . . $ oval_object#subtype. = subtype;
258 }
259
260 void oval_object_add_notecxx . . $ oval_object_add_note(8b8abd2903695873).(struct oval_objectcxx . . $ oval_object# *object, char *note)
261 {
262 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
263 oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(object->notescxx . . $ oval_object#notes., (void *)oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(note));
264 }
265
266 void oval_object_set_commentcxx . . $ oval_object_set_comment(8b8abd2903695873).(struct oval_objectcxx . . $ oval_object# *object, char *comm)
267 {
268 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
269 if (object->commentcxx . . $ oval_object#comment. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
270 freecxx . . $ free(5d22bdacc48458e8).(object->commentcxx . . $ oval_object#comment.);
271 object->commentcxx . . $ oval_object#comment. = (comm == 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`! : oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(comm);
272 }
273
274 void oval_object_set_deprecatedcxx . . $ oval_object_set_deprecated(2ce2a94ab4b816c).(struct oval_objectcxx . . $ oval_object# *object, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! deprecated)
275 {
276 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
277 object->deprecatedcxx . . $ oval_object#deprecated. = deprecated;
278 }
279
280 void oval_object_set_versioncxx . . $ oval_object_set_version(1f9983c5d139e83f).(struct oval_objectcxx . . $ oval_object# *object, int version)
281 {
282 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
283 object->versioncxx . . $ oval_object#version. = version;
284 }
285
286 void oval_object_add_object_contentcxx . . $ oval_object_add_object_content(cbf7628e77ea6a92).(struct oval_objectcxx . . $ oval_object# *object, struct oval_object_contentcxx . . $ oval_object_content# *content)
287 {
288 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
289 oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(object->object_contentcxx . . $ oval_object#object_content., (void *)content);
290 }
291
292 void oval_object_add_behaviorcxx . . $ oval_object_add_behavior(2ea0afd2c9a0056b).(struct oval_objectcxx . . $ oval_object# *object, struct oval_behaviorcxx . . $ oval_behavior# *behavior)
293 {
294 __attribute__nonnull__cxx . . $ `src/common/util.h:39:9`!(object);
295 oval_collection_addcxx . . $ oval_collection_add(3c6bf54730c0284).(object->behaviorscxx . . $ oval_object#behaviors., (void *)behavior);
296 }
297
298 static void oval_note_consumecxx . . $ oval_note_consume(75961c4613ebf8f5).(char *text, void *object)
299 {
300 oval_object_add_notecxx . . $ oval_object_add_note(8b8abd2903695873).(object, text);
301 }
302
303 static int _oval_object_parse_notescxx . . $ _oval_object_parse_notes(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *user)
304 {
305 struct oval_objectcxx . . $ oval_object# *object = (struct oval_objectcxx . . $ oval_object# *)user;
306 return oscap_parser_text_valuecxx . . $ oscap_parser_text_value(23cd2d9646b6359b).(reader, &oval_note_consumecxx . . $ oval_note_consume(75961c4613ebf8f5)., object);
307 }
308
309 static void oval_behavior_consumecxx . . $ oval_behavior_consume(2d080d407d86e21e).(struct oval_behaviorcxx . . $ oval_behavior# *behavior, void *object)
310 {
311 oval_object_add_behaviorcxx . . $ oval_object_add_behavior(2ea0afd2c9a0056b).(object, behavior);
312 }
313
314 static void oval_content_consumecxx . . $ oval_content_consume(7953b2a4230942c8).(struct oval_object_contentcxx . . $ oval_object_content# *content, void *object)
315 {
316 oval_object_add_object_contentcxx . . $ oval_object_add_object_content(cbf7628e77ea6a92).(object, content);
317 }
318
319 static int _oval_object_parse_tagcxx . . $ _oval_object_parse_tag(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *user)
320 {
321 struct oval_objectcxx . . $ oval_object# *object = (struct oval_objectcxx . . $ oval_object# *)user;
322 char *tagname = (char *)xmlTextReaderLocalNamecxx . . $ xmlTextReaderLocalName(3322afb275581432).(reader);
323 xmlCharcxx . . $ xmlChar# *namespace = xmlTextReaderNamespaceUricxx . . $ xmlTextReaderNamespaceUri(3322afb275581432).(reader);
324 int return_code = 0;
325 if ((strcmpcxx . . $ strcmp(5ae29d726ae57f88).(tagname, "notes") == 0)) {
326 return_code = oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, &_oval_object_parse_notescxx . . $ _oval_object_parse_notes(cf369959597901d1)., object);
327 } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(tagname, "behaviors") == 0) {
328 return_code = oval_behavior_parse_tagcxx . . $ oval_behavior_parse_tag(e6943d31661351b4).(reader, context, oval_object_get_familycxx . . $ oval_object_get_family(ca92bd70c023aab6).(object), &oval_behavior_consumecxx . . $ oval_behavior_consume(2d080d407d86e21e)., object);
329 } else {
330 return_code = oval_object_content_parse_tagcxx . . $ oval_object_content_parse_tag(2eddbe5882d33f3f).(reader, context, &oval_content_consumecxx . . $ oval_content_consume(7953b2a4230942c8)., object);
331 }
332
333 if (return_code != 0) {
334 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Parsing of <%s> terminated by an error at line %d.", tagname, xmlTextReaderGetParserLineNumber(reader));
335 }
336
337 freecxx . . $ free(5d22bdacc48458e8).(tagname);
338 freecxx . . $ free(5d22bdacc48458e8).(namespace);
339 return return_code;
340 }
341
342 /* -1 = error; 0 = OK; 1 = warning */
343 int oval_object_parse_tagcxx . . $ oval_object_parse_tag(cf369959597901d1).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader, struct oval_parser_contextcxx . . $ oval_parser_context# *context, void *usr)
344 {
345 int ret;
346 char *comm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
347 char *version = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
348 struct oval_definition_modelcxx . . $ oval_definition_model# *model = context->definition_modelcxx . . $ oval_parser_context#definition_model.;
349
350 char *id = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id");
351 struct oval_objectcxx . . $ oval_object# *object = oval_definition_model_get_new_objectcxx . . $ oval_definition_model_get_new_object(2c583c84850ee973).(model, id);
352
353 oval_subtype_tcxx . . $ oval_subtype_t# subtype = oval_subtype_parsecxx . . $ oval_subtype_parse(f7bb0059f83e9a03).(reader);
354 if ( subtype == OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.) {
355 dIcxx . . $ `src/common/debug_priv.h:61:9`!("Unknown object %s, using independent/unknown", id);
356 subtype = OVAL_INDEPENDENT_UNKNOWNcxx . . $ OVAL_INDEPENDENT_UNKNOWN.;
357 }
358 oval_object_set_subtypecxx . . $ oval_object_set_subtype(a6faa0a9511e37be).(object, subtype);
359
360 comm = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment");
361 if (comm != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
362 oval_object_set_commentcxx . . $ oval_object_set_comment(8b8abd2903695873).(object, comm);
363 }
364
365 int deprecated = oval_parser_boolean_attributecxx . . $ oval_parser_boolean_attribute(a53adaee35698733).(reader, "deprecated", 0);
366 oval_object_set_deprecatedcxx . . $ oval_object_set_deprecated(2ce2a94ab4b816c).(object, deprecated);
367
368 version = (char *)xmlTextReaderGetAttributecxx . . $ xmlTextReaderGetAttribute(6d056300a6ef2116).(reader, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version");
369 oval_object_set_versioncxx . . $ oval_object_set_version(1f9983c5d139e83f).(object, atoicxx . . $ atoi(5c4306d8553b3696).(version));
370
371 ret = oval_parser_parse_tagcxx . . $ oval_parser_parse_tag(4eaaf867ce26f59b).(reader, context, &_oval_object_parse_tagcxx . . $ _oval_object_parse_tag(cf369959597901d1)., object);
372
373 freecxx . . $ free(5d22bdacc48458e8).(id);
374 freecxx . . $ free(5d22bdacc48458e8).(comm);
375 freecxx . . $ free(5d22bdacc48458e8).(version);
376 return ret;
377 }
378
379 xmlNodecxx . . $ xmlNode# *oval_object_to_domcxx . . $ oval_object_to_dom(cbbfd686a0ef3907).(struct oval_objectcxx . . $ oval_object# *object, xmlDoccxx . . $ xmlDoc# * doc, xmlNodecxx . . $ xmlNode# * parent)
380 {
381 xmlNodecxx . . $ xmlNode# *object_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
382
383 /* skip unknown object */
384 oval_subtype_tcxx . . $ oval_subtype_t# subtype = oval_object_get_subtypecxx . . $ oval_object_get_subtype(770582e2dbb3228b).(object);
385 if (subtype == OVAL_SUBTYPE_UNKNOWNcxx . . $ OVAL_SUBTYPE_UNKNOWN.) {
386 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unable to convert unknown object %s, skipping", oval_object_get_id(object));
387 return object_node;
388 }
389
390 /* get object name */
391 const char *subtype_text = oval_subtype_get_textcxx . . $ oval_subtype_get_text(ee6b3dcae047e21f).(subtype);
392 char *object_name = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(strlencxx . . $ strlen(751346f8406fd082).(subtype_text) + 8);
393 sprintfcxx . . $ sprintf(26c8642d26409d6d).(object_name, "%s_object", subtype_text);
394
395 oval_family_tcxx . . $ oval_family_t# family = oval_object_get_familycxx . . $ oval_object_get_family(ca92bd70c023aab6).(object);
396
397 /* search namespace & create child */
398 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);
399 object_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, ns_family, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! object_name, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
400 freecxx . . $ free(5d22bdacc48458e8).(object_name);
401
402 char *id = oval_object_get_idcxx . . $ oval_object_get_id(c789946d38fecc83).(object);
403 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(object_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! id);
404
405 char version[10];
406 *version = '\0';
407 snprintfcxx . . $ snprintf(ea502d73e74c754c).(version, sizeof(version), "%d", oval_object_get_versioncxx . . $ oval_object_get_version(bf69a7a2a8143feb).(object));
408 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(object_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! version);
409
410 char *comm = oval_object_get_commentcxx . . $ oval_object_get_comment(c789946d38fecc83).(object);
411 if (comm)
412 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(object_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "comment", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! comm);
413
414 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! deprecated = oval_object_get_deprecatedcxx . . $ oval_object_get_deprecated(45aca3e82f3d6f).(object);
415 if (deprecated)
416 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(object_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "deprecated", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true");
417
418 struct oval_string_iteratorcxx . . $ oval_string_iterator# *notes = oval_object_get_notescxx . . $ oval_object_get_notes(19eb20f3a8ca8cf2).(object);
419 if (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) {
420 xmlNscxx . . $ xmlNs# *ns_definitions = xmlSearchNsByHrefcxx . . $ xmlSearchNsByHref(d0fb0b6b99319c4).(doc, parent, OVAL_DEFINITIONS_NAMESPACEcxx . . $ `src/OVAL/oval_agent_api_impl.h:50:9`!);
421 xmlNodecxx . . $ xmlNode# *notes_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(object_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`!);
422 while (oval_string_iterator_has_morecxx . . $ oval_string_iterator_has_more(41a15bd829ecb6dd).(notes)) {
423 char *note = oval_string_iterator_nextcxx . . $ oval_string_iterator_next(fc393b19611653f6).(notes);
424 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);
425 }
426 }
427 oval_string_iterator_freecxx . . $ oval_string_iterator_free(eccafcd0705f3c29).(notes);
428
429 struct oval_behavior_iteratorcxx . . $ oval_behavior_iterator# *behaviors = oval_object_get_behaviorscxx . . $ oval_object_get_behaviors(8abf45ce13e878b7).(object);
430 if (oval_behavior_iterator_has_morecxx . . $ oval_behavior_iterator_has_more(3d3ff23bd26ad9ab).(behaviors)) {
431 xmlNodecxx . . $ xmlNode# *behaviors_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(object_node, ns_family, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "behaviors", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
432 while (oval_behavior_iterator_has_morecxx . . $ oval_behavior_iterator_has_more(3d3ff23bd26ad9ab).(behaviors)) {
433 struct oval_behaviorcxx . . $ oval_behavior# *behavior = oval_behavior_iterator_nextcxx . . $ oval_behavior_iterator_next(13cbfab487b431e4).(behaviors);
434 char *key = oval_behavior_get_keycxx . . $ oval_behavior_get_key(11d4889a96551e31).(behavior);
435 char *value = oval_behavior_get_valuecxx . . $ oval_behavior_get_value(11d4889a96551e31).(behavior);
436 xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(behaviors_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! key, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! value);
437 }
438 }
439 oval_behavior_iterator_freecxx . . $ oval_behavior_iterator_free(3c04ebb55bfb1ccb).(behaviors);
440
441 struct oval_object_content_iteratorcxx . . $ oval_object_content_iterator# *contents = oval_object_get_object_contentscxx . . $ oval_object_get_object_contents(1183628165c9500f).(object);
442 while (oval_object_content_iterator_has_morecxx . . $ oval_object_content_iterator_has_more(94988246e4c8fa99).(contents)) {
443 struct oval_object_contentcxx . . $ oval_object_content# *content = oval_object_content_iterator_nextcxx . . $ oval_object_content_iterator_next(eb16ce6ae0e4b7fc).(contents);
444 oval_object_content_to_domcxx . . $ oval_object_content_to_dom(9f5e58e14a2b26c7).(content, doc, object_node);
445 }
446 oval_object_content_iterator_freecxx . . $ oval_object_content_iterator_free(de918ccd59b4e784).(contents);
447
448 return object_node;
449 }
450
451 struct oval_objectcxx . . $ oval_object# *oval_object_create_internalcxx . . $ oval_object_create_internal(a6be56305ee59653).(struct oval_objectcxx . . $ oval_object# *obj, char *set_id)
452 {
453 struct oval_objectcxx . . $ oval_object# *new_obj;
454 size_t oid_len, sid_len;
455 char *new_obj_id;
456
457 oid_len = strlencxx . . $ strlen(751346f8406fd082).(obj->idcxx . . $ oval_object#id.);
458 set_id = strrchrcxx . . $ strrchr(2050848944e00d54).(set_id, ':') + 1;
459 sid_len = strlencxx . . $ strlen(751346f8406fd082).(set_id);
460 new_obj_id = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(oid_len + sid_len + 2);
461 memcpycxx . . $ memcpy(cc817cb175f282d).(new_obj_id, obj->idcxx . . $ oval_object#id., oid_len);
462 new_obj_id[oid_len] = 'i';
463 memcpycxx . . $ memcpy(cc817cb175f282d).(new_obj_id + oid_len + 1, set_id, sid_len);
464 new_obj_id[oid_len + sid_len + 1] = '\0';
465 new_obj = oval_object_clone2cxx . . $ oval_object_clone2(70289d537d5bc930).(obj->modelcxx . . $ oval_object#model., obj, new_obj_id);
466 new_obj->base_obj_refcxx . . $ oval_object#base_obj_ref. = obj;
467 freecxx . . $ free(5d22bdacc48458e8).(new_obj_id);
468
469 return new_obj;
470 }
471
472 struct oval_objectcxx . . $ oval_object# *oval_object_get_base_objcxx . . $ oval_object_get_base_obj(59302ff585093271).(struct oval_objectcxx . . $ oval_object# *obj)
473 {
474 return obj->base_obj_refcxx . . $ oval_object#base_obj_ref.;
475 }