| 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 | * Maros Barabas <[email protected]> |
| 21 | * Šimon Lukašík |
| 22 | */ |
| 23 | |
| 24 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`! |
| 25 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 26 | #endif |
| 27 | |
| 28 | /* OVAL & OSCAP common */ |
| 29 | #include "oscap_source.h"cxx . . $ `<file>/src/source/public/oscap_source.h`/ |
| 30 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 31 | # include <oval_probe.h>cxx . . $ `<file>/src/OVAL/public/oval_probe.h`/ |
| 32 | # include "probe-table.h"cxx . . $ `<file>/src/OVAL/probes/public/probe-table.h`/ |
| 33 | #endif |
| 34 | #include <oval_agent_api.h>cxx . . $ `<file>/src/OVAL/public/oval_agent_api.h`/ |
| 35 | #include <oval_session.h>cxx . . $ `<file>/src/OVAL/public/oval_session.h`/ |
| 36 | #include <oval_results.h>cxx . . $ `<file>/src/OVAL/public/oval_results.h`/ |
| 37 | #include <oval_variables.h>cxx . . $ `<file>/src/OVAL/public/oval_variables.h`/ |
| 38 | #include <ds_sds_session.h>cxx . . $ `<file>/src/DS/public/ds_sds_session.h`/ |
| 39 | #include <assert.h> |
| 40 | #include <limits.h> |
| 41 | #ifdef HAVE_GETOPT_Hcxx . . $ `build/config.h:79:9`! |
| 42 | #include <getopt.h> |
| 43 | #endif |
| 44 | |
| 45 | #include "oscap-tool.h"cxx . . $ `<file>/utils/oscap-tool.h`/ |
| 46 | #include "scap_ds.h"cxx . . $ `<file>/src/DS/public/scap_ds.h`/ |
| 47 | #include <oscap_debug.h>cxx . . $ `<file>/src/common/public/oscap_debug.h`/ |
| 48 | |
| 49 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 50 | static int app_collect_ovalcxx . . $ app_collect_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 51 | static int app_evaluate_ovalcxx . . $ app_evaluate_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 52 | #endif |
| 53 | static int app_oval_validatecxx . . $ app_oval_validate(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 54 | static int app_oval_xsltcxx . . $ app_oval_xslt(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 55 | static int app_analyse_ovalcxx . . $ app_analyse_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 56 | |
| 57 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 58 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_evalcxx . . $ getopt_oval_eval(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action); |
| 59 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_collectcxx . . $ getopt_oval_collect(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action); |
| 60 | #endif |
| 61 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_analysecxx . . $ getopt_oval_analyse(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action); |
| 62 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_validatecxx . . $ getopt_oval_validate(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action); |
| 63 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_reportcxx . . $ getopt_oval_report(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action); |
| 64 | |
| 65 | |
| 66 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! valid_inputscxx . . $ valid_inputs(75dc19912e29b9f2).(const struct oscap_actioncxx . . $ oscap_action# *action); |
| 67 | |
| 68 | #define OVAL_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:68:9`! 7 |
| 69 | #define OVAL_GEN_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:69:9`! 2 /* See actual OVAL_GEN_SUBMODULES and |
| 70 | OVAL_SUBMODULES arrays initialization below. */ |
| 71 | static struct oscap_modulecxx . . $ oscap_module#* OVAL_SUBMODULEScxx . . $ OVAL_SUBMODULES.[OVAL_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:68:9`!]; |
| 72 | static struct oscap_modulecxx . . $ oscap_module#* OVAL_GEN_SUBMODULEScxx . . $ OVAL_GEN_SUBMODULES.[OVAL_GEN_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:69:9`!]; |
| 73 | |
| 74 | struct oscap_modulecxx . . $ oscap_module# OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE. = { |
| 75 | .name = "oval", |
| 76 | .parent = &OSCAP_ROOT_MODULEcxx . . $ OSCAP_ROOT_MODULE., |
| 77 | .summary = "Open Vulnerability and Assessment Language", |
| 78 | .submodules = OVAL_SUBMODULEScxx . . $ OVAL_SUBMODULES. |
| 79 | }; |
| 80 | |
| 81 | static struct oscap_modulecxx . . $ oscap_module# OVAL_VALIDATEcxx . . $ OVAL_VALIDATE. = { |
| 82 | .name = "validate", |
| 83 | .parent = &OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE., |
| 84 | .summary = "Validate OVAL XML content", |
| 85 | .usage = "[options] oval-file.xml", |
| 86 | .help = |
| 87 | "Options:\n" |
| 88 | " --definitions - Validate OVAL Definitions\n" |
| 89 | " --variables - Validate external OVAL Variables\n" |
| 90 | " --syschar - Validate OVAL System Characteristics\n" |
| 91 | " --results - Validate OVAL Results\n" |
| 92 | " --skip-schematron - Do not use schematron-based validation in addition to XML Schema\n" |
| 93 | " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n" |
| 94 | " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n" |
| 95 | " --verbose-log-file <file> - Write verbose information into file.\n", |
| 96 | .opt_parser = getopt_oval_validatecxx . . $ getopt_oval_validate(93e8ba72609212ff)., |
| 97 | .func = app_oval_validatecxx . . $ app_oval_validate(d99c68634f61e371). |
| 98 | }; |
| 99 | |
| 100 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 101 | static struct oscap_modulecxx . . $ oscap_module# OVAL_EVALcxx . . $ OVAL_EVAL. = { |
| 102 | .name = "eval", |
| 103 | .parent = &OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE., |
| 104 | .summary = "Probe the system and evaluate definitions from OVAL Definition file", |
| 105 | .usage = "[options] oval-definitions.xml", |
| 106 | .help = |
| 107 | "Options:\n" |
| 108 | " --id <definition-id> - ID of the definition we want to evaluate.\n" |
| 109 | " --variables <file> - Provide external variables expected by OVAL Definitions.\n" |
| 110 | " --directives <file> - Use OVAL Directives content to specify desired results content.\n" |
| 111 | " --without-syschar - Don't provide system characteristic in result file.\n" |
| 112 | " --results <file> - Write OVAL Results into file.\n" |
| 113 | " --report <file> - Create human readable (HTML) report from OVAL Results.\n" |
| 114 | " --skip-validation - Skip validation.\n" |
| 115 | " --datastream-id <id> - ID of the data stream in the collection to use.\n" |
| 116 | " (only applicable for source data streams)\n" |
| 117 | " --oval-id <id> - ID of the OVAL component ref in the data stream to use.\n" |
| 118 | " (only applicable for source data streams)\n" |
| 119 | " --fetch-remote-resources - Download remote content referenced by OVAL Definitions.\n" |
| 120 | " (only applicable for source data streams)\n" |
| 121 | " --local-files <dir> - Use locally downloaded copies of remote resources stored in the given directory.\n" |
| 122 | " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n" |
| 123 | " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n" |
| 124 | " --verbose-log-file <file> - Write verbose information into file.\n", |
| 125 | .opt_parser = getopt_oval_evalcxx . . $ getopt_oval_eval(93e8ba72609212ff)., |
| 126 | .func = app_evaluate_ovalcxx . . $ app_evaluate_oval(d99c68634f61e371). |
| 127 | }; |
| 128 | |
| 129 | static struct oscap_modulecxx . . $ oscap_module# OVAL_COLLECTcxx . . $ OVAL_COLLECT. = { |
| 130 | .name = "collect", |
| 131 | .parent = &OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE., |
| 132 | .summary = "Probe the system and create system characteristics", |
| 133 | .usage = "[options] oval-definitions.xml", |
| 134 | .help = |
| 135 | "Options:\n" |
| 136 | " --id <object> - Collect system characteristics ONLY for specified OVAL Object.\n" |
| 137 | " --syschar <file> - Write OVAL System Characteristic into file.\n" |
| 138 | " --variables <file> - Provide external variables expected by OVAL Definitions.\n" |
| 139 | " --skip-validation - Skip validation.\n" |
| 140 | " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n" |
| 141 | " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n" |
| 142 | " --verbose-log-file <file> - Write verbose information into file.\n", |
| 143 | .opt_parser = getopt_oval_collectcxx . . $ getopt_oval_collect(93e8ba72609212ff)., |
| 144 | .func = app_collect_ovalcxx . . $ app_collect_oval(d99c68634f61e371). |
| 145 | }; |
| 146 | #endif /* OVAL_PROBES_ENABLED */ |
| 147 | |
| 148 | static struct oscap_modulecxx . . $ oscap_module# OVAL_ANALYSEcxx . . $ OVAL_ANALYSE. = { |
| 149 | .name = "analyse", |
| 150 | .parent = &OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE., |
| 151 | .summary = "Evaluate provided system characteristics file", |
| 152 | .usage = "[options] --results FILE oval-definitions.xml system-characteristics.xml" , |
| 153 | .help = |
| 154 | "Options:\n" |
| 155 | " --variables <file> - Provide external variables expected by OVAL Definitions.\n" |
| 156 | " --directives <file> - Use OVAL Directives content to specify desired results content.\n" |
| 157 | " --skip-validation - Skip validation.\n" |
| 158 | " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n" |
| 159 | " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n" |
| 160 | " --verbose-log-file <file> - Write verbose information into file.\n", |
| 161 | .opt_parser = getopt_oval_analysecxx . . $ getopt_oval_analyse(93e8ba72609212ff)., |
| 162 | .func = app_analyse_ovalcxx . . $ app_analyse_oval(d99c68634f61e371). |
| 163 | }; |
| 164 | |
| 165 | static struct oscap_modulecxx . . $ oscap_module# OVAL_GENERATEcxx . . $ OVAL_GENERATE. = { |
| 166 | .name = "generate", |
| 167 | .parent = &OSCAP_OVAL_MODULEcxx . . $ OSCAP_OVAL_MODULE., |
| 168 | .summary = "Convert an OVAL file to other formats", |
| 169 | .usage_extra = "<subcommand> [sub-options] oval-file.xml", |
| 170 | .submodules = OVAL_GEN_SUBMODULEScxx . . $ OVAL_GEN_SUBMODULES. |
| 171 | }; |
| 172 | |
| 173 | static struct oscap_modulecxx . . $ oscap_module# OVAL_REPORTcxx . . $ OVAL_REPORT. = { |
| 174 | .name = "report", |
| 175 | .parent = &OVAL_GENERATEcxx . . $ OVAL_GENERATE., |
| 176 | .summary = "Generate a HTML report from OVAL results file", |
| 177 | .usage = "[options] oval-file.xml", |
| 178 | .help = |
| 179 | "Options:\n" |
| 180 | " --output <file> - Write the HTML into file.\n" |
| 181 | " --verbose <verbosity_level> - Turn on verbose mode at specified verbosity level.\n" |
| 182 | " Verbosity level must be one of: DEVEL, INFO, WARNING, ERROR.\n" |
| 183 | " --verbose-log-file <file> - Write verbose information into file.\n", |
| 184 | .opt_parser = getopt_oval_reportcxx . . $ getopt_oval_report(93e8ba72609212ff)., |
| 185 | .user = "oval-results-report.xsl", |
| 186 | .func = app_oval_xsltcxx . . $ app_oval_xslt(d99c68634f61e371). |
| 187 | }; |
| 188 | |
| 189 | static struct oscap_modulecxx . . $ oscap_module#* OVAL_GEN_SUBMODULEScxx . . $ OVAL_GEN_SUBMODULES.[OVAL_GEN_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:69:9`!] = { |
| 190 | &OVAL_REPORTcxx . . $ OVAL_REPORT., |
| 191 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 192 | }; |
| 193 | |
| 194 | static struct oscap_modulecxx . . $ oscap_module#* OVAL_SUBMODULEScxx . . $ OVAL_SUBMODULES.[OVAL_SUBMODULES_NUMcxx . . $ `utils/oscap-oval.c:68:9`!] = { |
| 195 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 196 | &OVAL_COLLECTcxx . . $ OVAL_COLLECT., |
| 197 | &OVAL_EVALcxx . . $ OVAL_EVAL., |
| 198 | #endif |
| 199 | &OVAL_ANALYSEcxx . . $ OVAL_ANALYSE., |
| 200 | &OVAL_VALIDATEcxx . . $ OVAL_VALIDATE., |
| 201 | &OVAL_GENERATEcxx . . $ OVAL_GENERATE., |
| 202 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 203 | }; |
| 204 | |
| 205 | static int app_oval_callbackcxx . . $ app_oval_callback(735737ec58298ef4).(const struct oval_result_definitioncxx . . $ oval_result_definition# * res_def, void *arg) |
| 206 | { |
| 207 | oval_result_tcxx . . $ oval_result_t# result = oval_result_definition_get_resultcxx . . $ oval_result_definition_get_result(bf198161c66a91c).(res_def); |
| 208 | |
| 209 | printfcxx . . $ printf(581fddd72a8db8fc).("Definition %s: %s\n", oval_result_definition_get_idcxx . . $ oval_result_definition_get_id(2b67139a5c095845).(res_def), oval_result_get_textcxx . . $ oval_result_get_text(889be41b1f382b15).(result)); |
| 210 | |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 215 | int app_collect_ovalcxx . . $ app_collect_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action) |
| 216 | { |
| 217 | struct oval_definition_modelcxx . . $ oval_definition_model# *def_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 218 | struct oval_variable_modelcxx . . $ oval_variable_model# *var_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 219 | struct oval_syschar_modelcxx . . $ oval_syschar_model# *sys_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 220 | struct oval_sysinfocxx . . $ oval_sysinfo# *sysinfo = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 221 | struct oval_probe_sessioncxx . . $ oval_probe_session# *pb_sess = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 222 | struct oval_generatorcxx . . $ oval_generator# *generator = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 223 | int ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.; |
| 224 | |
| 225 | /* validate inputs */ |
| 226 | if (action->validatecxx . . $ oscap_action#validate.) { |
| 227 | if (!valid_inputscxx . . $ valid_inputs(75dc19912e29b9f2).(action)) { |
| 228 | goto cleanup; |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /* import definitions */ |
| 233 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 234 | def_model = oval_definition_model_import_sourcecxx . . $ oval_definition_model_import_source(5c1ce95823108a2f).(source); |
| 235 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 236 | if (def_model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 237 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to import the OVAL Definitions from '%s'.\n", action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 238 | goto cleanup; |
| 239 | } |
| 240 | |
| 241 | /* bind external variables */ |
| 242 | if(action->f_variablescxx . . $ oscap_action#f_variables.) { |
| 243 | struct oscap_sourcecxx . . $ oscap_source# *var_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_variablescxx . . $ oscap_action#f_variables.); |
| 244 | var_model = oval_variable_model_import_sourcecxx . . $ oval_variable_model_import_source(46e0a903906bd39).(var_source); |
| 245 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(var_source); |
| 246 | if (var_model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 247 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to import the OVAL Variables from '%s'.\n", action->f_variablescxx . . $ oscap_action#f_variables.); |
| 248 | goto cleanup; |
| 249 | } |
| 250 | |
| 251 | if (oval_definition_model_bind_variable_modelcxx . . $ oval_definition_model_bind_variable_model(92d91b6d8ac81b76).(def_model, var_model)) { |
| 252 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to bind Variables to Definitions\n"); |
| 253 | goto cleanup; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | /* create empty syschar model */ |
| 258 | sys_model = oval_syschar_model_newcxx . . $ oval_syschar_model_new(d79d001762efdcf0).(def_model); |
| 259 | |
| 260 | /* set product name */ |
| 261 | generator = oval_syschar_model_get_generatorcxx . . $ oval_syschar_model_get_generator(21029f2f75a872d9).(sys_model); |
| 262 | oval_generator_set_product_namecxx . . $ oval_generator_set_product_name(d0f30efbc7b1d2fc).(generator, OSCAP_PRODUCTNAMEcxx . . $ `utils/oscap-tool.h:49:9`!); |
| 263 | |
| 264 | /* create probe session */ |
| 265 | pb_sess = oval_probe_session_newcxx . . $ oval_probe_session_new(fb0659dc1a6483df).(sys_model); |
| 266 | |
| 267 | /* query sysinfo */ |
| 268 | ret = oval_probe_query_sysinfocxx . . $ oval_probe_query_sysinfo(ce5e9922ccd2f8c3).(pb_sess, &sysinfo); |
| 269 | if (ret != 0) { |
| 270 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to query sysinfo\n"); |
| 271 | goto cleanup; |
| 272 | } |
| 273 | oval_syschar_model_set_sysinfocxx . . $ oval_syschar_model_set_sysinfo(c33b64abd6c20cc1).(sys_model, sysinfo); |
| 274 | |
| 275 | /* query objects */ |
| 276 | struct oval_objectcxx . . $ oval_object# *object; |
| 277 | struct oval_syscharcxx . . $ oval_syschar# *syschar; |
| 278 | oval_syschar_collection_flag_tcxx . . $ oval_syschar_collection_flag_t# sc_flg; |
| 279 | if (action->idcxx . . $ oscap_action#id.) { |
| 280 | object = oval_definition_model_get_objectcxx . . $ oval_definition_model_get_object(2c583c84850ee973).(def_model, action->idcxx . . $ oscap_action#id.); |
| 281 | if (!object) { |
| 282 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Object ID(%s) does not exist in '%s'.\n", action->idcxx . . $ oscap_action#id., action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 283 | goto cleanup; |
| 284 | } |
| 285 | printfcxx . . $ printf(581fddd72a8db8fc).("Collected: \"%s\" : ", oval_object_get_idcxx . . $ oval_object_get_id(c789946d38fecc83).(object)); |
| 286 | oval_probe_query_objectcxx . . $ oval_probe_query_object(c2fefbf93109479a).(pb_sess, object, 0, &syschar); |
| 287 | sc_flg = oval_syschar_get_flagcxx . . $ oval_syschar_get_flag(faee96ff7b702646).(syschar); |
| 288 | printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", oval_syschar_collection_flag_get_textcxx . . $ oval_syschar_collection_flag_get_text(5fdf4cba2f095175).(sc_flg)); |
| 289 | } |
| 290 | else { |
| 291 | struct oval_object_iteratorcxx . . $ oval_object_iterator# *objects = oval_definition_model_get_objectscxx . . $ oval_definition_model_get_objects(cc9da3ec60e09d96).(def_model); |
| 292 | while (oval_object_iterator_has_morecxx . . $ oval_object_iterator_has_more(9147d04dca65c7).(objects)) { |
| 293 | object = oval_object_iterator_nextcxx . . $ oval_object_iterator_next(85e8e8a3fd76bfb).(objects); |
| 294 | printfcxx . . $ printf(581fddd72a8db8fc).("Collected: \"%s\" : ", oval_object_get_idcxx . . $ oval_object_get_id(c789946d38fecc83).(object)); |
| 295 | oval_probe_query_objectcxx . . $ oval_probe_query_object(c2fefbf93109479a).(pb_sess, object, 0, &syschar); |
| 296 | sc_flg = oval_syschar_get_flagcxx . . $ oval_syschar_get_flag(faee96ff7b702646).(syschar); |
| 297 | printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", oval_syschar_collection_flag_get_textcxx . . $ oval_syschar_collection_flag_get_text(5fdf4cba2f095175).(sc_flg)); |
| 298 | } |
| 299 | oval_object_iterator_freecxx . . $ oval_object_iterator_free(bcb47d61bf2b3914).(objects); |
| 300 | } |
| 301 | |
| 302 | const char* full_validation = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_FULL_VALIDATION"); |
| 303 | |
| 304 | /* output */ |
| 305 | if (action->f_syscharcxx . . $ oscap_action#f_syschar. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 306 | /* export OVAL System Characteristics */ |
| 307 | oval_syschar_model_exportcxx . . $ oval_syschar_model_export(1b3164c5e7a9e690).(sys_model, action->f_syscharcxx . . $ oscap_action#f_syschar.); |
| 308 | |
| 309 | /* validate OVAL System Characteristics */ |
| 310 | if (action->validatecxx . . $ oscap_action#validate. && full_validation) { |
| 311 | struct oscap_sourcecxx . . $ oscap_source# *syschar_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_syscharcxx . . $ oscap_action#f_syschar.); |
| 312 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(syschar_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *)action)) { |
| 313 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(syschar_source); |
| 314 | goto cleanup; |
| 315 | } |
| 316 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "OVAL System Characteristics are exported correctly.\n"); |
| 317 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(syschar_source); |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | ret = OSCAP_OKcxx . . $ OSCAP_OK.; |
| 322 | |
| 323 | cleanup: |
| 324 | if(oscap_errcxx . . $ oscap_err(c9857a73d68e59ba).()) |
| 325 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s %s\n", OSCAP_ERR_MSGcxx . . $ `utils/oscap-tool.h:50:9`!, oscap_err_desccxx . . $ oscap_err_desc(33a1f659e94feb42).()); |
| 326 | |
| 327 | if (sysinfo) oval_sysinfo_freecxx . . $ oval_sysinfo_free(d47d2e57c195a0d4).(sysinfo); |
| 328 | if (pb_sess) oval_probe_session_destroycxx . . $ oval_probe_session_destroy(7340ff736dc09416).(pb_sess); |
| 329 | if (sys_model) oval_syschar_model_freecxx . . $ oval_syschar_model_free(acc422d4d96f4be6).(sys_model); |
| 330 | if (def_model) oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model); |
| 331 | |
| 332 | return ret; |
| 333 | } |
| 334 | |
| 335 | int app_evaluate_ovalcxx . . $ app_evaluate_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action) |
| 336 | { |
| 337 | struct oval_sessioncxx . . $ oval_session# *session = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 338 | oval_result_tcxx . . $ oval_result_t# eval_result; |
| 339 | int ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.; |
| 340 | |
| 341 | /* create a new OVAL session */ |
| 342 | if ((session = oval_session_newcxx . . $ oval_session_new(7e5bcee7aed03c6).(action->f_ovalcxx . . $ oscap_action#f_oval.)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 343 | oscap_print_errorcxx . . $ oscap_print_error(49f6e7a06ebc5aa8).(); |
| 344 | return ret; |
| 345 | } |
| 346 | |
| 347 | /* set validation level */ |
| 348 | oval_session_set_validationcxx . . $ oval_session_set_validation(94f71ae260bf6161).(session, action->validatecxx . . $ oscap_action#validate., getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_FULL_VALIDATION") != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 349 | |
| 350 | /* set source DS related IDs */ |
| 351 | oval_session_set_datastream_idcxx . . $ oval_session_set_datastream_id(c30ebac49622957).(session, action->f_datastream_idcxx . . $ oscap_action#f_datastream_id.); |
| 352 | oval_session_set_component_idcxx . . $ oval_session_set_component_id(c30ebac49622957).(session, action->f_oval_idcxx . . $ oscap_action#f_oval_id.); |
| 353 | |
| 354 | /* set reporter function for XML validation of inputs and outputs */ |
| 355 | oval_session_set_xml_reportercxx . . $ oval_session_set_xml_reporter(bd6c795d022aee50).(session, reportercxx . . $ reporter(710d628f83af7da6).); |
| 356 | |
| 357 | /* set OVAL Variables */ |
| 358 | oval_session_set_variablescxx . . $ oval_session_set_variables(c30ebac49622957).(session, action->f_variablescxx . . $ oscap_action#f_variables.); |
| 359 | |
| 360 | oval_session_configure_remote_resourcescxx . . $ oval_session_configure_remote_resources(aff8698e1152fdfc).(session, action->remote_resourcescxx . . $ oscap_action#remote_resources., action->local_filescxx . . $ oscap_action#local_files., download_reporting_callbackcxx . . $ download_reporting_callback(3ca54e6407cd3d15).); |
| 361 | /* load all necesary OVAL Definitions and bind OVAL Variables if provided */ |
| 362 | if ((oval_session_loadcxx . . $ oval_session_load(f27a3c4c3b1f0f09).(session)) != 0) |
| 363 | goto cleanup; |
| 364 | |
| 365 | /* evaluation */ |
| 366 | if (action->idcxx . . $ oscap_action#id.) { |
| 367 | if ((oval_session_evaluate_idcxx . . $ oval_session_evaluate_id(b26c66e0bbe4a772).(session, action->idcxx . . $ oscap_action#id., &eval_result)) != 0) |
| 368 | goto cleanup; |
| 369 | printfcxx . . $ printf(581fddd72a8db8fc).("Definition %s: %s\n", action->idcxx . . $ oscap_action#id., oval_result_get_textcxx . . $ oval_result_get_text(889be41b1f382b15).(eval_result)); |
| 370 | } |
| 371 | else { |
| 372 | if ((oval_session_evaluatecxx . . $ oval_session_evaluate(64e19f7148ea5ac9).(session, app_oval_callbackcxx . . $ app_oval_callback(735737ec58298ef4)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != 0) |
| 373 | goto cleanup; |
| 374 | } |
| 375 | |
| 376 | printfcxx . . $ printf(581fddd72a8db8fc).("Evaluation done.\n"); |
| 377 | |
| 378 | oval_session_set_directivescxx . . $ oval_session_set_directives(c30ebac49622957).(session, action->f_directivescxx . . $ oscap_action#f_directives.); |
| 379 | oval_session_set_results_exportcxx . . $ oval_session_set_results_export(c30ebac49622957).(session, action->f_resultscxx . . $ oscap_action#f_results.); |
| 380 | oval_session_set_report_exportcxx . . $ oval_session_set_report_export(c30ebac49622957).(session, action->f_reportcxx . . $ oscap_action#f_report.); |
| 381 | oval_session_set_export_system_characteristicscxx . . $ oval_session_set_export_system_characteristics(70bc3799e9300764).(session, !action->without_sys_charscxx . . $ oscap_action#without_sys_chars.); |
| 382 | if (oval_session_exportcxx . . $ oval_session_export(f27a3c4c3b1f0f09).(session) != 0) |
| 383 | goto cleanup; |
| 384 | |
| 385 | ret = OSCAP_OKcxx . . $ OSCAP_OK.; |
| 386 | |
| 387 | cleanup: |
| 388 | oscap_print_errorcxx . . $ oscap_print_error(49f6e7a06ebc5aa8).(); |
| 389 | oval_session_freecxx . . $ oval_session_free(11614b9dd32fc055).(session); |
| 390 | return ret; |
| 391 | } |
| 392 | #endif /* OVAL_PROBES_ENABLED */ |
| 393 | |
| 394 | static int app_analyse_ovalcxx . . $ app_analyse_oval(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action) { |
| 395 | struct oval_definition_modelcxx . . $ oval_definition_model# *def_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 396 | struct oval_syschar_modelcxx . . $ oval_syschar_model# *sys_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 397 | struct oval_results_modelcxx . . $ oval_results_model# *res_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 398 | struct oval_variable_modelcxx . . $ oval_variable_model# *var_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 399 | struct oval_directives_modelcxx . . $ oval_directives_model# *dir_model = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 400 | struct oval_syschar_modelcxx . . $ oval_syschar_model# *sys_models[2]; |
| 401 | struct oval_generatorcxx . . $ oval_generator# *generator = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 402 | int ret = OSCAP_ERRORcxx . . $ OSCAP_ERROR.; |
| 403 | |
| 404 | /* validate inputs */ |
| 405 | if (action->validatecxx . . $ oscap_action#validate.) { |
| 406 | if (!valid_inputscxx . . $ valid_inputs(75dc19912e29b9f2).(action)) { |
| 407 | goto cleanup; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | /* load defnitions */ |
| 412 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 413 | def_model = oval_definition_model_import_sourcecxx . . $ oval_definition_model_import_source(5c1ce95823108a2f).(source); |
| 414 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 415 | if (def_model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 416 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to import the OVAL Definitions from '%s'.\n", action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 417 | goto cleanup; |
| 418 | } |
| 419 | |
| 420 | /* bind external variables */ |
| 421 | if(action->f_variablescxx . . $ oscap_action#f_variables.) { |
| 422 | struct oscap_sourcecxx . . $ oscap_source# *var_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_variablescxx . . $ oscap_action#f_variables.); |
| 423 | var_model = oval_variable_model_import_sourcecxx . . $ oval_variable_model_import_source(46e0a903906bd39).(var_source); |
| 424 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(var_source); |
| 425 | if (var_model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 426 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to import the OVAL Variables from '%s'.\n", action->f_variablescxx . . $ oscap_action#f_variables.); |
| 427 | goto cleanup; |
| 428 | } |
| 429 | |
| 430 | if (oval_definition_model_bind_variable_modelcxx . . $ oval_definition_model_bind_variable_model(92d91b6d8ac81b76).(def_model, var_model)) { |
| 431 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to bind Variables to Definitions\n"); |
| 432 | goto cleanup; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | /* load system characteristics */ |
| 437 | sys_model = oval_syschar_model_newcxx . . $ oval_syschar_model_new(d79d001762efdcf0).(def_model); |
| 438 | source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_syscharcxx . . $ oscap_action#f_syschar.); |
| 439 | if (oval_syschar_model_import_sourcecxx . . $ oval_syschar_model_import_source(99495a0a1929cf02).(sys_model, source) == -1 ) { |
| 440 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to import the System Characteristics from '%s'.\n", action->f_syscharcxx . . $ oscap_action#f_syschar.); |
| 441 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 442 | goto cleanup; |
| 443 | } |
| 444 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 445 | |
| 446 | /* evaluate */ |
| 447 | sys_models[0] = sys_model; |
| 448 | sys_models[1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 449 | res_model = oval_results_model_newcxx . . $ oval_results_model_new(138538a275af4028).(def_model, sys_models); |
| 450 | |
| 451 | /* set product name */ |
| 452 | generator = oval_results_model_get_generatorcxx . . $ oval_results_model_get_generator(360f5a6d42af23f).(res_model); |
| 453 | oval_generator_set_product_namecxx . . $ oval_generator_set_product_name(d0f30efbc7b1d2fc).(generator, OSCAP_PRODUCTNAMEcxx . . $ `utils/oscap-tool.h:49:9`!); |
| 454 | oval_generator_set_product_versioncxx . . $ oval_generator_set_product_version(d0f30efbc7b1d2fc).(generator, oscap_get_versioncxx . . $ oscap_get_version(33a1f659e94feb42).()); |
| 455 | |
| 456 | oval_results_model_evalcxx . . $ oval_results_model_eval(f7a69e1de64a2ed5).(res_model); |
| 457 | |
| 458 | /* export results */ |
| 459 | if (action->f_resultscxx . . $ oscap_action#f_results. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 460 | /* import directives */ |
| 461 | if (action->f_directivescxx . . $ oscap_action#f_directives. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 462 | dir_model = oval_directives_model_newcxx . . $ oval_directives_model_new(3f85e657173754f7).(); |
| 463 | struct oscap_sourcecxx . . $ oscap_source# *dir_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_directivescxx . . $ oscap_action#f_directives.); |
| 464 | oval_directives_model_import_sourcecxx . . $ oval_directives_model_import_source(a58cf06db02a42f2).(dir_model, dir_source); |
| 465 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(dir_source); |
| 466 | } |
| 467 | |
| 468 | /* export result model to XML */ |
| 469 | oval_results_model_exportcxx . . $ oval_results_model_export(8109b64d105a44e8).(res_model, dir_model, action->f_resultscxx . . $ oscap_action#f_results.); |
| 470 | |
| 471 | const char* full_validation = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_FULL_VALIDATION"); |
| 472 | |
| 473 | /* validate OVAL Results */ |
| 474 | if (action->validatecxx . . $ oscap_action#validate. && full_validation) { |
| 475 | struct oscap_sourcecxx . . $ oscap_source# *result_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_resultscxx . . $ oscap_action#f_results.); |
| 476 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(result_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action)) { |
| 477 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(result_source); |
| 478 | goto cleanup; |
| 479 | } |
| 480 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "OVAL Results are exported correctly.\n"); |
| 481 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(result_source); |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | ret = OSCAP_OKcxx . . $ OSCAP_OK.; |
| 486 | |
| 487 | /* clean up */ |
| 488 | cleanup: |
| 489 | if(oscap_errcxx . . $ oscap_err(c9857a73d68e59ba).()) |
| 490 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s %s\n", OSCAP_ERR_MSGcxx . . $ `utils/oscap-tool.h:50:9`!, oscap_err_desccxx . . $ oscap_err_desc(33a1f659e94feb42).()); |
| 491 | |
| 492 | if(res_model) oval_results_model_freecxx . . $ oval_results_model_free(47fd98aca0b86b70).(res_model); |
| 493 | if(sys_model) oval_syschar_model_freecxx . . $ oval_syschar_model_free(acc422d4d96f4be6).(sys_model); |
| 494 | if(def_model) oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model); |
| 495 | if(dir_model) oval_directives_model_freecxx . . $ oval_directives_model_free(89931e7170a08f7).(dir_model); |
| 496 | |
| 497 | return ret; |
| 498 | } |
| 499 | |
| 500 | static int app_oval_xsltcxx . . $ app_oval_xslt(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action) |
| 501 | { |
| 502 | assertcxx . . $ `/usr/include/assert.h:50:10`!(action->module->user); |
| 503 | return app_xsltcxx . . $ app_xslt(94a5cfe74efaac1c).(action->f_ovalcxx . . $ oscap_action#f_oval., action->modulecxx . . $ oscap_action#module.->usercxx . . $ oscap_module#user., action->f_resultscxx . . $ oscap_action#f_results., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 504 | } |
| 505 | |
| 506 | enum oval_optcxx . . $ oval_opt# { |
| 507 | OVAL_OPT_RESULT_FILEcxx . . $ OVAL_OPT_RESULT_FILE. = 1, |
| 508 | OVAL_OPT_REPORT_FILEcxx . . $ OVAL_OPT_REPORT_FILE., |
| 509 | OVAL_OPT_IDcxx . . $ OVAL_OPT_ID., |
| 510 | OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES., |
| 511 | OVAL_OPT_SYSCHARcxx . . $ OVAL_OPT_SYSCHAR., |
| 512 | OVAL_OPT_DIRECTIVEScxx . . $ OVAL_OPT_DIRECTIVES., |
| 513 | OVAL_OPT_DATASTREAM_IDcxx . . $ OVAL_OPT_DATASTREAM_ID., |
| 514 | OVAL_OPT_OVAL_IDcxx . . $ OVAL_OPT_OVAL_ID., |
| 515 | OVAL_OPT_OUTPUTcxx . . $ OVAL_OPT_OUTPUT. = 'o', |
| 516 | OVAL_OPT_LOCAL_FILEScxx . . $ OVAL_OPT_LOCAL_FILES., |
| 517 | OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE., |
| 518 | OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE., |
| 519 | }; |
| 520 | |
| 521 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 522 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_evalcxx . . $ getopt_oval_eval(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action) |
| 523 | { |
| 524 | action->doctypecxx . . $ oscap_action#doctype. = OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.; |
| 525 | |
| 526 | /* Command-options */ |
| 527 | struct optioncxx . . $ option# long_options[] = { |
| 528 | { "results", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_RESULT_FILEcxx . . $ OVAL_OPT_RESULT_FILE. }, |
| 529 | { "report", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_REPORT_FILEcxx . . $ OVAL_OPT_REPORT_FILE. }, |
| 530 | { "id", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_IDcxx . . $ OVAL_OPT_ID. }, |
| 531 | { "variables", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES. }, |
| 532 | { "directives", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_DIRECTIVEScxx . . $ OVAL_OPT_DIRECTIVES. }, |
| 533 | { "without-syschar", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->without_sys_charscxx . . $ oscap_action#without_sys_chars., 1}, |
| 534 | { "datastream-id",required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_DATASTREAM_IDcxx . . $ OVAL_OPT_DATASTREAM_ID.}, |
| 535 | { "oval-id", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_OVAL_IDcxx . . $ OVAL_OPT_OVAL_ID.}, |
| 536 | { "skip-validation", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->validatecxx . . $ oscap_action#validate., 0 }, |
| 537 | { "fetch-remote-resources", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->remote_resourcescxx . . $ oscap_action#remote_resources., 1}, |
| 538 | { "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`!, OVAL_OPT_LOCAL_FILEScxx . . $ OVAL_OPT_LOCAL_FILES.}, |
| 539 | { "verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.}, |
| 540 | { "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`!, OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.}, |
| 541 | { 0, 0, 0, 0 } |
| 542 | }; |
| 543 | |
| 544 | int c; |
| 545 | while ((c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "o:", long_options, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != -1) { |
| 546 | switch (c) { |
| 547 | case OVAL_OPT_RESULT_FILEcxx . . $ OVAL_OPT_RESULT_FILE.: action->f_resultscxx . . $ oscap_action#f_results. = optargcxx . . $ optarg.; break; |
| 548 | case OVAL_OPT_REPORT_FILEcxx . . $ OVAL_OPT_REPORT_FILE.: action->f_reportcxx . . $ oscap_action#f_report. = optargcxx . . $ optarg.; break; |
| 549 | case OVAL_OPT_IDcxx . . $ OVAL_OPT_ID.: action->idcxx . . $ oscap_action#id. = optargcxx . . $ optarg.; break; |
| 550 | case OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES.: action->f_variablescxx . . $ oscap_action#f_variables. = optargcxx . . $ optarg.; break; |
| 551 | case OVAL_OPT_DIRECTIVEScxx . . $ OVAL_OPT_DIRECTIVES.: action->f_directivescxx . . $ oscap_action#f_directives. = optargcxx . . $ optarg.; break; |
| 552 | case OVAL_OPT_DATASTREAM_IDcxx . . $ OVAL_OPT_DATASTREAM_ID.: action->f_datastream_idcxx . . $ oscap_action#f_datastream_id. = optargcxx . . $ optarg.; break; |
| 553 | case OVAL_OPT_OVAL_IDcxx . . $ OVAL_OPT_OVAL_ID.: action->f_oval_idcxx . . $ oscap_action#f_oval_id. = optargcxx . . $ optarg.; break; |
| 554 | case OVAL_OPT_LOCAL_FILEScxx . . $ OVAL_OPT_LOCAL_FILES.: |
| 555 | action->local_filescxx . . $ oscap_action#local_files. = optargcxx . . $ optarg.; |
| 556 | break; |
| 557 | case OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.: |
| 558 | action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.; |
| 559 | break; |
| 560 | case OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.: |
| 561 | action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.; |
| 562 | break; |
| 563 | case 0: break; |
| 564 | 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`!); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | /* We should have Definitions file here */ |
| 569 | if (optindcxx . . $ optind. >= argc) |
| 570 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Definitions file is not specified!"); |
| 571 | action->f_ovalcxx . . $ oscap_action#f_oval. = argv[optindcxx . . $ optind.]; |
| 572 | |
| 573 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 574 | } |
| 575 | #endif /* OVAL_PROBES_ENABLED */ |
| 576 | |
| 577 | #if defined(OVAL_PROBES_ENABLEDcxx . . $ `build/config.h:67:9`!) |
| 578 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_collectcxx . . $ getopt_oval_collect(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action) |
| 579 | { |
| 580 | action->doctypecxx . . $ oscap_action#doctype. = OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.; |
| 581 | |
| 582 | /* Command-options */ |
| 583 | struct optioncxx . . $ option# long_options[] = { |
| 584 | { "id", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_IDcxx . . $ OVAL_OPT_ID. }, |
| 585 | { "variables", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES. }, |
| 586 | { "syschar", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_SYSCHARcxx . . $ OVAL_OPT_SYSCHAR. }, |
| 587 | { "skip-validation", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->validatecxx . . $ oscap_action#validate., 0 }, |
| 588 | { "verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.}, |
| 589 | { "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`!, OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.}, |
| 590 | { 0, 0, 0, 0 } |
| 591 | }; |
| 592 | |
| 593 | int c; |
| 594 | while ((c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "o:", long_options, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != -1) { |
| 595 | switch (c) { |
| 596 | case OVAL_OPT_IDcxx . . $ OVAL_OPT_ID.: action->idcxx . . $ oscap_action#id. = optargcxx . . $ optarg.; break; |
| 597 | case OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES.: action->f_variablescxx . . $ oscap_action#f_variables. = optargcxx . . $ optarg.; break; |
| 598 | case OVAL_OPT_SYSCHARcxx . . $ OVAL_OPT_SYSCHAR.: action->f_syscharcxx . . $ oscap_action#f_syschar. = optargcxx . . $ optarg.; break; |
| 599 | case OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.: |
| 600 | action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.; |
| 601 | break; |
| 602 | case OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.: |
| 603 | action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.; |
| 604 | break; |
| 605 | case 0: break; |
| 606 | 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`!); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | /* We should have Definitions file here */ |
| 611 | if (optindcxx . . $ optind. >= argc) |
| 612 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Definitions file is not specified!"); |
| 613 | action->f_ovalcxx . . $ oscap_action#f_oval. = argv[optindcxx . . $ optind.]; |
| 614 | |
| 615 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 616 | } |
| 617 | #endif /* OVAL_PROBES_ENABLED */ |
| 618 | |
| 619 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_analysecxx . . $ getopt_oval_analyse(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action) |
| 620 | { |
| 621 | action->doctypecxx . . $ oscap_action#doctype. = OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.; |
| 622 | |
| 623 | /* Command-options */ |
| 624 | struct optioncxx . . $ option# long_options[] = { |
| 625 | { "results", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_RESULT_FILEcxx . . $ OVAL_OPT_RESULT_FILE. }, |
| 626 | { "variables", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES. }, |
| 627 | { "directives", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_DIRECTIVEScxx . . $ OVAL_OPT_DIRECTIVES. }, |
| 628 | { "skip-validation", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->validatecxx . . $ oscap_action#validate., 0 }, |
| 629 | { "verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.}, |
| 630 | { "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`!, OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.}, |
| 631 | { 0, 0, 0, 0 } |
| 632 | }; |
| 633 | |
| 634 | int c; |
| 635 | while ((c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "o:", long_options, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != -1) { |
| 636 | switch (c) { |
| 637 | case OVAL_OPT_RESULT_FILEcxx . . $ OVAL_OPT_RESULT_FILE.: action->f_resultscxx . . $ oscap_action#f_results. = optargcxx . . $ optarg.; break; |
| 638 | case OVAL_OPT_VARIABLEScxx . . $ OVAL_OPT_VARIABLES.: action->f_variablescxx . . $ oscap_action#f_variables. = optargcxx . . $ optarg.; break; |
| 639 | case OVAL_OPT_DIRECTIVEScxx . . $ OVAL_OPT_DIRECTIVES.: action->f_directivescxx . . $ oscap_action#f_directives. = optargcxx . . $ optarg.; break; |
| 640 | case OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.: |
| 641 | action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.; |
| 642 | break; |
| 643 | case OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.: |
| 644 | action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.; |
| 645 | break; |
| 646 | case 0: break; |
| 647 | 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`!); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /* We should have Definitions file here */ |
| 652 | if (optindcxx . . $ optind. >= argc) |
| 653 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Definitions file is not specified!"); |
| 654 | action->f_ovalcxx . . $ oscap_action#f_oval. = argv[optindcxx . . $ optind.]; |
| 655 | |
| 656 | if (action->modulecxx . . $ oscap_action#module. == &OVAL_ANALYSEcxx . . $ OVAL_ANALYSE.) { |
| 657 | /* We should have System Characteristics file here */ |
| 658 | if ((optindcxx . . $ optind.+1) > argc) |
| 659 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "System characteristics file is not specified"); |
| 660 | action->f_syscharcxx . . $ oscap_action#f_syschar. = argv[optindcxx . . $ optind. + 1]; |
| 661 | |
| 662 | if (action->f_resultscxx . . $ oscap_action#f_results. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 663 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "OVAL Results file is not specified(--results parameter)"); |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 668 | } |
| 669 | |
| 670 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_reportcxx . . $ getopt_oval_report(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action) |
| 671 | { |
| 672 | action->doctypecxx . . $ oscap_action#doctype. = OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS.; |
| 673 | |
| 674 | /* Command-options */ |
| 675 | struct optioncxx . . $ option# long_options[] = { |
| 676 | { "output", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_OUTPUTcxx . . $ OVAL_OPT_OUTPUT. }, |
| 677 | { "verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.}, |
| 678 | { "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`!, OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.}, |
| 679 | { 0, 0, 0, 0 } |
| 680 | }; |
| 681 | |
| 682 | /* |
| 683 | * it is not nice that we use action->f_results for output and |
| 684 | * action->f_oval as input here. |
| 685 | */ |
| 686 | int c; |
| 687 | while ((c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "o:", long_options, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) != -1) { |
| 688 | switch (c) { |
| 689 | case OVAL_OPT_OUTPUTcxx . . $ OVAL_OPT_OUTPUT.: action->f_resultscxx . . $ oscap_action#f_results. = optargcxx . . $ optarg.; break; |
| 690 | case OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.: |
| 691 | action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.; |
| 692 | break; |
| 693 | case OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.: |
| 694 | action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.; |
| 695 | break; |
| 696 | case 0: break; |
| 697 | 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`!); |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | /* We should have oval results file here */ |
| 702 | if (optindcxx . . $ optind. >= argc) |
| 703 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Definitions file is not specified!"); |
| 704 | action->f_ovalcxx . . $ oscap_action#f_oval. = argv[optindcxx . . $ optind.]; |
| 705 | |
| 706 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 707 | } |
| 708 | |
| 709 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! getopt_oval_validatecxx . . $ getopt_oval_validate(93e8ba72609212ff).(int argc, char **argv, struct oscap_actioncxx . . $ oscap_action# *action) |
| 710 | { |
| 711 | /* we assume 0 is unknown */ |
| 712 | action->doctypecxx . . $ oscap_action#doctype. = 0; |
| 713 | |
| 714 | /* Command-options */ |
| 715 | struct optioncxx . . $ option# long_options[] = { |
| 716 | // flags |
| 717 | { "definitions", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->doctypecxx . . $ oscap_action#doctype., OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS. }, |
| 718 | { "variables", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->doctypecxx . . $ oscap_action#doctype., OSCAP_DOCUMENT_OVAL_VARIABLEScxx . . $ OSCAP_DOCUMENT_OVAL_VARIABLES. }, |
| 719 | { "syschar", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->doctypecxx . . $ oscap_action#doctype., OSCAP_DOCUMENT_OVAL_SYSCHARcxx . . $ OSCAP_DOCUMENT_OVAL_SYSCHAR. }, |
| 720 | { "results", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->doctypecxx . . $ oscap_action#doctype., OSCAP_DOCUMENT_OVAL_RESULTScxx . . $ OSCAP_DOCUMENT_OVAL_RESULTS. }, |
| 721 | { "directives", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->doctypecxx . . $ oscap_action#doctype., OSCAP_DOCUMENT_OVAL_DIRECTIVEScxx . . $ OSCAP_DOCUMENT_OVAL_DIRECTIVES. }, |
| 722 | { "skip-schematron",no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, &action->schematroncxx . . $ oscap_action#schematron., 0 }, |
| 723 | { "verbose", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.}, |
| 724 | { "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`!, OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.}, |
| 725 | // end |
| 726 | { 0, 0, 0, 0 } |
| 727 | }; |
| 728 | |
| 729 | int c; |
| 730 | 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) { |
| 731 | switch (c) { |
| 732 | case OVAL_OPT_VERBOSEcxx . . $ OVAL_OPT_VERBOSE.: |
| 733 | action->verbosity_levelcxx . . $ oscap_action#verbosity_level. = optargcxx . . $ optarg.; |
| 734 | break; |
| 735 | case OVAL_OPT_VERBOSE_LOG_FILEcxx . . $ OVAL_OPT_VERBOSE_LOG_FILE.: |
| 736 | action->f_verbose_logcxx . . $ oscap_action#f_verbose_log. = optargcxx . . $ optarg.; |
| 737 | break; |
| 738 | case 0: break; |
| 739 | 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`!); |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | /* we should have OVAL content here */ |
| 744 | if (optindcxx . . $ optind. >= argc) |
| 745 | return oscap_module_usagecxx . . $ oscap_module_usage(8d148a6468c518c9).(action->modulecxx . . $ oscap_action#module., stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "OVAL file needs to be specified!"); |
| 746 | action->f_ovalcxx . . $ oscap_action#f_oval. = argv[optindcxx . . $ optind.]; |
| 747 | |
| 748 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 749 | } |
| 750 | |
| 751 | static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! valid_inputscxx . . $ valid_inputs(75dc19912e29b9f2).(const struct oscap_actioncxx . . $ oscap_action# *action) { |
| 752 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! result = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 753 | |
| 754 | /* validate SDS or OVAL Definitions & Variables & Syschars, |
| 755 | depending on the data */ |
| 756 | struct oscap_sourcecxx . . $ oscap_source# *definitions_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 757 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(definitions_source) != OSCAP_DOCUMENT_OVAL_DEFINITIONScxx . . $ OSCAP_DOCUMENT_OVAL_DEFINITIONS. && |
| 758 | oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(definitions_source) != OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.) { |
| 759 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Type mismatch: %s. Expecting OVAL Definition or source data stream, but found %s.\n", |
| 760 | action->f_ovalcxx . . $ oscap_action#f_oval., oscap_document_type_to_stringcxx . . $ oscap_document_type_to_string(1cec73a42285d610).(oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(definitions_source))); |
| 761 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 762 | } |
| 763 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(definitions_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action)) { |
| 764 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 765 | } |
| 766 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(definitions_source); |
| 767 | |
| 768 | if (action->f_variablescxx . . $ oscap_action#f_variables.) { |
| 769 | struct oscap_sourcecxx . . $ oscap_source# *variables_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_variablescxx . . $ oscap_action#f_variables.); |
| 770 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(variables_source) != OSCAP_DOCUMENT_OVAL_VARIABLEScxx . . $ OSCAP_DOCUMENT_OVAL_VARIABLES.) { |
| 771 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Type mismatch: %s. Expecting OVAL Variables, but found %s.\n", |
| 772 | action->f_variablescxx . . $ oscap_action#f_variables., oscap_document_type_to_stringcxx . . $ oscap_document_type_to_string(1cec73a42285d610).(oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(variables_source))); |
| 773 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 774 | } |
| 775 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(variables_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action)) { |
| 776 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 777 | } |
| 778 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(variables_source); |
| 779 | } |
| 780 | |
| 781 | if (action->f_directivescxx . . $ oscap_action#f_directives.) { |
| 782 | struct oscap_sourcecxx . . $ oscap_source# *directives_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_directivescxx . . $ oscap_action#f_directives.); |
| 783 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(directives_source) != OSCAP_DOCUMENT_OVAL_DIRECTIVEScxx . . $ OSCAP_DOCUMENT_OVAL_DIRECTIVES.) { |
| 784 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Type mismatch: %s. Expecting OVAL Directives, but found %s.\n", |
| 785 | action->f_directivescxx . . $ oscap_action#f_directives., oscap_document_type_to_stringcxx . . $ oscap_document_type_to_string(1cec73a42285d610).(oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(directives_source))); |
| 786 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 787 | } |
| 788 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(directives_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action)) { |
| 789 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 790 | } |
| 791 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(directives_source); |
| 792 | } |
| 793 | |
| 794 | if (action->modulecxx . . $ oscap_action#module. == &OVAL_ANALYSEcxx . . $ OVAL_ANALYSE. && action->f_syscharcxx . . $ oscap_action#f_syschar.) { |
| 795 | struct oscap_sourcecxx . . $ oscap_source# *syschar_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_syscharcxx . . $ oscap_action#f_syschar.); |
| 796 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(syschar_source) != OSCAP_DOCUMENT_OVAL_SYSCHARcxx . . $ OSCAP_DOCUMENT_OVAL_SYSCHAR.) { |
| 797 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Type mismatch: %s. Expecting OVAL System Characteristic, but found %s.\n", |
| 798 | action->f_syscharcxx . . $ oscap_action#f_syschar., oscap_document_type_to_stringcxx . . $ oscap_document_type_to_string(1cec73a42285d610).(oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(syschar_source))); |
| 799 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 800 | } |
| 801 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(syschar_source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action)) { |
| 802 | result = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 803 | } |
| 804 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(syschar_source); |
| 805 | } |
| 806 | |
| 807 | return result; |
| 808 | } |
| 809 | |
| 810 | static int app_oval_validatecxx . . $ app_oval_validate(d99c68634f61e371).(const struct oscap_actioncxx . . $ oscap_action# *action) { |
| 811 | int ret; |
| 812 | int result = OSCAP_OKcxx . . $ OSCAP_OK.; |
| 813 | |
| 814 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(action->f_ovalcxx . . $ oscap_action#f_oval.); |
| 815 | ret = oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(source, reportercxx . . $ reporter(710d628f83af7da6)., (void *) action); |
| 816 | |
| 817 | if (ret < 0) { |
| 818 | result = OSCAP_ERRORcxx . . $ OSCAP_ERROR.; |
| 819 | } else if (ret > 0) { |
| 820 | result = OSCAP_FAILcxx . . $ OSCAP_FAIL.; |
| 821 | } else { |
| 822 | // We can only do schematron validation if the file isn't a source datastream |
| 823 | if (action->schematroncxx . . $ oscap_action#schematron. && oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(source) != OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.) { |
| 824 | ret = oscap_source_validate_schematroncxx . . $ oscap_source_validate_schematron(a38c22d0fd42c683).(source); |
| 825 | if (ret < 0) { |
| 826 | result = OSCAP_ERRORcxx . . $ OSCAP_ERROR.; |
| 827 | } else if (ret > 0) { |
| 828 | result = OSCAP_FAILcxx . . $ OSCAP_FAIL.; |
| 829 | } |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 834 | oscap_print_errorcxx . . $ oscap_print_error(49f6e7a06ebc5aa8).(); |
| 835 | |
| 836 | return result; |
| 837 | } |
| 838 |