Debian Codegraph @

utils/oscap-info.c

raw symbols SCIP
1 /*
2 * Copyright 2010--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 * Peter Vrabec <[email protected]>
21 */
22
23 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!
24 #include <config.h>cxx . . $ `<file>/build/config.h`/
25 #endif
26
27 /* Standard header files */
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #ifdef HAVE_GETOPT_Hcxx . . $ `build/config.h:79:9`!
32 #include <getopt.h>
33 #endif
34 #include <assert.h>
35 #include <math.h>
36 #include <time.h>
37 #include <sys/types.h>
38 #include <sys/stat.h>
39 #include <limits.h>
40
41 #include <oscap.h>cxx . . $ `<file>/src/common/public/oscap.h`/
42 #include <oscap_helpers.h>cxx . . $ `<file>/src/common/public/oscap_helpers.h`/
43 #include "oscap_source.h"cxx . . $ `<file>/src/source/public/oscap_source.h`/
44 #include <xccdf_policy.h>cxx . . $ `<file>/src/XCCDF_POLICY/public/xccdf_policy.h`/
45 #include <oval_results.h>cxx . . $ `<file>/src/OVAL/public/oval_results.h`/
46 #include <oval_variables.h>cxx . . $ `<file>/src/OVAL/public/oval_variables.h`/
47 #include <oval_system_characteristics.h>cxx . . $ `<file>/src/OVAL/public/oval_system_characteristics.h`/
48 #include <oval_directives.h>cxx . . $ `<file>/src/OVAL/public/oval_directives.h`/
49 #include <scap_ds.h>cxx . . $ `<file>/src/DS/public/scap_ds.h`/
50 #include <ds_rds_session.h>cxx . . $ `<file>/src/DS/public/ds_rds_session.h`/
51 #include <ds_sds_session.h>cxx . . $ `<file>/src/DS/public/ds_sds_session.h`/
52 #include <xccdf_session.h>cxx . . $ `<file>/src/XCCDF/public/xccdf_session.h`/
53
54 #include "oscap-tool.h"cxx . . $ `<file>/utils/oscap-tool.h`/
55
56
57 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_infocxx . . $ getopt_info(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action);
58 static int app_infocxx . . $ app_info(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action);
59
60 struct oscap_modulecxx . . $ oscap_module# OSCAP_INFO_MODULEcxx . . $ OSCAP_INFO_MODULE. = {
61 .name = "info",
62 .parent = &OSCAP_ROOT_MODULEcxx . . $ OSCAP_ROOT_MODULE.,
63 .summary = "Print information about a SCAP file.",
64 .usage = "some-file.xml",
65 .help = "Options:\n"
66 " --fetch-remote-resources - Download remote content referenced by data stream.\n"
67 " --list-rules - Print selected rule IDs for the given profile (requires --profile).\n"
68 " --list-vars - Print XCCDF Value IDs and their resolved values for the given profile (requires --profile).\n"
69 " --local-files <dir> - Use locally downloaded copies of remote resources stored in the given directory.\n"
70 " --profile <id> - Show info of the profile with the given ID.\n"
71 " --profiles - Show profiles from the input file in the <id>:<title> format, one line per profile.\n"
72 " --references - Show references available in the input benchmark\n"
73 " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n"
74 " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n"
75 " --verbose-log-file <file> - Write verbose information into file.\n",
76 .opt_parser = getopt_infocxx . . $ getopt_info(93e8ba72609212ff).,
77 .func = app_infocxx . . $ app_info(d99c68634f61e371).
78 };
79
80 static void print_timecxx . . $ print_time(85c52e162fed56f9).(const char *file) {
81 struct statcxx . . $ stat# buffer;
82 struct tmcxx . . $ tm# result;
83 char timeStr[ 100 ] = "";
84
85 if(!statcxx . . $ stat(a9cd1e23e96f423c).(file, &buffer)) {
86 strftimecxx . . $ strftime(98e75925167c4f1b).(timeStr, 100, "%Y-%m-%dT%H:%M:%S", localtime_rcxx . . $ localtime_r(92e3d173686db852).(&buffer.st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!, &result));
87 printfcxx . . $ printf(581fddd72a8db8fc).("Imported: %s\n", timeStr);
88 }
89 }
90
91 static inline void _print_xccdf_statuscxx . . $ _print_xccdf_status(ff8e120939183244).(struct xccdf_statuscxx . . $ xccdf_status# *status, const char *prefix)
92 {
93 if (status) {
94 printfcxx . . $ printf(581fddd72a8db8fc).("%sStatus: %s\n", prefix, xccdf_status_type_to_textcxx . . $ xccdf_status_type_to_text(8669e4cc561a95f3).(xccdf_status_get_statuscxx . . $ xccdf_status_get_status(52f346dba08ec806).(status)));
95 const time_tcxx . . $ time_t# date_time = xccdf_status_get_datecxx . . $ xccdf_status_get_date(47b82b9b80832738).(status);
96 if (date_time != 0) {
97 struct tmcxx . . $ tm# result;
98 struct tmcxx . . $ tm# *date = localtime_rcxx . . $ localtime_r(92e3d173686db852).(&date_time, &result);
99 char date_str[] = "YYYY-DD-MM";
100 int ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(date_str, sizeof(date_str), "%04d-%02d-%02d", date->tm_yearcxx . . $ tm#tm_year. + 1900, date->tm_moncxx . . $ tm#tm_mon. + 1, date->tm_mdaycxx . . $ tm#tm_mday.);
101 if (ret < 0) {
102 return;
103 }
104 printfcxx . . $ printf(581fddd72a8db8fc).("%sGenerated: %s\n", prefix, date_str);
105 }
106 }
107 }
108
109 static void _remove_occurence_of_character_from_stringcxx . . $ _remove_occurence_of_character_from_string(fefe1766765ef479).(char *string, char c)
110 {
111 if (string == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
112 return;
113
114 char *reading_ptr = string, *writing_ptr = string;
115 while (*reading_ptr) {
116 *writing_ptr = *reading_ptr;
117 if (*reading_ptr != c)
118 writing_ptr++;
119 reading_ptr++;
120 }
121 *writing_ptr = '\0';
122 }
123
124 static void _translate_character_in_stringcxx . . $ _translate_character_in_string(a6a7e0059e642399).(char *string, char to_replace, char replace_with)
125 {
126 if (string == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
127 return;
128
129 char *string_iterator = string;
130 while (*string_iterator) {
131 if (*string_iterator == to_replace)
132 *string_iterator = replace_with;
133 string_iterator++;
134 }
135 }
136
137 static void _print_xccdf_profile_defaultcxx . . $ _print_xccdf_profile_default(fa2b84f913a2545f).(const struct xccdf_profilecxx . . $ xccdf_profile# *prof, const char *prefix)
138 {
139 struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *title_it = xccdf_profile_get_titlecxx . . $ xccdf_profile_get_title(c6130d5125dc213c).(prof);
140 char *profile_title = oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(title_it, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
141 oscap_text_iterator_freecxx . . $ oscap_text_iterator_free(f60c6cfdbf1f29d7).(title_it);
142 _remove_occurence_of_character_from_stringcxx . . $ _remove_occurence_of_character_from_string(fefe1766765ef479).(profile_title, '\n');
143 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tTitle: %s\n", prefix, profile_title);
144 freecxx . . $ free(5d22bdacc48458e8).(profile_title);
145 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t\tId: %s%s\n", prefix,
146 xccdf_profile_get_idcxx . . $ xccdf_profile_get_id(d143a4aa05fc37ce).(prof),
147 xccdf_profile_get_abstractcxx . . $ xccdf_profile_get_abstract(5c59b8a90ca1d1a1).(prof) ? " (abstract)" : "");
148 }
149
150 static void _print_xccdf_profile_verbosecxx . . $ _print_xccdf_profile_verbose(fa2b84f913a2545f).(const struct xccdf_profilecxx . . $ xccdf_profile# *prof, const char *prefix)
151 {
152 struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *text_it;
153
154 printfcxx . . $ printf(581fddd72a8db8fc).("%sProfile\n", prefix);
155
156 text_it = xccdf_profile_get_titlecxx . . $ xccdf_profile_get_title(c6130d5125dc213c).(prof);
157 char *profile_title = oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(text_it, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
158 oscap_text_iterator_freecxx . . $ oscap_text_iterator_free(f60c6cfdbf1f29d7).(text_it);
159 _remove_occurence_of_character_from_stringcxx . . $ _remove_occurence_of_character_from_string(fefe1766765ef479).(profile_title, '\n');
160 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tTitle: %s\n", prefix, profile_title);
161 freecxx . . $ free(5d22bdacc48458e8).(profile_title);
162
163 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tId: %s%s\n\n", prefix,
164 xccdf_profile_get_idcxx . . $ xccdf_profile_get_id(d143a4aa05fc37ce).(prof),
165 xccdf_profile_get_abstractcxx . . $ xccdf_profile_get_abstract(5c59b8a90ca1d1a1).(prof) ? " (abstract)" : "");
166
167 text_it = xccdf_profile_get_descriptioncxx . . $ xccdf_profile_get_description(c6130d5125dc213c).(prof);
168 char *profile_description = oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(text_it, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
169 oscap_text_iterator_freecxx . . $ oscap_text_iterator_free(f60c6cfdbf1f29d7).(text_it);
170 _translate_character_in_stringcxx . . $ _translate_character_in_string(a6a7e0059e642399).(profile_description, '\n', ' ');
171 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tDescription: %s\n", prefix, profile_description);
172 freecxx . . $ free(5d22bdacc48458e8).(profile_description);
173 }
174
175 static void _print_xccdf_profile_tersecxx . . $ _print_xccdf_profile_terse(fa2b84f913a2545f).(const struct xccdf_profilecxx . . $ xccdf_profile# *prof, const char *prefix)
176 {
177 struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *title_it = xccdf_profile_get_titlecxx . . $ xccdf_profile_get_title(c6130d5125dc213c).(prof);
178 char *profile_title = oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(title_it, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
179 _remove_occurence_of_character_from_stringcxx . . $ _remove_occurence_of_character_from_string(fefe1766765ef479).(profile_title, '\n');
180 oscap_text_iterator_freecxx . . $ oscap_text_iterator_free(f60c6cfdbf1f29d7).(title_it);
181 const char *profile_id = xccdf_profile_get_idcxx . . $ xccdf_profile_get_id(d143a4aa05fc37ce).(prof);
182 char cleaned_profile_id[1024];
183 strncpycxx . . $ strncpy(255158a415b673b0).(cleaned_profile_id, profile_id, sizeof(cleaned_profile_id) - 1);
184 _remove_occurence_of_character_from_stringcxx . . $ _remove_occurence_of_character_from_string(fefe1766765ef479).(cleaned_profile_id, '\n');
185 printfcxx . . $ printf(581fddd72a8db8fc).("%s:%s\n",
186 cleaned_profile_id,
187 profile_title);
188 freecxx . . $ free(5d22bdacc48458e8).(profile_title);
189 }
190
191 static void _print_xccdf_profile_with_idcxx . . $ _print_xccdf_profile_with_id(e8a3c295d564537b).(struct xccdf_profilecxx . . $ xccdf_profile# *profile, const char *prefix)
192 {
193 if (profile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
194 return;
195
196 _print_xccdf_profile_verbosecxx . . $ _print_xccdf_profile_verbose(fa2b84f913a2545f).(profile, prefix);
197 }
198
199 static inline void _print_xccdf_profilescxx . . $ _print_xccdf_profiles(10675e7f957e7854).(struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *prof_it, const char *prefix, void (*print_one_profile)(const struct xccdf_profilecxx . . $ xccdf_profile# *, const char *))
200 {
201 if (prefix)
202 printfcxx . . $ printf(581fddd72a8db8fc).("%sProfiles:\n", prefix);
203
204 if (print_one_profile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
205 print_one_profile = &_print_xccdf_profile_defaultcxx . . $ _print_xccdf_profile_default(fa2b84f913a2545f).;
206
207 while (xccdf_profile_iterator_has_morecxx . . $ xccdf_profile_iterator_has_more(adef36931cdf4bdd).(prof_it)) {
208 struct xccdf_profilecxx . . $ xccdf_profile# *prof = xccdf_profile_iterator_nextcxx . . $ xccdf_profile_iterator_next(4851320650739603).(prof_it);
209 print_one_profile(prof, prefix);
210 }
211 }
212
213 static inline void _print_xccdf_referenced_filescxx . . $ _print_xccdf_referenced_files(7c84e7be56876a5f).(struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model, const char *prefix)
214 {
215 struct oscap_file_entry_listcxx . . $ oscap_file_entry_list# *referenced_files = xccdf_policy_model_get_systems_and_filescxx . . $ xccdf_policy_model_get_systems_and_files(bd306bb648bca7f3).(policy_model);
216 struct oscap_file_entry_iteratorcxx . . $ oscap_file_entry_iterator# *files_it = oscap_file_entry_list_get_filescxx . . $ oscap_file_entry_list_get_files(f5aaec2ea5fc982f).(referenced_files);
217 printfcxx . . $ printf(581fddd72a8db8fc).("%sReferenced check files:\n", prefix);
218 while (oscap_file_entry_iterator_has_morecxx . . $ oscap_file_entry_iterator_has_more(126961f4f01d6b48).(files_it)) {
219 struct oscap_file_entrycxx . . $ oscap_file_entry# *file_entry = (struct oscap_file_entrycxx . . $ oscap_file_entry# *) oscap_file_entry_iterator_nextcxx . . $ oscap_file_entry_iterator_next(2dd8621e704b2d0b).(files_it);
220 const char *system = oscap_file_entry_get_systemcxx . . $ oscap_file_entry_get_system(7827612c21abd21f).(file_entry);
221 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(system, "http://open-scap.org/page/SCE")) {
222 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s\n", prefix, oscap_file_entry_get_filecxx . . $ oscap_file_entry_get_file(7827612c21abd21f).(file_entry));
223 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t\tsystem: %s\n", prefix, oscap_file_entry_get_systemcxx . . $ oscap_file_entry_get_system(7827612c21abd21f).(file_entry));
224 }
225 }
226 oscap_file_entry_iterator_freecxx . . $ oscap_file_entry_iterator_free(9fa52656bc957f51).(files_it);
227 oscap_file_entry_list_freecxx . . $ oscap_file_entry_list_free(46f5db83064d09fb).(referenced_files);
228 }
229
230 static inline void _print_xccdf_resultcxx . . $ _print_xccdf_result(360c1644ec2ae20).(struct xccdf_resultcxx . . $ xccdf_result# *xccdf_result, const char *prefix)
231 {
232 const char *result_id = xccdf_result_get_idcxx . . $ xccdf_result_get_id(9b243840ec21a788).(xccdf_result);
233 const char *benchmark_uri = xccdf_result_get_benchmark_uricxx . . $ xccdf_result_get_benchmark_uri(9b243840ec21a788).(xccdf_result);
234 const char *xccdf_profile = xccdf_result_get_profilecxx . . $ xccdf_result_get_profile(9b243840ec21a788).(xccdf_result);
235 if (xccdf_profile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
236 xccdf_profile = "(default)";
237 }
238 const char *start_time = xccdf_result_get_start_timecxx . . $ xccdf_result_get_start_time(9b243840ec21a788).(xccdf_result);
239 const char *end_time = xccdf_result_get_end_timecxx . . $ xccdf_result_get_end_time(9b243840ec21a788).(xccdf_result);
240 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tResult ID: %s\n", prefix, result_id);
241 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tSource benchmark: %s\n", prefix, benchmark_uri);
242 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tSource profile: %s\n", prefix, xccdf_profile);
243 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tEvaluation started: %s\n", prefix, start_time);
244 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tEvaluation finished: %s\n", prefix, end_time);
245 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tPlatform CPEs:\n", prefix);
246 struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *platforms_it = xccdf_result_get_platformscxx . . $ xccdf_result_get_platforms(afd714a9d6f8cb).(xccdf_result);
247 if (!oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(platforms_it)) {
248 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t\t(none)\n", prefix);
249 }
250 while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(platforms_it)) {
251 const char *platform = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(platforms_it);
252 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t\t%s\n", prefix, platform);
253 }
254 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(platforms_it);
255 }
256
257
258 static inline void _print_xccdf_testresultscxx . . $ _print_xccdf_testresults(aa0fb37b88ff8c32).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *prefix)
259 {
260 struct xccdf_result_iteratorcxx . . $ xccdf_result_iterator# *res_it = xccdf_benchmark_get_resultscxx . . $ xccdf_benchmark_get_results(fbea4b8d76fa1d6a).(bench);
261 if (xccdf_result_iterator_has_morecxx . . $ xccdf_result_iterator_has_more(43a2a759dd12fb20).(res_it))
262 printfcxx . . $ printf(581fddd72a8db8fc).("%sTest Results:\n", prefix);
263 while (xccdf_result_iterator_has_morecxx . . $ xccdf_result_iterator_has_more(43a2a759dd12fb20).(res_it)) {
264 struct xccdf_resultcxx . . $ xccdf_result# *test_result = xccdf_result_iterator_nextcxx . . $ xccdf_result_iterator_next(70fb5f80ce5b82b1).(res_it);
265 _print_xccdf_resultcxx . . $ _print_xccdf_result(360c1644ec2ae20).(test_result, prefix);
266 }
267 xccdf_result_iterator_freecxx . . $ xccdf_result_iterator_free(fd5dfb6e0ed10cd3).(res_it);
268 }
269
270 static void _print_referencescxx . . $ _print_references(aa0fb37b88ff8c32).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *prefix)
271 {
272 struct oscap_reference_iteratorcxx . . $ oscap_reference_iterator# *it = xccdf_item_get_referencescxx . . $ xccdf_item_get_references(58b511645be6226a).((struct xccdf_itemcxx . . $ xccdf_item# *)bench);
273 printfcxx . . $ printf(581fddd72a8db8fc).("%sReferences:\n", prefix);
274 if (!oscap_reference_iterator_has_morecxx . . $ oscap_reference_iterator_has_more(3902913d46f91173).(it)) {
275 printfcxx . . $ printf(581fddd72a8db8fc).("%s\tNone\n", prefix);
276 }
277 while (oscap_reference_iterator_has_morecxx . . $ oscap_reference_iterator_has_more(3902913d46f91173).(it)) {
278 struct oscap_referencecxx . . $ oscap_reference# *ref = oscap_reference_iterator_nextcxx . . $ oscap_reference_iterator_next(81bc9a067126085c).(it);
279 const char *title = oscap_reference_get_titlecxx . . $ oscap_reference_get_title(2a9eef276a992895).(ref);
280 const char *href = oscap_reference_get_hrefcxx . . $ oscap_reference_get_href(2a9eef276a992895).(ref);
281 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s: %s\n", prefix, title, href);
282 }
283 oscap_reference_iterator_freecxx . . $ oscap_reference_iterator_free(3e07142178288e0).(it);
284 }
285
286 static inline void _print_xccdf_benchmarkcxx . . $ _print_xccdf_benchmark(315e11ca0a3c21ea).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *prefix, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! print_references)
287 {
288 _print_xccdf_statuscxx . . $ _print_xccdf_status(ff8e120939183244).(xccdf_benchmark_get_status_currentcxx . . $ xccdf_benchmark_get_status_current(b1deef6788e32dff).(bench), prefix);
289 printfcxx . . $ printf(581fddd72a8db8fc).("%sResolved: %s\n", prefix, xccdf_benchmark_get_resolvedcxx . . $ xccdf_benchmark_get_resolved(8f09e366eefbe28).(bench) ? "true" : "false");
290
291 struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *prof_it = xccdf_benchmark_get_profilescxx . . $ xccdf_benchmark_get_profiles(c49c4abda143290c).(bench);
292 _print_xccdf_profilescxx . . $ _print_xccdf_profiles(10675e7f957e7854).(prof_it, prefix, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
293 xccdf_profile_iterator_freecxx . . $ xccdf_profile_iterator_free(e346a4b111941870).(prof_it);
294 if (print_references) {
295 _print_referencescxx . . $ _print_references(aa0fb37b88ff8c32).(bench, prefix);
296 }
297
298 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
299 _print_xccdf_referenced_filescxx . . $ _print_xccdf_referenced_files(7c84e7be56876a5f).(policy_model, prefix);
300 _print_xccdf_testresultscxx . . $ _print_xccdf_testresults(aa0fb37b88ff8c32).(bench, prefix);
301
302 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
303 // xccdf_benchmark_free not needed, it si already freed by the policy!
304 }
305
306 static inline void _print_xccdf_tailoring_headercxx . . $ _print_xccdf_tailoring_header(38ae3ec77127e124).(struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring, const char *prefix)
307 {
308 if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
309 return;
310 }
311 printfcxx . . $ printf(581fddd72a8db8fc).("%sBenchmark Hint: %s\n", prefix ? prefix : "", xccdf_tailoring_get_benchmark_refcxx . . $ xccdf_tailoring_get_benchmark_ref(8db670c91c6a1b30).(tailoring));
312 }
313
314 static inline void _print_xccdf_tailoringcxx . . $ _print_xccdf_tailoring(3fa7154813674993).(struct oscap_sourcecxx . . $ oscap_source# *source, const char *prefix, void (*print_one_profile)(const struct xccdf_profilecxx . . $ xccdf_profile# *, const char *))
315 {
316 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
317 _print_xccdf_tailoring_headercxx . . $ _print_xccdf_tailoring_header(38ae3ec77127e124).(tailoring, prefix);
318
319 struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *prof_it = xccdf_tailoring_get_profilescxx . . $ xccdf_tailoring_get_profiles(41ce0c0fc277fbfc).(tailoring);
320 _print_xccdf_profilescxx . . $ _print_xccdf_profiles(10675e7f957e7854).(prof_it, prefix, print_one_profile);
321 xccdf_profile_iterator_freecxx . . $ xccdf_profile_iterator_free(e346a4b111941870).(prof_it);
322
323 xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring);
324 }
325
326 static void _print_single_benchmark_profiles_onlycxx . . $ _print_single_benchmark_profiles_only(55d89e1b9b447538).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench)
327 {
328 struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *prof_it = xccdf_benchmark_get_profilescxx . . $ xccdf_benchmark_get_profiles(c49c4abda143290c).(bench);
329 _print_xccdf_profilescxx . . $ _print_xccdf_profiles(10675e7f957e7854).(prof_it, 0, _print_xccdf_profile_tersecxx . . $ _print_xccdf_profile_terse(fa2b84f913a2545f).);
330 xccdf_profile_iterator_freecxx . . $ xccdf_profile_iterator_free(e346a4b111941870).(prof_it);
331 }
332
333 static void _print_single_benchmark_one_profilecxx . . $ _print_single_benchmark_one_profile(aa0fb37b88ff8c32).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *profile_id)
334 {
335 struct xccdf_profilecxx . . $ xccdf_profile# *profile = xccdf_benchmark_get_profile_by_idcxx . . $ xccdf_benchmark_get_profile_by_id(34bf61e7e9f7ecd5).(bench, profile_id);
336 if (profile != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
337 _print_xccdf_profile_with_idcxx . . $ _print_xccdf_profile_with_id(e8a3c295d564537b).(profile, "");
338 }
339
340 static void _print_single_benchmark_allcxx . . $ _print_single_benchmark_all(aa0fb37b88ff8c32).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *prefix)
341 {
342 _print_xccdf_benchmarkcxx . . $ _print_xccdf_benchmark(315e11ca0a3c21ea).(bench, prefix, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
343 // bench is freed as a side-effect of the function above
344 }
345
346 static int app_info_single_ds_profiles_onlycxx . . $ app_info_single_ds_profiles_only(32b5b3ccd91ea2bf).(struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator#* sds_it, struct ds_sds_sessioncxx . . $ ds_sds_session# *session, const struct oscap_actioncxx . . $ oscap_action# *action)
347 {
348 struct ds_stream_indexcxx . . $ ds_stream_index# * stream = ds_stream_index_iterator_nextcxx . . $ ds_stream_index_iterator_next(52812d4c4a7c3217).(sds_it);
349 struct oscap_string_iteratorcxx . . $ oscap_string_iterator#* checklist_it = ds_stream_index_get_checklistscxx . . $ ds_stream_index_get_checklists(4484253c305eab5e).(stream);
350
351 while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(checklist_it)) {
352 const char * id = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(checklist_it);
353 /* decompose */
354 struct oscap_sourcecxx . . $ oscap_source# *xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(session, ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream), id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
355 if (xccdf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
356 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
357 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
358 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
359 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
360 }
361
362 if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) {
363 struct xccdf_benchmarkcxx . . $ xccdf_benchmark#* bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(xccdf_source);
364 if(!bench) {
365 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
366 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
367 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
368 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
369 }
370 _print_single_benchmark_profiles_onlycxx . . $ _print_single_benchmark_profiles_only(55d89e1b9b447538).(bench);
371 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
372
373 } else if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) {
374 _print_xccdf_tailoringcxx . . $ _print_xccdf_tailoring(3fa7154813674993).(xccdf_source, 0, _print_xccdf_profile_tersecxx . . $ _print_xccdf_profile_terse(fa2b84f913a2545f).);
375 }
376 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
377 }
378 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
379 return OSCAP_OKcxx . . $ OSCAP_OK.;
380 }
381
382 static const char *tailoring_get_profile_or_report_multiple_idscxx . . $ tailoring_get_profile_or_report_multiple_ids(409ed43a87d11ec4).(struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring, const char *profile_suffix, const char *source_file)
383 {
384 int match_status;
385 const char *result = xccdf_tailoring_match_profile_idcxx . . $ xccdf_tailoring_match_profile_id(429b5e088e99157f).(tailoring, profile_suffix, &match_status);
386 evaluate_suffix_match_result_with_custom_reportscxx . . $ evaluate_suffix_match_result_with_custom_reports(900988ad5affe787).(match_status, profile_suffix, source_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &report_multiple_profile_matchescxx . . $ report_multiple_profile_matches(2fa786934fe80e24).);
387 return result;
388 }
389
390 static const char *benchmark_get_profile_or_report_multiple_idscxx . . $ benchmark_get_profile_or_report_multiple_ids(62a05b6a26ca27bc).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *profile_suffix, const char *source_file)
391 {
392 int match_status;
393 const char *result = xccdf_benchmark_match_profile_idcxx . . $ xccdf_benchmark_match_profile_id(9b9e7597774c7f37).(bench, profile_suffix, &match_status);
394 evaluate_suffix_match_result_with_custom_reportscxx . . $ evaluate_suffix_match_result_with_custom_reports(900988ad5affe787).(match_status, profile_suffix, source_file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &report_multiple_profile_matchescxx . . $ report_multiple_profile_matches(2fa786934fe80e24).);
395 return result;
396 }
397
398 static const char *benchmark_get_profile_or_report_id_issuescxx . . $ benchmark_get_profile_or_report_id_issues(62a05b6a26ca27bc).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *profile_suffix, const char *source_file)
399 {
400 int match_status;
401 const char *result = xccdf_benchmark_match_profile_idcxx . . $ xccdf_benchmark_match_profile_id(9b9e7597774c7f37).(bench, profile_suffix, &match_status);
402 evaluate_suffix_match_resultcxx . . $ evaluate_suffix_match_result(9ee5302023219b2d).(match_status, profile_suffix, source_file);
403 return result;
404 }
405
406 static void _print_rules_for_profilecxx . . $ _print_rules_for_profile(7c84e7be56876a5f).(struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model, const char *profile_id)
407 {
408 struct xccdf_policycxx . . $ xccdf_policy# *policy = xccdf_policy_model_get_policy_by_idcxx . . $ xccdf_policy_model_get_policy_by_id(3a48227fe1c1225a).(policy_model, profile_id);
409 if (policy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
410 return;
411 }
412 struct xccdf_select_iteratorcxx . . $ xccdf_select_iterator# *sel_it = xccdf_policy_get_selected_rulescxx . . $ xccdf_policy_get_selected_rules(8c20b0067b829e32).(policy);
413 while (xccdf_select_iterator_has_morecxx . . $ xccdf_select_iterator_has_more(685310f75eef1664).(sel_it)) {
414 const struct xccdf_selectcxx . . $ xccdf_select# *sel = xccdf_select_iterator_nextcxx . . $ xccdf_select_iterator_next(944efed7a3f49b12).(sel_it);
415 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", xccdf_select_get_itemcxx . . $ xccdf_select_get_item(5bca08d84ffaa667).(sel));
416 }
417 xccdf_select_iterator_freecxx . . $ xccdf_select_iterator_free(ad10dccc2bb9fd31).(sel_it);
418 }
419
420 static void _print_vars_for_profilecxx . . $ _print_vars_for_profile(7c84e7be56876a5f).(struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model, const char *profile_id)
421 {
422 struct xccdf_policycxx . . $ xccdf_policy# *policy = xccdf_policy_model_get_policy_by_idcxx . . $ xccdf_policy_model_get_policy_by_id(3a48227fe1c1225a).(policy_model, profile_id);
423 if (policy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
424 return;
425 }
426 const struct xccdf_profilecxx . . $ xccdf_profile# *profile = xccdf_policy_get_profilecxx . . $ xccdf_policy_get_profile(f562c39304763510).(policy);
427 if (profile == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
428 return;
429 }
430
431 const struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(policy_model);
432
433 struct xccdf_setvalue_iteratorcxx . . $ xccdf_setvalue_iterator# *sv_it = xccdf_profile_get_setvaluescxx . . $ xccdf_profile_get_setvalues(2858520f7d7fac8c).(profile);
434 while (xccdf_setvalue_iterator_has_morecxx . . $ xccdf_setvalue_iterator_has_more(3ec70e5e2abc17db).(sv_it)) {
435 const struct xccdf_setvaluecxx . . $ xccdf_setvalue# *sv = xccdf_setvalue_iterator_nextcxx . . $ xccdf_setvalue_iterator_next(753fc4cd25f5e085).(sv_it);
436 const char *value_id = xccdf_setvalue_get_itemcxx . . $ xccdf_setvalue_get_item(b6c7ccbe9a2081b7).(sv);
437 struct xccdf_itemcxx . . $ xccdf_item# *item = xccdf_benchmark_get_itemcxx . . $ xccdf_benchmark_get_item(daeed5940f8c8cf2).(bench, value_id);
438 if (item != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
439 const char *resolved = xccdf_policy_get_value_of_itemcxx . . $ xccdf_policy_get_value_of_item(a5cb590029f1e3ee).(policy, item);
440 if (resolved != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
441 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s\n", value_id, resolved);
442 }
443 }
444 xccdf_setvalue_iterator_freecxx . . $ xccdf_setvalue_iterator_free(88ac5f99059bb7a3).(sv_it);
445
446 struct xccdf_refine_value_iteratorcxx . . $ xccdf_refine_value_iterator# *rv_it = xccdf_profile_get_refine_valuescxx . . $ xccdf_profile_get_refine_values(d46be7e16f877ffa).(profile);
447 while (xccdf_refine_value_iterator_has_morecxx . . $ xccdf_refine_value_iterator_has_more(7ad4a4ce170291e7).(rv_it)) {
448 const struct xccdf_refine_valuecxx . . $ xccdf_refine_value# *rv = xccdf_refine_value_iterator_nextcxx . . $ xccdf_refine_value_iterator_next(7670134309efdbc5).(rv_it);
449 const char *value_id = xccdf_refine_value_get_itemcxx . . $ xccdf_refine_value_get_item(99f8a21d78864a7b).(rv);
450 struct xccdf_itemcxx . . $ xccdf_item# *item = xccdf_benchmark_get_itemcxx . . $ xccdf_benchmark_get_item(daeed5940f8c8cf2).(bench, value_id);
451 if (item != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
452 const char *resolved = xccdf_policy_get_value_of_itemcxx . . $ xccdf_policy_get_value_of_item(a5cb590029f1e3ee).(policy, item);
453 if (resolved != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
454 printfcxx . . $ printf(581fddd72a8db8fc).("%s\t%s\n", value_id, resolved);
455 }
456 }
457 xccdf_refine_value_iterator_freecxx . . $ xccdf_refine_value_iterator_free(699a53bbf99fc3b2).(rv_it);
458 }
459
460 static struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *_find_benchmark_in_streamcxx . . $ _find_benchmark_in_stream(3a76b1e3532e5d49).(
461 struct ds_sds_sessioncxx . . $ ds_sds_session# *session,
462 struct ds_stream_indexcxx . . $ ds_stream_index# *stream)
463 {
464 const char *stream_id = ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream);
465 struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *bench_it = ds_stream_index_get_checklistscxx . . $ ds_stream_index_get_checklists(4484253c305eab5e).(stream);
466 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
467 while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(bench_it)) {
468 const char *cl_id = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(bench_it);
469 struct oscap_sourcecxx . . $ oscap_source# *src = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(session, stream_id, cl_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
470 if (src != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(src) == OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) {
471 bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(src);
472 break;
473 }
474 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
475 }
476 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(bench_it);
477 return bench;
478 }
479
480 static struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *_resolve_benchmark_for_tailoringcxx . . $ _resolve_benchmark_for_tailoring(7321dc586dc8913d).(
481 struct oscap_sourcecxx . . $ oscap_source# *tailoring_source,
482 const char *tailoring_filepath,
483 struct oscap_sourcecxx . . $ oscap_source# **out_bench_source)
484 {
485 *out_bench_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
486
487 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(tailoring_source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
488 if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
489 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
490 }
491
492 const char *ref = xccdf_tailoring_get_benchmark_refcxx . . $ xccdf_tailoring_get_benchmark_ref(8db670c91c6a1b30).(tailoring);
493 char *benchmark_ref = ref ? strdupcxx . . $ strdup(a8b8e32347182212).(ref) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
494 xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring);
495
496 if (benchmark_ref == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
497 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The tailoring file doesn't contain a benchmark reference.\n");
498 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
499 }
500
501 // Extract #component_ref fragment from benchmark_ref, if present
502 const char *component_ref = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
503 char *sep = strchrcxx . . $ strchr(2050848944e00d54).(benchmark_ref, '#');
504 if (sep != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
505 component_ref = sep + 1;
506 *sep = '\0';
507 }
508
509 // Strip file:// prefix
510 const char *path_start = benchmark_ref;
511 if (strncmpcxx . . $ strncmp(fd278af2f295fa2e).(benchmark_ref, "file://", 7) == 0) {
512 path_start = benchmark_ref + 7;
513 }
514
515 char *filepath_cpy = strdupcxx . . $ strdup(a8b8e32347182212).(tailoring_filepath);
516 char *dir = oscap_dirnamecxx . . $ oscap_dirname(7a9722d75b371431).(filepath_cpy);
517 char *benchmark_path = path_start[0] == '/' ?
518 strdupcxx . . $ strdup(a8b8e32347182212).(path_start) : oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%s/%s", dir, path_start);
519 freecxx . . $ free(5d22bdacc48458e8).(dir);
520 freecxx . . $ free(5d22bdacc48458e8).(filepath_cpy);
521
522 struct oscap_sourcecxx . . $ oscap_source# *bench_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(benchmark_path);
523 freecxx . . $ free(5d22bdacc48458e8).(benchmark_path);
524 if (bench_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
525 freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref);
526 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
527 }
528
529 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
530 oscap_document_type_tcxx . . $ oscap_document_type_t# doc_type = oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(bench_source);
531 if (doc_type == OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.) {
532 struct ds_sds_sessioncxx . . $ ds_sds_session# *sds_session = ds_sds_session_new_from_sourcecxx . . $ ds_sds_session_new_from_source(84081d5e8394044f).(bench_source);
533 if (sds_session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
534 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(bench_source);
535 freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref);
536 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
537 }
538 if (component_ref != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
539 struct oscap_sourcecxx . . $ oscap_source# *xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(sds_session, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, component_ref, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
540 if (xccdf_source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
541 bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(xccdf_source);
542 }
543 } else {
544 struct ds_sds_indexcxx . . $ ds_sds_index# *sds_index = ds_sds_session_get_sds_idxcxx . . $ ds_sds_session_get_sds_idx(4257cf9e93799a4d).(sds_session);
545 struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator# *streams = ds_sds_index_get_streamscxx . . $ ds_sds_index_get_streams(812311662d5ba693).(sds_index);
546 if (ds_stream_index_iterator_has_morecxx . . $ ds_stream_index_iterator_has_more(c225a27a4fccde78).(streams)) {
547 struct ds_stream_indexcxx . . $ ds_stream_index# *stream = ds_stream_index_iterator_nextcxx . . $ ds_stream_index_iterator_next(52812d4c4a7c3217).(streams);
548 bench = _find_benchmark_in_streamcxx . . $ _find_benchmark_in_stream(3a76b1e3532e5d49).(sds_session, stream);
549 }
550 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(streams);
551 }
552 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(sds_session);
553 } else {
554 bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(bench_source);
555 }
556
557 freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref);
558
559 if (bench == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
560 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(bench_source);
561 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
562 }
563
564 *out_bench_source = bench_source;
565 return bench;
566 }
567
568 static int _handle_xccdf_benchmark_profilecxx . . $ _handle_xccdf_benchmark_profile(2e44c96c65fe97d3).(
569 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench,
570 const struct oscap_actioncxx . . $ oscap_action# *action,
571 const char *profile_suffix,
572 const char *filename,
573 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! *profile_found)
574 {
575 const char *profile_id = benchmark_get_profile_or_report_multiple_idscxx . . $ benchmark_get_profile_or_report_multiple_ids(62a05b6a26ca27bc).(bench, profile_suffix, filename);
576 if (profile_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
577 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
578 return OSCAP_OKcxx . . $ OSCAP_OK.;
579 }
580 if (action->list_rulescxx . . $ oscap_action#list_rules. || action->list_varscxx . . $ oscap_action#list_vars.) {
581 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
582 if (action->list_rulescxx . . $ oscap_action#list_rules.) {
583 _print_rules_for_profilecxx . . $ _print_rules_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
584 } else {
585 _print_vars_for_profilecxx . . $ _print_vars_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
586 }
587 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
588 } else {
589 _print_single_benchmark_one_profilecxx . . $ _print_single_benchmark_one_profile(aa0fb37b88ff8c32).(bench, profile_id);
590 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
591 }
592 *profile_found = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
593 return OSCAP_OKcxx . . $ OSCAP_OK.;
594 }
595
596 static int _handle_xccdf_tailoring_profilecxx . . $ _handle_xccdf_tailoring_profile(453c8dba14ccde4e).(
597 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring,
598 const struct oscap_actioncxx . . $ oscap_action# *action,
599 const char *profile_suffix,
600 const char *filename,
601 struct ds_sds_sessioncxx . . $ ds_sds_session# *session,
602 struct ds_stream_indexcxx . . $ ds_stream_index# *stream,
603 const char *checklist_id,
604 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! *profile_found)
605 {
606 const char *profile_id = tailoring_get_profile_or_report_multiple_idscxx . . $ tailoring_get_profile_or_report_multiple_ids(409ed43a87d11ec4).(tailoring, profile_suffix, filename);
607 if (profile_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
608 xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring);
609 return OSCAP_OKcxx . . $ OSCAP_OK.;
610 }
611 if (!(action->list_rulescxx . . $ oscap_action#list_rules. || action->list_varscxx . . $ oscap_action#list_vars.)) {
612 struct xccdf_profilecxx . . $ xccdf_profile# *profile = xccdf_tailoring_get_profile_by_idcxx . . $ xccdf_tailoring_get_profile_by_id(a3cce76bafe7a7e1).(tailoring, profile_id);
613 _print_xccdf_profile_with_idcxx . . $ _print_xccdf_profile_with_id(e8a3c295d564537b).(profile, "");
614 xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring);
615 *profile_found = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
616 return OSCAP_OKcxx . . $ OSCAP_OK.;
617 }
618 char *profile_id_dup = strdupcxx . . $ strdup(a8b8e32347182212).(profile_id);
619 xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring);
620
621 /* Find the XCCDF benchmark component in the stream */
622 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
623 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = _find_benchmark_in_streamcxx . . $ _find_benchmark_in_stream(3a76b1e3532e5d49).(session, stream);
624 if (bench == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
625 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Could not find a benchmark in the datastream.\n");
626 freecxx . . $ free(5d22bdacc48458e8).(profile_id_dup);
627 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
628 }
629
630 /* Re-select the tailoring component and import with benchmark */
631 const char *stream_id = ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream);
632 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
633 struct oscap_sourcecxx . . $ oscap_source# *tail_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(session, stream_id, checklist_id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
634 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *resolved_tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(tail_source, bench);
635
636 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
637 xccdf_policy_model_set_tailoringcxx . . $ xccdf_policy_model_set_tailoring(8231a1379b761ce0).(policy_model, resolved_tailoring);
638
639 if (action->list_rulescxx . . $ oscap_action#list_rules.) {
640 _print_rules_for_profilecxx . . $ _print_rules_for_profile(7c84e7be56876a5f).(policy_model, profile_id_dup);
641 } else {
642 _print_vars_for_profilecxx . . $ _print_vars_for_profile(7c84e7be56876a5f).(policy_model, profile_id_dup);
643 }
644 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
645 freecxx . . $ free(5d22bdacc48458e8).(profile_id_dup);
646 *profile_found = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
647 return OSCAP_OKcxx . . $ OSCAP_OK.;
648 }
649
650 static int app_info_single_ds_one_profilecxx . . $ app_info_single_ds_one_profile(32b5b3ccd91ea2bf).(struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator#* sds_it, struct ds_sds_sessioncxx . . $ ds_sds_session# *session, const struct oscap_actioncxx . . $ oscap_action# *action)
651 {
652 int ret = OSCAP_OKcxx . . $ OSCAP_OK.;
653 const char *profile_suffix = action->profilecxx . . $ oscap_action#profile.;
654 const char *filename = action->filecxx . . $ oscap_action#file.;
655 struct ds_stream_indexcxx . . $ ds_stream_index# *stream = ds_stream_index_iterator_nextcxx . . $ ds_stream_index_iterator_next(52812d4c4a7c3217).(sds_it);
656 struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *checklist_it = ds_stream_index_get_checklistscxx . . $ ds_stream_index_get_checklists(4484253c305eab5e).(stream);
657
658 if (!action->list_rulescxx . . $ oscap_action#list_rules. && !action->list_varscxx . . $ oscap_action#list_vars.) {
659 printfcxx . . $ printf(581fddd72a8db8fc).("\nStream: %s\n", ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream));
660 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", ds_stream_index_get_timestampcxx . . $ ds_stream_index_get_timestamp(c92d33fc914bb08c).(stream));
661 printfcxx . . $ printf(581fddd72a8db8fc).("Version: %s\n", ds_stream_index_get_versioncxx . . $ ds_stream_index_get_version(c92d33fc914bb08c).(stream));
662 }
663 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! profile_found = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
664
665 while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(checklist_it) && !profile_found) {
666 const char *id = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(checklist_it);
667
668 /* decompose */
669 struct oscap_sourcecxx . . $ oscap_source# *xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(session, ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream), id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
670 if (xccdf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
671 ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
672 goto cleanup;
673 }
674
675 if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) {
676 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(xccdf_source);
677 if (!bench) {
678 ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
679 goto cleanup;
680 }
681 ret = _handle_xccdf_benchmark_profilecxx . . $ _handle_xccdf_benchmark_profile(2e44c96c65fe97d3).(bench, action, profile_suffix, filename, &profile_found);
682 } else if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) {
683 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(xccdf_source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
684 if (!tailoring) {
685 ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
686 goto cleanup;
687 }
688 ret = _handle_xccdf_tailoring_profilecxx . . $ _handle_xccdf_tailoring_profile(453c8dba14ccde4e).(tailoring, action, profile_suffix, filename, session, stream, id, &profile_found);
689 }
690 if (ret != OSCAP_OKcxx . . $ OSCAP_OK.) {
691 goto cleanup;
692 }
693 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
694 }
695 if (!profile_found) {
696 report_missing_profilecxx . . $ report_missing_profile(2fa786934fe80e24).(profile_suffix, filename);
697 }
698
699 cleanup:
700 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
701 if (ret != OSCAP_OKcxx . . $ OSCAP_OK.) {
702 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
703 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
704 }
705 return ret;
706 }
707
708 static int app_info_single_ds_allcxx . . $ app_info_single_ds_all(32b5b3ccd91ea2bf).(struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator#* sds_it, struct ds_sds_sessioncxx . . $ ds_sds_session# *session, const struct oscap_actioncxx . . $ oscap_action# *action)
709 {
710 const char *prefix = "\t\t";
711 struct ds_stream_indexcxx . . $ ds_stream_index# * stream = ds_stream_index_iterator_nextcxx . . $ ds_stream_index_iterator_next(52812d4c4a7c3217).(sds_it);
712 struct oscap_string_iteratorcxx . . $ oscap_string_iterator#* checklist_it = ds_stream_index_get_checklistscxx . . $ ds_stream_index_get_checklists(4484253c305eab5e).(stream);
713
714 printfcxx . . $ printf(581fddd72a8db8fc).("\nStream: %s\n", ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream));
715 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", ds_stream_index_get_timestampcxx . . $ ds_stream_index_get_timestamp(c92d33fc914bb08c).(stream));
716 printfcxx . . $ printf(581fddd72a8db8fc).("Version: %s\n", ds_stream_index_get_versioncxx . . $ ds_stream_index_get_version(c92d33fc914bb08c).(stream));
717
718 printfcxx . . $ printf(581fddd72a8db8fc).("Checklists:\n");
719 while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(checklist_it)) {
720 const char * id = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(checklist_it);
721 printfcxx . . $ printf(581fddd72a8db8fc).("\tRef-Id: %s\n", id);
722
723 /* decompose */
724 struct oscap_sourcecxx . . $ oscap_source# *xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(session, ds_stream_index_get_idcxx . . $ ds_stream_index_get_id(c92d33fc914bb08c).(stream), id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
725 if (xccdf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
726 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
727 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
728 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
729 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
730 }
731
732 if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) {
733 struct xccdf_benchmarkcxx . . $ xccdf_benchmark#* bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(xccdf_source);
734 if(!bench) {
735 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
736 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
737 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
738 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
739 }
740 _print_xccdf_benchmarkcxx . . $ _print_xccdf_benchmark(315e11ca0a3c21ea).(bench, prefix, action->referencescxx . . $ oscap_action#references.);
741 // bench is freed as a side-effect of the function above
742 } else if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(xccdf_source) == OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) {
743 _print_xccdf_tailoringcxx . . $ _print_xccdf_tailoring(3fa7154813674993).(xccdf_source, prefix, 0);
744 }
745 ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session);
746 }
747 oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(checklist_it);
748 return OSCAP_OKcxx . . $ OSCAP_OK.;
749 }
750
751 static void app_info_single_benchmarkcxx . . $ app_info_single_benchmark(fb1e424104c001b7).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const struct oscap_actioncxx . . $ oscap_action# *action, struct oscap_sourcecxx . . $ oscap_source# *source)
752 {
753 if (action->show_profiles_onlycxx . . $ oscap_action#show_profiles_only.) {
754 _print_single_benchmark_profiles_onlycxx . . $ _print_single_benchmark_profiles_only(55d89e1b9b447538).(bench);
755 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
756 } else if (action->profilecxx . . $ oscap_action#profile.) {
757 const char *profile_id = benchmark_get_profile_or_report_id_issuescxx . . $ benchmark_get_profile_or_report_id_issues(62a05b6a26ca27bc).(bench, action->profilecxx . . $ oscap_action#profile., action->filecxx . . $ oscap_action#file.);
758 if (profile_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
759 if (action->list_rulescxx . . $ oscap_action#list_rules.) {
760 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
761 _print_rules_for_profilecxx . . $ _print_rules_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
762 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
763 } else if (action->list_varscxx . . $ oscap_action#list_vars.) {
764 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
765 _print_vars_for_profilecxx . . $ _print_vars_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
766 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
767 } else {
768 _print_single_benchmark_one_profilecxx . . $ _print_single_benchmark_one_profile(aa0fb37b88ff8c32).(bench, profile_id);
769 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
770 }
771 } else {
772 xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(bench);
773 }
774 } else {
775 printfcxx . . $ printf(581fddd72a8db8fc).("Checklist version: %s\n", oscap_source_get_schema_versioncxx . . $ oscap_source_get_schema_version(e20df36988f50e45).(source));
776 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
777
778 _print_single_benchmark_allcxx . . $ _print_single_benchmark_all(aa0fb37b88ff8c32).(bench, "");
779 // bench is freed as a side-effect of the function above
780 }
781 }
782
783 static int app_info_single_dscxx . . $ app_info_single_ds(32b5b3ccd91ea2bf).(struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator#* sds_it, struct ds_sds_sessioncxx . . $ ds_sds_session# *session, const struct oscap_actioncxx . . $ oscap_action# *action)
784 {
785 int return_value;
786 if (action->show_profiles_onlycxx . . $ oscap_action#show_profiles_only.) {
787 return_value = app_info_single_ds_profiles_onlycxx . . $ app_info_single_ds_profiles_only(32b5b3ccd91ea2bf).(sds_it, session, action);
788 } else if (action->profilecxx . . $ oscap_action#profile.) {
789 return_value = app_info_single_ds_one_profilecxx . . $ app_info_single_ds_one_profile(32b5b3ccd91ea2bf).(sds_it, session, action);
790 } else {
791 return_value = app_info_single_ds_allcxx . . $ app_info_single_ds_all(32b5b3ccd91ea2bf).(sds_it, session, action);
792 }
793 return return_value;
794 }
795
796 static int app_info_sdscxx . . $ app_info_sds(d93f427988de0ebc).(struct oscap_sourcecxx . . $ oscap_source# *source, const struct oscap_actioncxx . . $ oscap_action# *action)
797 {
798 if (! action->provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output.) {
799 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: Source Data Stream\n");
800 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
801 }
802
803 struct ds_sds_sessioncxx . . $ ds_sds_session# *session = ds_sds_session_new_from_sourcecxx . . $ ds_sds_session_new_from_source(84081d5e8394044f).(source);
804 if (session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
805 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
806 }
807
808 ds_sds_session_configure_remote_resourcescxx . . $ ds_sds_session_configure_remote_resources(61c5f4052dda9a0f).(session, action->remote_resourcescxx . . $ oscap_action#remote_resources., action->local_filescxx . . $ oscap_action#local_files., download_reporting_callbackcxx . . $ download_reporting_callback(3ca54e6407cd3d15).);
809
810 /* get collection */
811 struct ds_sds_indexcxx . . $ ds_sds_index# *sds = ds_sds_session_get_sds_idxcxx . . $ ds_sds_session_get_sds_idx(4257cf9e93799a4d).(session);
812 if (!sds) {
813 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
814 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
815 }
816 /* iterate over streams */
817 struct ds_stream_index_iteratorcxx . . $ ds_stream_index_iterator#* sds_it = ds_sds_index_get_streamscxx . . $ ds_sds_index_get_streams(812311662d5ba693).(sds);
818 while (ds_stream_index_iterator_has_morecxx . . $ ds_stream_index_iterator_has_more(c225a27a4fccde78).(sds_it)) {
819 if (app_info_single_dscxx . . $ app_info_single_ds(32b5b3ccd91ea2bf).(sds_it, session, action) == OSCAP_ERRORcxx . . $ OSCAP_ERROR.)
820 return OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
821 }
822 ds_stream_index_iterator_freecxx . . $ ds_stream_index_iterator_free(7e4fb91f616c49f4).(sds_it);
823 ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session);
824 return OSCAP_OKcxx . . $ OSCAP_OK.;
825 }
826
827 static int app_infocxx . . $ app_info(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action)
828 {
829 int result = OSCAP_ERRORcxx . . $ OSCAP_ERROR.;
830
831 struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->filecxx . . $ oscap_action#file.);
832
833 switch (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(source)) {
834 case OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.: {
835 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OVAL Definitions\n");
836 struct oval_definition_modelcxx . . $ oval_definition_model# *def_model = oval_definition_model_import_sourcecxx . . $ oval_definition_model_import_source(5c1ce95823108a2f).(source);
837 if(!def_model)
838 goto cleanup;
839 struct oval_generatorcxx . . $ oval_generator# *gen = oval_definition_model_get_generatorcxx . . $ oval_definition_model_get_generator(34235d354bc59011).(def_model);
840 printfcxx . . $ printf(581fddd72a8db8fc).("OVAL version: %s\n", oval_generator_get_core_schema_versioncxx . . $ oval_generator_get_core_schema_version(66391abd6e5ca54c).(gen));
841 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", oval_generator_get_timestampcxx . . $ oval_generator_get_timestamp(b7c567fb00dd25bc).(gen));
842 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
843 oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model);
844 }
845 break;
846 case OSCAP_DOCUMENT_OVAL_VARIABLEScxx . . $ OSCAP_DOCUMENT_OVAL_VARIABLES.: {
847 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OVAL Variables\n");
848 struct oval_variable_modelcxx . . $ oval_variable_model# *var_model = oval_variable_model_import_sourcecxx . . $ oval_variable_model_import_source(46e0a903906bd39).(source);
849 if(!var_model)
850 goto cleanup;
851 struct oval_generatorcxx . . $ oval_generator# *gen = oval_variable_model_get_generatorcxx . . $ oval_variable_model_get_generator(66a7caf5fa5568d8).(var_model);
852 printfcxx . . $ printf(581fddd72a8db8fc).("OVAL version: %s\n", oval_generator_get_core_schema_versioncxx . . $ oval_generator_get_core_schema_version(66391abd6e5ca54c).(gen));
853 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", oval_generator_get_timestampcxx . . $ oval_generator_get_timestamp(b7c567fb00dd25bc).(gen));
854 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
855 oval_variable_model_freecxx . . $ oval_variable_model_free(64ecb8c3b3b2877a).(var_model);
856 }
857 break;
858 case OSCAP_DOCUMENT_OVAL_DIRECTIVEScxx . . $ OSCAP_DOCUMENT_OVAL_DIRECTIVES.: {
859 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OVAL Directives\n");
860 struct oval_directives_modelcxx . . $ oval_directives_model# *dir_model = oval_directives_model_newcxx . . $ oval_directives_model_new(3f85e657173754f7).();
861 int ret = oval_directives_model_import_sourcecxx . . $ oval_directives_model_import_source(a58cf06db02a42f2).(dir_model, source);
862 if(ret)
863 goto cleanup;
864 struct oval_generatorcxx . . $ oval_generator# *gen = oval_directives_model_get_generatorcxx . . $ oval_directives_model_get_generator(ef8b8402b584ad04).(dir_model);
865 printfcxx . . $ printf(581fddd72a8db8fc).("OVAL version: %s\n", oval_generator_get_core_schema_versioncxx . . $ oval_generator_get_core_schema_version(66391abd6e5ca54c).(gen));
866 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", oval_generator_get_timestampcxx . . $ oval_generator_get_timestamp(b7c567fb00dd25bc).(gen));
867 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
868 oval_directives_model_freecxx . . $ oval_directives_model_free(89931e7170a08f7).(dir_model);
869 }
870 break;
871 case OSCAP_DOCUMENT_OVAL_SYSCHARcxx . . $ OSCAP_DOCUMENT_OVAL_SYSCHAR.: {
872 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OVAL System Characteristics\n");
873 struct oval_definition_modelcxx . . $ oval_definition_model# * def_model = oval_definition_model_newcxx . . $ oval_definition_model_new(e3611d73a4ba8158).();
874 struct oval_syschar_modelcxx . . $ oval_syschar_model# * sys_model = oval_syschar_model_newcxx . . $ oval_syschar_model_new(d79d001762efdcf0).(def_model);
875 int ret = oval_syschar_model_import_sourcecxx . . $ oval_syschar_model_import_source(99495a0a1929cf02).(sys_model, source);
876 if(ret)
877 goto cleanup;
878 struct oval_generatorcxx . . $ oval_generator# *gen = oval_syschar_model_get_generatorcxx . . $ oval_syschar_model_get_generator(21029f2f75a872d9).(sys_model);
879 printfcxx . . $ printf(581fddd72a8db8fc).("OVAL version: %s\n", oval_generator_get_core_schema_versioncxx . . $ oval_generator_get_core_schema_version(66391abd6e5ca54c).(gen));
880 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", oval_generator_get_timestampcxx . . $ oval_generator_get_timestamp(b7c567fb00dd25bc).(gen));
881 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
882 oval_syschar_model_freecxx . . $ oval_syschar_model_free(acc422d4d96f4be6).(sys_model);
883 oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model);
884 }
885 break;
886 case OSCAP_DOCUMENT_OVAL_RESULTScxx . . $ OSCAP_DOCUMENT_OVAL_RESULTS.: {
887 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OVAL Results\n");
888 struct oval_definition_modelcxx . . $ oval_definition_model# * def_model=oval_definition_model_newcxx . . $ oval_definition_model_new(e3611d73a4ba8158).();
889 struct oval_results_modelcxx . . $ oval_results_model# * res_model = oval_results_model_newcxx . . $ oval_results_model_new(138538a275af4028).(def_model,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
890 int ret = oval_results_model_import_sourcecxx . . $ oval_results_model_import_source(d188f08cde784e68).(res_model, source);
891 if(ret)
892 goto cleanup;
893 struct oval_generatorcxx . . $ oval_generator# *gen = oval_results_model_get_generatorcxx . . $ oval_results_model_get_generator(360f5a6d42af23f).(res_model);
894 printfcxx . . $ printf(581fddd72a8db8fc).("OVAL version: %s\n", oval_generator_get_core_schema_versioncxx . . $ oval_generator_get_core_schema_version(66391abd6e5ca54c).(gen));
895 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", oval_generator_get_timestampcxx . . $ oval_generator_get_timestamp(b7c567fb00dd25bc).(gen));
896 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
897 oval_results_model_freecxx . . $ oval_results_model_free(47fd98aca0b86b70).(res_model);
898 oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model);
899 }
900 break;
901 case OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.: {
902 if (!action->provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output.)
903 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: XCCDF Checklist\n");
904 struct xccdf_benchmarkcxx . . $ xccdf_benchmark#* bench = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(source);
905 if(!bench)
906 goto cleanup;
907 app_info_single_benchmarkcxx . . $ app_info_single_benchmark(fb1e424104c001b7).(bench, action, source);
908 // bench is freed as a side-effect of the function above
909 }
910 break;
911 case OSCAP_DOCUMENT_CPE_LANGUAGEcxx . . $ OSCAP_DOCUMENT_CPE_LANGUAGE.: {
912 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: CPE Language\n");
913 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
914 }
915 break;
916 case OSCAP_DOCUMENT_CPE_DICTIONARYcxx . . $ OSCAP_DOCUMENT_CPE_DICTIONARY.: {
917 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: CPE Dictionary\n");
918 struct cpe_dict_modelcxx . . $ cpe_dict_model# *dict_model = cpe_dict_model_import_sourcecxx . . $ cpe_dict_model_import_source(855462c7c482ecd).(source);
919 if (!dict_model)
920 goto cleanup;
921 struct cpe_generatorcxx . . $ cpe_generator# *gen = cpe_dict_model_get_generatorcxx . . $ cpe_dict_model_get_generator(caa96c31df1560ee).(dict_model);
922 if (gen != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
923 printfcxx . . $ printf(581fddd72a8db8fc).("CPE version: %s\n", cpe_generator_get_schema_versioncxx . . $ cpe_generator_get_schema_version(d7509889f74cf337).(gen));
924 printfcxx . . $ printf(581fddd72a8db8fc).("Generated: %s\n", cpe_generator_get_timestampcxx . . $ cpe_generator_get_timestamp(d7509889f74cf337).(gen));
925 }
926 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
927 cpe_dict_model_freecxx . . $ cpe_dict_model_free(99656294ab2c75d7).(dict_model);
928 }
929 break;
930 case OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.: {
931 if (app_info_sdscxx . . $ app_info_sds(d93f427988de0ebc).(source, action) == OSCAP_ERRORcxx . . $ OSCAP_ERROR.)
932 goto cleanup;
933 }
934 break;
935 case OSCAP_DOCUMENT_ARFcxx . . $ OSCAP_DOCUMENT_ARF.: {
936 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: Result Data Stream\n");
937 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
938 struct ds_rds_sessioncxx . . $ ds_rds_session# *session = ds_rds_session_new_from_sourcecxx . . $ ds_rds_session_new_from_source(592e39614e891652).(source);
939 if (session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
940 goto cleanup;
941 }
942 struct rds_indexcxx . . $ rds_index# *rds = ds_rds_session_get_rds_idxcxx . . $ ds_rds_session_get_rds_idx(a7bd6b4aec4a800f).(session);
943 if (!rds) {
944 ds_rds_session_freecxx . . $ ds_rds_session_free(f80cb7d7d6605f3a).(session);
945 goto cleanup;
946 }
947
948 struct rds_asset_index_iteratorcxx . . $ rds_asset_index_iterator#* asset_it = rds_index_get_assetscxx . . $ rds_index_get_assets(bc6b29bc3fb0d27e).(rds);
949 while (rds_asset_index_iterator_has_morecxx . . $ rds_asset_index_iterator_has_more(4cc1dd73741dac97).(asset_it)) {
950 struct rds_asset_indexcxx . . $ rds_asset_index#* asset = rds_asset_index_iterator_nextcxx . . $ rds_asset_index_iterator_next(73e5ef02dfc800bd).(asset_it);
951 printfcxx . . $ printf(581fddd72a8db8fc).("\nAsset: %s\n", rds_asset_index_get_idcxx . . $ rds_asset_index_get_id(b3b31caa40644001).(asset));
952
953 struct rds_report_index_iteratorcxx . . $ rds_report_index_iterator#* report_it = rds_asset_index_get_reportscxx . . $ rds_asset_index_get_reports(b9dd5c21a29fd511).(asset);
954 while (rds_report_index_iterator_has_morecxx . . $ rds_report_index_iterator_has_more(6c8d9b5d20d60db1).(report_it)) {
955 struct rds_report_indexcxx . . $ rds_report_index#* report = rds_report_index_iterator_nextcxx . . $ rds_report_index_iterator_next(3245c31063e7085e).(report_it);
956 struct rds_report_request_indexcxx . . $ rds_report_request_index#* request = rds_report_index_get_requestcxx . . $ rds_report_index_get_request(cf03ef1554bacd8a).(report);
957 const char *report_request_id = rds_report_request_index_get_idcxx . . $ rds_report_request_index_get_id(5a818ffca7a10dcf).(request);
958 const char *report_id = rds_report_index_get_idcxx . . $ rds_report_index_get_id(7cda95b454727dd1).(report);
959
960 struct oscap_sourcecxx . . $ oscap_source# *report_source = ds_rds_session_select_reportcxx . . $ ds_rds_session_select_report(e0b2d513013fe52d).(session, report_id);
961 if (report_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
962 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(report_it);
963 rds_asset_index_iterator_freecxx . . $ rds_asset_index_iterator_free(ef3bbd2d878f06c8).(asset_it);
964 ds_rds_session_freecxx . . $ ds_rds_session_free(f80cb7d7d6605f3a).(session);
965 goto cleanup;
966 }
967 oscap_document_type_tcxx . . $ oscap_document_type_t# report_source_type = oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(report_source);
968 if (report_source_type != OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) {
969 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(report_it);
970 rds_asset_index_iterator_freecxx . . $ rds_asset_index_iterator_free(ef3bbd2d878f06c8).(asset_it);
971 ds_rds_session_freecxx . . $ ds_rds_session_free(f80cb7d7d6605f3a).(session);
972 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(report_source);
973 goto cleanup;
974 }
975 struct xccdf_resultcxx . . $ xccdf_result# *xccdf_result = xccdf_result_import_sourcecxx . . $ xccdf_result_import_source(973913e43cf53496).(report_source);
976 if (xccdf_result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
977 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(report_it);
978 rds_asset_index_iterator_freecxx . . $ rds_asset_index_iterator_free(ef3bbd2d878f06c8).(asset_it);
979 ds_rds_session_freecxx . . $ ds_rds_session_free(f80cb7d7d6605f3a).(session);
980 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(report_source);
981 goto cleanup;
982 }
983 printfcxx . . $ printf(581fddd72a8db8fc).("\tARF report: %s\n", report_id);
984 printfcxx . . $ printf(581fddd72a8db8fc).("\t\tReport request: %s\n", report_request_id);
985 _print_xccdf_resultcxx . . $ _print_xccdf_result(360c1644ec2ae20).(xccdf_result, "\t");
986 xccdf_result_freecxx . . $ xccdf_result_free(731f9fbfcaef207c).(xccdf_result);
987 // oscap_source_free is not needed, it is already freed by xccdf_result_free
988
989 }
990 rds_report_index_iterator_freecxx . . $ rds_report_index_iterator_free(3beba17d79004ab6).(report_it);
991 }
992 rds_asset_index_iterator_freecxx . . $ rds_asset_index_iterator_free(ef3bbd2d878f06c8).(asset_it);
993 ds_rds_session_freecxx . . $ ds_rds_session_free(f80cb7d7d6605f3a).(session);
994 }
995 break;
996 case OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.:
997 if (action->profilecxx . . $ oscap_action#profile. && (action->list_rulescxx . . $ oscap_action#list_rules. || action->list_varscxx . . $ oscap_action#list_vars.)) {
998 struct oscap_sourcecxx . . $ oscap_source# *bench_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
999 struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = _resolve_benchmark_for_tailoringcxx . . $ _resolve_benchmark_for_tailoring(7321dc586dc8913d).(source, action->filecxx . . $ oscap_action#file., &bench_source);
1000 if (bench == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1001 goto cleanup;
1002 }
1003 struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_model = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(bench);
1004 /* Re-import tailoring with benchmark for proper profile resolution */
1005 struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(source, bench);
1006 if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1007 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
1008 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(bench_source);
1009 goto cleanup;
1010 }
1011 xccdf_policy_model_set_tailoringcxx . . $ xccdf_policy_model_set_tailoring(8231a1379b761ce0).(policy_model, tailoring);
1012 const char *profile_id = tailoring_get_profile_or_report_multiple_idscxx . . $ tailoring_get_profile_or_report_multiple_ids(409ed43a87d11ec4).(tailoring, action->profilecxx . . $ oscap_action#profile., action->filecxx . . $ oscap_action#file.);
1013 if (profile_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1014 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,
1015 "Profile '%s' not found in the tailoring file. Provide the customized profile ID. "
1016 "Get available profiles using:\n$ oscap info %s\n", action->profilecxx . . $ oscap_action#profile., action->filecxx . . $ oscap_action#file.);
1017 } else {
1018 if (action->list_rulescxx . . $ oscap_action#list_rules.) {
1019 _print_rules_for_profilecxx . . $ _print_rules_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
1020 } else {
1021 _print_vars_for_profilecxx . . $ _print_vars_for_profile(7c84e7be56876a5f).(policy_model, profile_id);
1022 }
1023 }
1024 xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(policy_model);
1025 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(bench_source);
1026 } else {
1027 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: XCCDF Tailoring\n");
1028 print_timecxx . . $ print_time(85c52e162fed56f9).(action->filecxx . . $ oscap_action#file.);
1029 _print_xccdf_tailoringcxx . . $ _print_xccdf_tailoring(3fa7154813674993).(source, "", 0);
1030 }
1031 break;
1032 case OSCAP_DOCUMENT_SCE_RESULTcxx . . $ OSCAP_DOCUMENT_SCE_RESULT.:
1033 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: SCE Result File\n");
1034 // Currently, we do not have any SCE result file parsing capabilities.
1035 break;
1036 case OSCAP_DOCUMENT_OCILcxx . . $ OSCAP_DOCUMENT_OCIL.:
1037 printfcxx . . $ printf(581fddd72a8db8fc).("Document type: OCIL Definitions file\n");
1038 // we don't support OCIL yet
1039 break;
1040 default:
1041 printfcxx . . $ printf(581fddd72a8db8fc).("Could not determine document type\n");
1042 goto cleanup;
1043 break;
1044 }
1045
1046 result = OSCAP_OKcxx . . $ OSCAP_OK.;
1047
1048 cleanup:
1049 oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source);
1050 oscap_print_errorcxx . . $ oscap_print_error(49f6e7a06ebc5aa8).();
1051
1052 return result;
1053 }
1054
1055 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_infocxx . . $ getopt_info(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action)
1056 {
1057 assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(action != NULL);
1058
1059 enum oscap_info_optscxx . . $ getopt_info(93e8ba72609212ff).oscap_info_opts# {
1060 OSCAP_INFO_OPT_REMOTE_RESOURCEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_REMOTE_RESOURCES.,
1061 OSCAP_INFO_OPT_LIST_RULEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_RULES.,
1062 OSCAP_INFO_OPT_LIST_VARScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_VARS.,
1063 OSCAP_INFO_OPT_LOCAL_FILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LOCAL_FILES.,
1064 OSCAP_INFO_OPT_PROFILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILE.,
1065 OSCAP_INFO_OPT_PROFILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILES.,
1066 OSCAP_INFO_OPT_REFERENCEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_REFERENCES.,
1067 OSCAP_INFO_OPT_VERBOSEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE.,
1068 OSCAP_INFO_OPT_VERBOSE_LOG_FILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE_LOG_FILE.,
1069 };
1070 /* Command-options */
1071 const struct optioncxx . . $ option# long_options[] = {
1072 {"fetch-remote-resources", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->remote_resourcescxx . . $ oscap_action#remote_resources., 1},
1073 {"list-rules", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, 0, OSCAP_INFO_OPT_LIST_RULEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_RULES.},
1074 {"list-vars", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, 0, OSCAP_INFO_OPT_LIST_VARScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_VARS.},
1075 {"local-files", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OSCAP_INFO_OPT_LOCAL_FILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LOCAL_FILES.},
1076 {"profile", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, 0, OSCAP_INFO_OPT_PROFILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILE.},
1077 {"profiles", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, 0, OSCAP_INFO_OPT_PROFILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILES.},
1078 {"references", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, 0, OSCAP_INFO_OPT_REFERENCEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_REFERENCES.},
1079 {"verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OSCAP_INFO_OPT_VERBOSEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE.},
1080 {"verbose-log-file", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OSCAP_INFO_OPT_VERBOSE_LOG_FILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE_LOG_FILE.},
1081 // end
1082 {0, 0, 0, 0}
1083 };
1084
1085 int c;
1086 while ((c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "", long_options, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != -1) {
1087 switch(c) {
1088 case 0: break;
1089 case OSCAP_INFO_OPT_LIST_RULEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_RULES.:
1090 action->list_rulescxx . . $ oscap_action#list_rules. = 1;
1091 action->provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output. = 1;
1092 break;
1093 case OSCAP_INFO_OPT_LIST_VARScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LIST_VARS.:
1094 action->list_varscxx . . $ oscap_action#list_vars. = 1;
1095 action->provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output. = 1;
1096 break;
1097 case OSCAP_INFO_OPT_PROFILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILE.:
1098 action->profilecxx . . $ oscap_action#profile. = optargcxx . . $ optarg.;
1099 break;
1100 case OSCAP_INFO_OPT_PROFILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_PROFILES.:
1101 action->show_profiles_onlycxx . . $ oscap_action#show_profiles_only. = 1;
1102 action->provide_machine_readable_outputcxx . . $ oscap_action#provide_machine_readable_output. = 1;
1103 break;
1104 case OSCAP_INFO_OPT_LOCAL_FILEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_LOCAL_FILES.:
1105 action->local_filescxx . . $ oscap_action#local_files. = optargcxx . . $ optarg.;
1106 break;
1107 case OSCAP_INFO_OPT_REFERENCEScxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_REFERENCES.:
1108 action->referencescxx . . $ oscap_action#references. = 1;
1109 break;
1110 case OSCAP_INFO_OPT_VERBOSEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE.:
1111 action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.;
1112 break;
1113 case OSCAP_INFO_OPT_VERBOSE_LOG_FILEcxx . . $ getopt_info(93e8ba72609212ff).OSCAP_INFO_OPT_VERBOSE_LOG_FILE.:
1114 action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.;
1115 break;
1116 default: return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1117 }
1118 }
1119
1120 if (action->list_rulescxx . . $ oscap_action#list_rules. && action->profilecxx . . $ oscap_action#profile. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1121 oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The --list-rules option requires --profile.\n");
1122 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1123 }
1124
1125 if (action->list_varscxx . . $ oscap_action#list_vars. && action->profilecxx . . $ oscap_action#profile. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1126 oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The --list-vars option requires --profile.\n");
1127 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1128 }
1129
1130 if (action->list_rulescxx . . $ oscap_action#list_rules. && action->list_varscxx . . $ oscap_action#list_vars.) {
1131 oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "The --list-rules and --list-vars options can't be used at the same time.\n");
1132 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1133 }
1134
1135 if (optindcxx . . $ optind. >= argc) {
1136 oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "SCAP file needs to be specified!\n");
1137 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1138 }
1139
1140 action->filecxx . . $ oscap_action#file. = argv[optindcxx . . $ optind.];
1141
1142 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1143 }