Debian Codegraph @

src/DS/rds_index.c

raw symbols SCIP
1 /*
2 * Copyright 2013--2014 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Martin Preisler <[email protected]>
21 */
22
23 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`!
24 #include <config.h>cxx . . $ `<file>/build/config.h`/
25 #endif
26
27 #include "public/scap_ds.h"cxx . . $ `<file>/src/DS/public/scap_ds.h`/
28 #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/
29 #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/
30 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
31 #include "common/elements.h"cxx . . $ `<file>/src/common/elements.h`/
32 #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/
33 #include "rds_index_priv.h"cxx . . $ `<file>/src/DS/rds_index_priv.h`/
34
35
36 #include <libxml/xmlreader.h>
37 #include <string.h>
38
39 struct rds_indexcxx . . $ rds_index#
40 {
41 struct oscap_listcxx . . $ oscap_list# *report_requestscxx . . $ rds_index#report_requests.;
42 struct oscap_listcxx . . $ oscap_list# *assetscxx . . $ rds_index#assets.;
43 struct oscap_listcxx . . $ oscap_list# *reportscxx . . $ rds_index#reports.;
44 };
45
46 struct rds_indexcxx . . $ rds_index# *rds_index_newcxx . . $ rds_index_new(4605487e90059ab1).(void)
47 {
48 struct rds_indexcxx . . $ rds_index# *ret = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct rds_indexcxx . . $ rds_index#));
49 ret->report_requestscxx . . $ rds_index#report_requests. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).();
50 ret->assetscxx . . $ rds_index#assets. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).();
51 ret->reportscxx . . $ rds_index#reports. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).();
52
53 return ret;
54 }
55
56 void rds_index_freecxx . . $ rds_index_free(5b69eefa0785d61f).(struct rds_indexcxx . . $ rds_index# *s)
57 {
58 if (s != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
59 oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(s->report_requestscxx . . $ rds_index#report_requests., (oscap_destruct_funccxx . . $ oscap_destruct_func#)rds_report_request_index_freecxx . . $ rds_report_request_index_free(9cc6ee84e09a1d94).);
60 oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(s->assetscxx . . $ rds_index#assets., (oscap_destruct_funccxx . . $ oscap_destruct_func#)rds_asset_index_freecxx . . $ rds_asset_index_free(bcd68406d6a1081b).);
61 oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(s->reportscxx . . $ rds_index#reports., (oscap_destruct_funccxx . . $ oscap_destruct_func#)rds_report_index_freecxx . . $ rds_report_index_free(fa7e9f950c1d7e71).);
62 freecxx . . $ free(5d22bdacc48458e8).(s);
63 }
64 }
65
66 static void rds_index_add_report_requestcxx . . $ rds_index_add_report_request(c983cdd79e95639b).(struct rds_indexcxx . . $ rds_index# *s, struct rds_report_request_indexcxx . . $ rds_report_request_index# *rr_index)
67 {
68 oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(s->report_requestscxx . . $ rds_index#report_requests., rr_index);
69 }
70
71 struct rds_report_request_index_iteratorcxx . . $ rds_report_request_index_iterator# *rds_index_get_report_requestscxx . . $ rds_index_get_report_requests(a07cf5abcd790046).(struct rds_indexcxx . . $ rds_index# *s)
72 {
73 return (struct rds_report_request_index_iteratorcxx . . $ rds_report_request_index_iterator#*)oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(s->report_requestscxx . . $ rds_index#report_requests.);
74 }
75
76 static void rds_index_add_assetcxx . . $ rds_index_add_asset(d791cf9d8a4b0027).(struct rds_indexcxx . . $ rds_index# *s, struct rds_asset_indexcxx . . $ rds_asset_index# *a_index)
77 {
78 oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(s->assetscxx . . $ rds_index#assets., a_index);
79 }
80
81 struct rds_asset_index_iteratorcxx . . $ rds_asset_index_iterator# *rds_index_get_assetscxx . . $ rds_index_get_assets(bc6b29bc3fb0d27e).(struct rds_indexcxx . . $ rds_index# *s)
82 {
83 return (struct rds_asset_index_iteratorcxx . . $ rds_asset_index_iterator#*)oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(s->assetscxx . . $ rds_index#assets.);
84 }
85
86 static void rds_index_add_reportcxx . . $ rds_index_add_report(7e6d136c2af44b90).(struct rds_indexcxx . . $ rds_index#* s, struct rds_report_indexcxx . . $ rds_report_index# *r_index)
87 {
88 oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(s->reportscxx . . $ rds_index#reports., r_index);
89 }
90
91 struct rds_report_index_iteratorcxx . . $ rds_report_index_iterator# *rds_index_get_reportscxx . . $ rds_index_get_reports(6ea603b5d38e4ab3).(struct rds_indexcxx . . $ rds_index#* s)
92 {
93 return (struct rds_report_index_iteratorcxx . . $ rds_report_index_iterator#*)oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(s->reportscxx . . $ rds_index#reports.);
94 }
95
96 struct rds_report_request_indexcxx . . $ rds_report_request_index#* rds_index_get_report_requestcxx . . $ rds_index_get_report_request(13dd256a919e8e07).(struct rds_indexcxx . . $ rds_index#* rds, const char* id)
97 {
98 struct rds_report_request_indexcxx . . $ rds_report_request_index#* ret = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
99
100 struct rds_report_request_index_iteratorcxx . . $ rds_report_request_index_iterator#* it = rds_index_get_report_requestscxx . . $ rds_index_get_report_requests(a07cf5abcd790046).(rds);
101 while (rds_report_request_index_iterator_has_morecxx . . $ rds_report_request_index_iterator_has_more(ba3f3242fa80f4a6).(it))
102 {
103 struct rds_report_request_indexcxx . . $ rds_report_request_index#* rr_index = rds_report_request_index_iterator_nextcxx . . $ rds_report_request_index_iterator_next(1039cc10de702769).(it);
104 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(rds_report_request_index_get_idcxx . . $ rds_report_request_index_get_id(5a818ffca7a10dcf).(rr_index), id) == 0) {
105 ret = rr_index;
106 break;
107 }
108
109 }
110 rds_report_request_index_iterator_freecxx . . $ rds_report_request_index_iterator_free(64a6e17520fe4bd0).(it);
111
112 return ret;
113 }
114
115 struct rds_asset_indexcxx . . $ rds_asset_index#* rds_index_get_assetcxx . . $ rds_index_get_asset(39d822418e4bf959).(struct rds_indexcxx . . $ rds_index# *rds, const char *id)
116 {
117 struct rds_asset_indexcxx . . $ rds_asset_index# *ret = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
118
119 if (id == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
120 return ret;
121
122 struct rds_asset_index_iteratorcxx . . $ rds_asset_index_iterator# *it = rds_index_get_assetscxx . . $ rds_index_get_assets(bc6b29bc3fb0d27e).(rds);
123 while (rds_asset_index_iterator_has_morecxx . . $ rds_asset_index_iterator_has_more(4cc1dd73741dac97).(it))
124 {
125 struct rds_asset_indexcxx . . $ rds_asset_index# *a_index = rds_asset_index_iterator_nextcxx . . $ rds_asset_index_iterator_next(73e5ef02dfc800bd).(it);
126 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(rds_asset_index_get_idcxx . . $ rds_asset_index_get_id(b3b31caa40644001).(a_index), id) == 0) {
127 ret = a_index;
128 break;
129 }
130
131 }
132 rds_asset_index_iterator_freecxx . . $ rds_asset_index_iterator_free(ef3bbd2d878f06c8).(it);
133
134 return ret;
135 }
136
137 struct rds_report_indexcxx . . $ rds_report_index# *rds_index_get_reportcxx . . $ rds_index_get_report(9764869f90072803).(struct rds_indexcxx . . $ rds_index# *rds, const char *id)
138 {
139 struct rds_report_indexcxx . . $ rds_report_index# *ret = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
140
141 struct rds_report_index_iteratorcxx . . $ rds_report_index_iterator# *it = rds_index_get_reportscxx . . $ rds_index_get_reports(6ea603b5d38e4ab3).(rds);
142 while (rds_report_index_iterator_has_morecxx . . $ rds_report_index_iterator_has_more(6c8d9b5d20d60db1).(it))
143 {
144 struct rds_report_indexcxx . . $ rds_report_index# *r_index = rds_report_index_iterator_nextcxx . . $ rds_report_index_iterator_next(3245c31063e7085e).(it);
145 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(rds_report_index_get_idcxx . . $ rds_report_index_get_id(7cda95b454727dd1).(r_index), id) == 0) {
146 ret = r_index;
147 break;
148 }
149
150 }
151 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(it);
152
153 return ret;
154 }
155
156 static xmlCharcxx . . $ xmlChar# *relationship_get_inner_refcxx . . $ relationship_get_inner_ref(919244d4646c0234).(xmlNodePtrcxx . . $ xmlNodePtr# node)
157 {
158 xmlCharcxx . . $ xmlChar# *ret = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
159 xmlNodePtrcxx . . $ xmlNodePtr# ref_node = node->childrencxx . . $ _xmlNode#children.;
160
161 for (; ref_node != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; ref_node = ref_node->nextcxx . . $ _xmlNode#next.)
162 {
163 if (ref_node->typecxx . . $ _xmlNode#type. != XML_ELEMENT_NODEcxx . . $ XML_ELEMENT_NODE.)
164 continue;
165
166 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)(ref_node->namecxx . . $ _xmlNode#name.), "ref") != 0)
167 continue; // TODO: Warning?
168
169 if (ret) {
170 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!,
171 "Multiple <core:ref> elements found in a <core:relationship> element.\n"
172 "Only the first ref will be used!\n"
173 "Make sure the Result DataStream is valid!");
174 }
175 else
176 ret = xmlNodeGetContentcxx . . $ xmlNodeGetContent(cadd6f62b3cc3aeb).(ref_node);
177 }
178
179 return ret;
180 }
181
182 static inline void _parse_relationships_nodecxx . . $ _parse_relationships_node(84b24f1c4d287864).(struct rds_indexcxx . . $ rds_index# *ret, xmlNodePtrcxx . . $ xmlNodePtr# relationships_node)
183 {
184 if (relationships_node == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) {
185 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!, "There is no <core:relationships> element in the Result DataStream.\n");
186 return;
187 }
188
189 xmlNodePtrcxx . . $ xmlNodePtr# relationship_node = relationships_node->childrencxx . . $ _xmlNode#children.;
190 for (; relationship_node != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; relationship_node = relationship_node->nextcxx . . $ _xmlNode#next.)
191 {
192 if (relationship_node->typecxx . . $ _xmlNode#type. != XML_ELEMENT_NODEcxx . . $ XML_ELEMENT_NODE.)
193 continue;
194
195 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)(relationship_node->namecxx . . $ _xmlNode#name.), "relationship") != 0)
196 continue; // TODO: Warning?
197
198 xmlCharcxx . . $ xmlChar# *type_attr = xmlGetPropcxx . . $ xmlGetProp(9828664f081b7881).(relationship_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "type");
199 xmlCharcxx . . $ xmlChar# *subject_attr = xmlGetPropcxx . . $ xmlGetProp(9828664f081b7881).(relationship_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "subject");
200 xmlCharcxx . . $ xmlChar# *inner_ref = relationship_get_inner_refcxx . . $ relationship_get_inner_ref(919244d4646c0234).(relationship_node);
201
202 // We now only use arfvocab: but arfrel: is kept here for compatibility
203 if (oscap_str_startswithcxx . . $ oscap_str_startswith(b7a7aa4a824b7595).((const char *) type_attr, "arfvocab:")
204 || oscap_str_startswithcxx . . $ oscap_str_startswith(b7a7aa4a824b7595).((const char *) type_attr, "arfrel:")) {
205 if (oscap_str_endswithcxx . . $ oscap_str_endswith(b7a7aa4a824b7595).((const char*)type_attr, ":isAbout")) {
206 struct rds_asset_indexcxx . . $ rds_asset_index#* asset = rds_index_get_assetcxx . . $ rds_index_get_asset(39d822418e4bf959).(ret, (const char*)inner_ref);
207 struct rds_report_indexcxx . . $ rds_report_index#* report = rds_index_get_reportcxx . . $ rds_index_get_report(9764869f90072803).(ret, (const char*)subject_attr);
208
209 rds_asset_index_add_report_refcxx . . $ rds_asset_index_add_report_ref(ff8e4d261059116e).(asset, report);
210 } else if (oscap_str_endswithcxx . . $ oscap_str_endswith(b7a7aa4a824b7595).((const char*)type_attr, ":createdFor")) {
211 struct rds_report_request_indexcxx . . $ rds_report_request_index# *request = rds_index_get_report_requestcxx . . $ rds_index_get_report_request(13dd256a919e8e07).(ret, (const char*)inner_ref);
212 struct rds_report_indexcxx . . $ rds_report_index# *report = rds_index_get_reportcxx . . $ rds_index_get_report(9764869f90072803).(ret, (const char*)subject_attr);
213
214 // This is based on the assumption that every report has at most 1 request
215 // it was "created for".
216 rds_report_index_set_requestcxx . . $ rds_report_index_set_request(792f784afce23e03).(report, request);
217 } else {
218 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unsupported core:relationship/@type='%s'", (const char *) type_attr);
219 }
220 } else {
221 dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unsupported core:relationship/@type='%s'", (const char *) type_attr);
222 }
223
224 xmlFreecxx . . $ xmlFree.(type_attr);
225 xmlFreecxx . . $ xmlFree.(subject_attr);
226 xmlFreecxx . . $ xmlFree.(inner_ref);
227 }
228 }
229
230 struct rds_indexcxx . . $ rds_index# *rds_index_parsecxx . . $ rds_index_parse(7efedfa68ae73ae).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader)
231 {
232 if (!oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, 0)) {
233 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!,
234 "Expected to to have start of <arf:asset-report-collection> at document root, "
235 "no elements were found! I refuse to parse!");
236
237 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
238 }
239
240 if (xmlTextReaderNodeTypecxx . . $ xmlTextReaderNodeType(82a242a19623f75).(reader) != XML_READER_TYPE_ELEMENTcxx . . $ XML_READER_TYPE_ELEMENT. ||
241 strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader), "asset-report-collection") != 0) {
242 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!,
243 "Expected to to have start of <arf:asset-report-collection> at document root, "
244 "the current event is '%i' at '%s' instead. I refuse to parse!",
245 xmlTextReaderNodeType(reader), (const char*)xmlTextReaderConstLocalName(reader));
246
247 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
248 }
249
250 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
251 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
252 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
253 }
254
255 struct rds_indexcxx . . $ rds_index#* ret = rds_index_newcxx . . $ rds_index_new(4605487e90059ab1).();
256 xmlNodePtrcxx . . $ xmlNodePtr# relationships_node = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
257
258 while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, 1))
259 {
260 const char *name = (const char*)xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader);
261
262 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "report-requests") == 0) {
263 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
264 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
265 }
266
267 while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, 2))
268 {
269 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader), "report-request") != 0) {
270 // TODO: warning?
271 continue;
272 }
273
274 struct rds_report_request_indexcxx . . $ rds_report_request_index#* rr_index = rds_report_request_index_parsecxx . . $ rds_report_request_index_parse(350659b37ad1aafb).(reader);
275 rds_index_add_report_requestcxx . . $ rds_index_add_report_request(c983cdd79e95639b).(ret, rr_index);
276
277 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
278 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
279 }
280 }
281 }
282 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "assets") == 0)
283 {
284 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
285 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
286 }
287
288 while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, 2))
289 {
290 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader), "asset") != 0) {
291 // TODO: warning?
292 continue;
293 }
294
295 struct rds_asset_indexcxx . . $ rds_asset_index#* a_index = rds_asset_index_parsecxx . . $ rds_asset_index_parse(397a34762cf0d0a6).(reader);
296 rds_index_add_assetcxx . . $ rds_index_add_asset(d791cf9d8a4b0027).(ret, a_index);
297
298 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
299 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
300 }
301 }
302 }
303 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "reports") == 0)
304 {
305 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
306 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
307 }
308
309 while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, 2))
310 {
311 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)xmlTextReaderConstLocalNamecxx . . $ xmlTextReaderConstLocalName(60a5affeeceb06fd).(reader), "report") != 0) {
312 // TODO: warning?
313 continue;
314 }
315
316 struct rds_report_indexcxx . . $ rds_report_index#* r_index = rds_report_index_parsecxx . . $ rds_report_index_parse(1729bea9ee323d5f).(reader);
317 rds_index_add_reportcxx . . $ rds_index_add_report(7e6d136c2af44b90).(ret, r_index);
318
319 if (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) != 1) {
320 oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError());
321 }
322 }
323 }
324 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, "relationships") == 0) {
325 // We have to copy the node, xmlTextReader destroys it when
326 // xmlTextReaderRead is next called.
327 //
328 // extended = 1 means that we want to copy all including children
329 xmlNodePtrcxx . . $ xmlNodePtr# new_relationships_node = xmlCopyNodecxx . . $ xmlCopyNode(659181c62eedb9c9).(xmlTextReaderExpandcxx . . $ xmlTextReaderExpand(ed6f36f6605b4589).(reader), 1);
330
331 if (relationships_node)
332 {
333 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!, "There is more than 1 <core:relationships> element in the Result DataStream.\n"
334 "Please make sure the input file is valid! Only the first element will be used to build the index!");
335 xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(new_relationships_node);
336 }
337 else
338 relationships_node = new_relationships_node;
339 }
340 else
341 {
342 oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XMLcxx . . $ `src/common/public/oscap_error.h:59:9`!, "Unknown element '%s' encountered while parsing Result DataStream to rds_index, skipping...", name);
343 }
344
345 xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader);
346 }
347
348 _parse_relationships_nodecxx . . $ _parse_relationships_node(84b24f1c4d287864).(ret, relationships_node);
349 xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(relationships_node);
350
351 return ret;
352 }
353
354 int rds_index_select_reportcxx . . $ rds_index_select_report(d14df7c8f2525438).(struct rds_indexcxx . . $ rds_index# *s, const char **report_id)
355 {
356 int ret = 1;
357
358 struct rds_report_index_iteratorcxx . . $ rds_report_index_iterator# *reports_it = rds_index_get_reportscxx . . $ rds_index_get_reports(6ea603b5d38e4ab3).(s);
359 while (rds_report_index_iterator_has_morecxx . . $ rds_report_index_iterator_has_more(6c8d9b5d20d60db1).(reports_it))
360 {
361 struct rds_report_indexcxx . . $ rds_report_index#* report_idx = rds_report_index_iterator_nextcxx . . $ rds_report_index_iterator_next(3245c31063e7085e).(reports_it);
362 const char *report_idx_id = rds_report_index_get_idcxx . . $ rds_report_index_get_id(7cda95b454727dd1).(report_idx);
363
364 if (!*report_id || strcmpcxx . . $ strcmp(5ae29d726ae57f88).(report_idx_id, *report_id) == 0) {
365 *report_id = report_idx_id;
366 ret = 0;
367 break;
368 }
369 }
370 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(reports_it);
371
372 return ret;
373 }