| 1 | /* |
| 2 | * Copyright 2013--2014 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | */ |
| 20 | #include <string.h> |
| 21 | #include <limits.h> |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 24 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 25 | #endif |
| 26 | |
| 27 | #include <sys/stat.h> |
| 28 | #ifdef OS_WINDOWS |
| 29 | #include <io.h> |
| 30 | #else |
| 31 | #include <unistd.h> |
| 32 | #endif |
| 33 | |
| 34 | #include <oscap.h>cxx . . $ `<file>/src/common/public/oscap.h`/ |
| 35 | #include "oscap_source.h"cxx . . $ `<file>/src/source/public/oscap_source.h`/ |
| 36 | #include <cpe_lang.h>cxx . . $ `<file>/src/CPE/public/cpe_lang.h`/ |
| 37 | #include <OVAL/public/oval_agent_api.h>cxx . . $ `<file>/src/OVAL/public/oval_agent_api.h`/ |
| 38 | #include <OVAL/public/oval_agent_xccdf_api.h>cxx . . $ `<file>/src/OVAL/public/oval_agent_xccdf_api.h`/ |
| 39 | #include "common/oscap_acquire.h"cxx . . $ `<file>/src/common/oscap_acquire.h`/ |
| 40 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 41 | #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 42 | #include "common/oscapxml.h"cxx . . $ `<file>/src/common/oscapxml.h`/ |
| 43 | #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/ |
| 44 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 45 | #include "CPE/cpe_session_priv.h"cxx . . $ `<file>/src/CPE/cpe_session_priv.h`/ |
| 46 | #include "DS/public/scap_ds.h"cxx . . $ `<file>/src/DS/public/scap_ds.h`/ |
| 47 | #include "DS/public/ds_sds_session.h"cxx . . $ `<file>/src/DS/public/ds_sds_session.h`/ |
| 48 | #include "DS/ds_sds_session_priv.h"cxx . . $ `<file>/src/DS/ds_sds_session_priv.h`/ |
| 49 | #include "DS/rds_priv.h"cxx . . $ `<file>/src/DS/rds_priv.h`/ |
| 50 | #include "DS/sds_priv.h"cxx . . $ `<file>/src/DS/sds_priv.h`/ |
| 51 | #include "OVAL/results/oval_results_impl.h"cxx . . $ `<file>/src/OVAL/results/oval_results_impl.h`/ |
| 52 | #include "source/xslt_priv.h"cxx . . $ `<file>/src/source/xslt_priv.h`/ |
| 53 | #include "source/signature_priv.h"cxx . . $ `<file>/src/source/signature_priv.h`/ |
| 54 | #include "XCCDF/xccdf_impl.h"cxx . . $ `<file>/src/XCCDF/xccdf_impl.h`/ |
| 55 | #include "XCCDF_POLICY/public/xccdf_policy.h"cxx . . $ `<file>/src/XCCDF_POLICY/public/xccdf_policy.h`/ |
| 56 | #include "XCCDF_POLICY/xccdf_policy_priv.h"cxx . . $ `<file>/src/XCCDF_POLICY/xccdf_policy_priv.h`/ |
| 57 | #include "XCCDF_POLICY/xccdf_policy_model_priv.h"cxx . . $ `<file>/src/XCCDF_POLICY/xccdf_policy_model_priv.h`/ |
| 58 | #include "item.h"cxx . . $ `<file>/src/XCCDF/item.h`/ |
| 59 | #include "public/xccdf_session.h"cxx . . $ `<file>/src/XCCDF/public/xccdf_session.h`/ |
| 60 | #include "XCCDF_POLICY/public/check_engine_plugin.h"cxx . . $ `<file>/src/XCCDF_POLICY/public/check_engine_plugin.h`/ |
| 61 | #include "oscap_helpers.h"cxx . . $ `<file>/src/common/public/oscap_helpers.h`/ |
| 62 | |
| 63 | struct oval_content_resourcecxx . . $ oval_content_resource# { |
| 64 | char *hrefcxx . . $ oval_content_resource#href.; ///< Coresponds with xccdf:check-content-ref/\@href. |
| 65 | struct oscap_sourcecxx . . $ oscap_source# *sourcecxx . . $ oval_content_resource#source.; ///< The oscap_source representing the href resource |
| 66 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! source_ownedcxx . . $ oval_content_resource#source_owned.; ///< Indicates whether we need to dispose source property |
| 67 | }; |
| 68 | |
| 69 | struct xccdf_sessioncxx . . $ xccdf_session# { |
| 70 | const char *filenamecxx . . $ xccdf_session#filename.; ///< File name of SCAP (SDS or XCCDF) file for this session. |
| 71 | struct oscap_listcxx . . $ oscap_list# *rulescxx . . $ xccdf_session#rules.; |
| 72 | struct oscap_listcxx . . $ oscap_list# *skip_rulescxx . . $ xccdf_session#skip_rules.; |
| 73 | const char *reference_parametercxx . . $ xccdf_session#reference_parameter.; |
| 74 | struct oscap_sourcecxx . . $ oscap_source# *sourcecxx . . $ xccdf_session#source.; ///< Main source assigned with the main file (SDS or XCCDF) |
| 75 | char *temp_dircxx . . $ xccdf_session#temp_dir.; ///< Temp directory used for decomposed component files. |
| 76 | structcxx . . $ xccdf_session#$anonymous_type_0# { |
| 77 | struct oscap_sourcecxx . . $ oscap_source# *sourcecxx . . $ xccdf_session#$anonymous_type_0#source.; ///< oscap_source representing the XCCDF file |
| 78 | struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.;///< Active policy model. |
| 79 | char *profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id.; ///< Last selected profile. |
| 80 | struct xccdf_resultcxx . . $ xccdf_result# *resultcxx . . $ xccdf_session#$anonymous_type_0#result.; ///< XCCDF Result model. |
| 81 | float base_scorecxx . . $ xccdf_session#$anonymous_type_0#base_score.; ///< Basec score of the latest evaluation. |
| 82 | struct oscap_sourcecxx . . $ oscap_source# *result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source.; ///< oscap_source for the exported XCCDF result |
| 83 | } xccdfcxx . . $ xccdf_session#xccdf.; |
| 84 | structcxx . . $ xccdf_session#$anonymous_type_1# { |
| 85 | struct ds_sds_sessioncxx . . $ ds_sds_session# *sessioncxx . . $ xccdf_session#$anonymous_type_1#session.; ///< SDS Registry abstract structure |
| 86 | char *user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id.; ///< Datastream id requested by user (only applicable for sds). |
| 87 | char *user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id.; ///< Component id requested by user (only applicable for sds). |
| 88 | char *user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id.; ///< Benchmark id requested by user (only applicable for sds). |
| 89 | } dscxx . . $ xccdf_session#ds.; |
| 90 | structcxx . . $ xccdf_session#$anonymous_type_2# { |
| 91 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! fetch_remote_resourcescxx . . $ xccdf_session#$anonymous_type_2#fetch_remote_resources.; ///< Allows download of remote resources (not applicable when user sets custom oval files) |
| 92 | const char *local_filescxx . . $ xccdf_session#$anonymous_type_2#local_files.; ///< Path to the directory where local copies of remote components are located |
| 93 | download_progress_calllback_tcxx . . $ download_progress_calllback_t# progresscxx . . $ xccdf_session#$anonymous_type_2#progress.; ///< Callback to report progress of download. |
| 94 | struct oval_content_resourcecxx . . $ oval_content_resource# **custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources.;///< OVAL files required by user |
| 95 | struct oval_content_resourcecxx . . $ oval_content_resource# **resourcescxx . . $ xccdf_session#$anonymous_type_2#resources.;///< OVAL files referenced from XCCDF |
| 96 | struct oval_agent_sessioncxx . . $ oval_agent_session# **agentscxx . . $ xccdf_session#$anonymous_type_2#agents.; ///< OVAL Agent Session |
| 97 | xccdf_policy_engine_eval_fncxx . . $ xccdf_policy_engine_eval_fn# user_eval_fncxx . . $ xccdf_session#$anonymous_type_2#user_eval_fn.;///< Custom OVAL engine callback |
| 98 | char *product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe.; ///< CPE of scanner product. |
| 99 | struct oscap_sourcecxx . . $ oscap_source#* arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report.; ///< ARF report |
| 100 | struct oscap_htablecxx . . $ oscap_htable# *result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources.; ///< mapping 'filepath' to oscap_source for OVAL results |
| 101 | struct oscap_htablecxx . . $ oscap_htable# *results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping.; ///< mapping OVAL filename to filepath for OVAL results |
| 102 | struct oscap_htablecxx . . $ oscap_htable# *arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping.; ///< mapping OVAL filename to ARF report ID for OVAL results |
| 103 | } ovalcxx . . $ xccdf_session#oval.; |
| 104 | structcxx . . $ xccdf_session#$anonymous_type_3# { |
| 105 | char *arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file.; ///< Path to ARF file to export |
| 106 | char *xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file.; ///< Path to XCCDF file to export |
| 107 | char *xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file.; ///< Path to STIG Viewer XCCDF file to export |
| 108 | char *report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file.; ///< Path to HTML file to export |
| 109 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_resultscxx . . $ xccdf_session#$anonymous_type_3#oval_results.; ///< Shall be the OVAL results files exported? |
| 110 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oval_variablescxx . . $ xccdf_session#$anonymous_type_3#oval_variables.; ///< Shall be the OVAL variable files exported? |
| 111 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! check_engine_plugins_resultscxx . . $ xccdf_session#$anonymous_type_3#check_engine_plugins_results.; ///< Shall the check engine plugins results be exported? |
| 112 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! without_sys_charscxx . . $ xccdf_session#$anonymous_type_3#without_sys_chars.; ///< Shall system characteristics be exported? |
| 113 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! thin_resultscxx . . $ xccdf_session#$anonymous_type_3#thin_results.; ///< Shall OVAL/ARF results be exported as THIN? Default is FULL |
| 114 | } exportcxx . . $ xccdf_session#export.; ///< Settings of Session export |
| 115 | char *user_cpecxx . . $ xccdf_session#user_cpe.; ///< Path to CPE dictionary required by user |
| 116 | structcxx . . $ xccdf_session#$anonymous_type_4# { |
| 117 | struct oscap_sourcecxx . . $ oscap_source# *user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.; ///< Tailoring file requested by the user |
| 118 | char *user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id.; ///< Component ID of the Tailoring requested by the user |
| 119 | } tailoringcxx . . $ xccdf_session#tailoring.; |
| 120 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! validatecxx . . $ xccdf_session#validate.; ///< False value indicates to skip any XSD validation. |
| 121 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! full_validationcxx . . $ xccdf_session#full_validation.; ///< True value indicates that every possible step will be validated by XSD. |
| 122 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! validate_signaturecxx . . $ xccdf_session#validate_signature.; ///< False value indicates to skip XML signature validation. |
| 123 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enforce_signaturecxx . . $ xccdf_session#enforce_signature.; ///< True value forces session to treat all XMLs without signature as invalid. |
| 124 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! show_rule_detailscxx . . $ xccdf_session#show_rule_details.; ///< True value indicates that rule details will be shown. |
| 125 | struct oscap_signature_ctxcxx . . $ oscap_signature_ctx# *signature_ctxcxx . . $ xccdf_session#signature_ctx.; ///< Paths to public keys, certificates, signature related info |
| 126 | |
| 127 | struct oscap_listcxx . . $ oscap_list# *check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins.; ///< Extra non-OVAL check engines that may or may not have been loaded |
| 128 | xccdf_session_loading_flags_tcxx . . $ xccdf_session_loading_flags_t# loading_flagscxx . . $ xccdf_session#loading_flags.; ///< Load referenced files while loading XCCDF |
| 129 | }; |
| 130 | |
| 131 | static int _xccdf_session_autonegotiate_tailoring_filecxx . . $ _xccdf_session_autonegotiate_tailoring_file(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *original_path); |
| 132 | static void _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(struct oval_content_resourcecxx . . $ oval_content_resource# **resources); |
| 133 | static void _xccdf_session_free_oval_agentscxx . . $ _xccdf_session_free_oval_agents(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session); |
| 134 | static void _xccdf_session_free_oval_result_sourcescxx . . $ _xccdf_session_free_oval_result_sources(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session); |
| 135 | |
| 136 | static const char *oscap_productnamecxx . . $ oscap_productname. = "cpe:/a:open-scap:oscap"; |
| 137 | static const char *oval_sysnamecxx . . $ oval_sysname. = "http://oval.mitre.org/XMLSchema/oval-definitions-5"; |
| 138 | |
| 139 | struct xccdf_sessioncxx . . $ xccdf_session# *xccdf_session_new_from_sourcecxx . . $ xccdf_session_new_from_source(635597adc8233c20).(struct oscap_sourcecxx . . $ oscap_source# *source) |
| 140 | { |
| 141 | if (source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 142 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 143 | } |
| 144 | const char *filename = oscap_source_get_filepathcxx . . $ oscap_source_get_filepath(e20df36988f50e45).(source); |
| 145 | struct xccdf_sessioncxx . . $ xccdf_session# *session = (struct xccdf_sessioncxx . . $ xccdf_session# *) calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_sessioncxx . . $ xccdf_session#)); |
| 146 | session->sourcecxx . . $ xccdf_session#source. = source; |
| 147 | oscap_document_type_tcxx . . $ oscap_document_type_t# document_type = oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(session->sourcecxx . . $ xccdf_session#source.); |
| 148 | if (document_type == OSCAP_DOCUMENT_UNKNOWNcxx . . $ OSCAP_DOCUMENT_UNKNOWN.) { |
| 149 | xccdf_session_freecxx . . $ xccdf_session_free(fc68940e73a0edd6).(session); |
| 150 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | } |
| 152 | if (document_type != OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF. |
| 153 | && document_type != OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS. |
| 154 | && document_type != OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) { |
| 155 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 156 | "Session input file was determined but it isn't an XCCDF file, " |
| 157 | "a source datastream or an XCCDF tailoring file."); |
| 158 | xccdf_session_freecxx . . $ xccdf_session_free(fc68940e73a0edd6).(session); |
| 159 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 160 | } |
| 161 | session->validatecxx . . $ xccdf_session#validate. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 162 | session->validate_signaturecxx . . $ xccdf_session#validate_signature. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 163 | session->enforce_signaturecxx . . $ xccdf_session#enforce_signature. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 164 | session->show_rule_detailscxx . . $ xccdf_session#show_rule_details. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 165 | session->signature_ctxcxx . . $ xccdf_session#signature_ctx. = oscap_signature_ctx_newcxx . . $ oscap_signature_ctx_new(e089c8d275a25cc5).(); |
| 166 | session->xccdfcxx . . $ xccdf_session#xccdf..base_scorecxx . . $ xccdf_session#$anonymous_type_0#base_score. = 0; |
| 167 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress. = download_progress_empty_calllbackcxx . . $ download_progress_empty_calllback(3ca54e6407cd3d15).; |
| 168 | session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 169 | session->loading_flagscxx . . $ xccdf_session#loading_flags. = XCCDF_SESSION_LOAD_ALLcxx . . $ XCCDF_SESSION_LOAD_ALL.; |
| 170 | session->rulescxx . . $ xccdf_session#rules. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 171 | session->skip_rulescxx . . $ xccdf_session#skip_rules. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 172 | |
| 173 | // We now have to switch up the oscap_sources in case we were given XCCDF tailoring |
| 174 | |
| 175 | if (document_type == OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) { |
| 176 | if (_xccdf_session_autonegotiate_tailoring_filecxx . . $ _xccdf_session_autonegotiate_tailoring_file(c44cfbc8af8f9f18).(session, filename) != 0) { |
| 177 | xccdf_session_freecxx . . $ xccdf_session_free(fc68940e73a0edd6).(session); |
| 178 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Created a new XCCDF session from a %s '%s'.", |
| 183 | oscap_document_type_to_string(document_type), filename); |
| 184 | return session; |
| 185 | } |
| 186 | |
| 187 | struct xccdf_sessioncxx . . $ xccdf_session# *xccdf_session_newcxx . . $ xccdf_session_new(bbbce4de0bbc49c9).(const char *filename) |
| 188 | { |
| 189 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(filename); |
| 190 | struct xccdf_sessioncxx . . $ xccdf_session# *session = xccdf_session_new_from_sourcecxx . . $ xccdf_session_new_from_source(635597adc8233c20).(source); |
| 191 | return session; |
| 192 | } |
| 193 | |
| 194 | static int _xccdf_session_autonegotiate_tailoring_filecxx . . $ _xccdf_session_autonegotiate_tailoring_file(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *original_path) |
| 195 | { |
| 196 | struct xccdf_tailoringcxx . . $ xccdf_tailoring#* tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(session->sourcecxx . . $ xccdf_session#source., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 197 | |
| 198 | if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 199 | return -1; |
| 200 | } |
| 201 | |
| 202 | char *source_path = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(xccdf_tailoring_get_benchmark_refcxx . . $ xccdf_tailoring_get_benchmark_ref(8db670c91c6a1b30).(tailoring)); |
| 203 | xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring); |
| 204 | |
| 205 | if (source_path == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 206 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 207 | "Session input file was determined to be XCCDF tailoring file, " |
| 208 | "but it contained no benchmark reference!"); |
| 209 | return -1; |
| 210 | } |
| 211 | |
| 212 | char *original_path_cpy = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(original_path); |
| 213 | char *base_dir = oscap_dirnamecxx . . $ oscap_dirname(7a9722d75b371431).(original_path_cpy); |
| 214 | |
| 215 | char *real_source_path = source_path[0] == '/' ? |
| 216 | oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(source_path) : oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%s/%s", base_dir, source_path); |
| 217 | freecxx . . $ free(5d22bdacc48458e8).(base_dir); |
| 218 | |
| 219 | freecxx . . $ free(5d22bdacc48458e8).(original_path_cpy); |
| 220 | freecxx . . $ free(5d22bdacc48458e8).(source_path); |
| 221 | |
| 222 | struct oscap_sourcecxx . . $ oscap_source# *real_source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(real_source_path); |
| 223 | freecxx . . $ free(5d22bdacc48458e8).(real_source_path); |
| 224 | |
| 225 | if (real_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 226 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 227 | "Session input file was determined to be XCCDF tailoring file, " |
| 228 | "but the real source file could not be loaded."); |
| 229 | return -1; |
| 230 | } |
| 231 | |
| 232 | session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file. = session->sourcecxx . . $ xccdf_session#source.; |
| 233 | session->sourcecxx . . $ xccdf_session#source. = real_source; |
| 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | static void xccdf_session_unload_check_engine_pluginscxx . . $ xccdf_session_unload_check_engine_plugins(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session); |
| 239 | |
| 240 | static struct oscap_sourcecxx . . $ oscap_source#* xccdf_session_create_arf_sourcecxx . . $ xccdf_session_create_arf_source(66c05d76889feaa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 241 | { |
| 242 | if (session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 243 | return session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report.; |
| 244 | } |
| 245 | |
| 246 | struct oscap_sourcecxx . . $ oscap_source# *sds_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 247 | |
| 248 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 249 | sds_source = session->sourcecxx . . $ xccdf_session#source.; |
| 250 | } else { |
| 251 | xmlDocPtrcxx . . $ xmlDocPtr# sds_doc = ds_sds_compose_xmlDoc_from_xccdf_sourcecxx . . $ ds_sds_compose_xmlDoc_from_xccdf_source(51aac4e66711e6e6).(session->sourcecxx . . $ xccdf_session#source.); |
| 252 | sds_source = oscap_source_new_from_xmlDoccxx . . $ oscap_source_new_from_xmlDoc(20d5db8f38e74517).(sds_doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 253 | } |
| 254 | |
| 255 | session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report. = ds_rds_create_sourcecxx . . $ ds_rds_create_source(943cc3ff626d8bb3).(sds_source, session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file., session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source., session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources., session->ovalcxx . . $ xccdf_session#oval..results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping., session->ovalcxx . . $ xccdf_session#oval..arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping., session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file.); |
| 256 | if (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 257 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(sds_source); |
| 258 | } |
| 259 | return session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report.; |
| 260 | } |
| 261 | |
| 262 | static struct oscap_sourcecxx . . $ oscap_source# *xccdf_session_extract_arf_sourcecxx . . $ xccdf_session_extract_arf_source(66c05d76889feaa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 263 | { |
| 264 | struct oscap_sourcecxx . . $ oscap_source# *rds_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 265 | char *tailoring_doc_timestamp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 266 | xmlDoccxx . . $ xmlDoc# *sds_doc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 267 | |
| 268 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 269 | sds_doc = oscap_source_pop_xmlDoccxx . . $ oscap_source_pop_xmlDoc(51aac4e66711e6e6).(session->sourcecxx . . $ xccdf_session#source.); |
| 270 | } else { |
| 271 | sds_doc = ds_sds_compose_xmlDoc_from_xccdf_sourcecxx . . $ ds_sds_compose_xmlDoc_from_xccdf_source(51aac4e66711e6e6).(session->sourcecxx . . $ xccdf_session#source.); |
| 272 | } |
| 273 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->sourcecxx . . $ xccdf_session#source.); |
| 274 | session->sourcecxx . . $ xccdf_session#source. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 275 | |
| 276 | if (sds_doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 277 | goto cleanup; |
| 278 | } |
| 279 | |
| 280 | xmlDoccxx . . $ xmlDoc# *result_file_doc = oscap_source_get_xmlDoccxx . . $ oscap_source_get_xmlDoc(51aac4e66711e6e6).(session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source.); |
| 281 | if (result_file_doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 282 | goto cleanup; |
| 283 | } |
| 284 | |
| 285 | xmlDoccxx . . $ xmlDoc# *tailoring_doc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 286 | const char *tailoring_filepath = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 287 | if (session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.) { |
| 288 | tailoring_doc = oscap_source_get_xmlDoccxx . . $ oscap_source_get_xmlDoc(51aac4e66711e6e6).(session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.); |
| 289 | if (tailoring_doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 290 | goto cleanup; |
| 291 | } |
| 292 | tailoring_filepath = oscap_source_get_filepathcxx . . $ oscap_source_get_filepath(e20df36988f50e45).(session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.); |
| 293 | struct statcxx . . $ stat# file_stat; |
| 294 | if (statcxx . . $ stat(a9cd1e23e96f423c).(tailoring_filepath, &file_stat) == 0) { |
| 295 | const size_t max_timestamp_len = 32; |
| 296 | tailoring_doc_timestamp = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(max_timestamp_len); |
| 297 | if (tailoring_doc_timestamp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 298 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_GLIBCcxx . . $ `src/common/public/oscap_error.h:58:9`!, "Failed to allocate %zu bytes for tailoring_doc_timestamp: %s", max_timestamp_len, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 299 | goto cleanup; |
| 300 | } |
| 301 | struct tmcxx . . $ tm# *tm_mtime = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct tmcxx . . $ tm#)); |
| 302 | #ifdef OS_WINDOWS |
| 303 | localtime_s(tm_mtime, &file_stat.st_mtime); |
| 304 | #else |
| 305 | localtime_rcxx . . $ localtime_r(92e3d173686db852).(&file_stat.st_mtimecxx . . $ `<external>/16045971866008360577/struct_stat.h:78:11`!, tm_mtime); |
| 306 | #endif |
| 307 | strftimecxx . . $ strftime(98e75925167c4f1b).(tailoring_doc_timestamp, max_timestamp_len, |
| 308 | "%Y-%m-%dT%H:%M:%S", tm_mtime); |
| 309 | freecxx . . $ free(5d22bdacc48458e8).(tm_mtime); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | xmlDocPtrcxx . . $ xmlDocPtr# rds_doc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 314 | |
| 315 | if (ds_rds_create_from_domcxx . . $ ds_rds_create_from_dom(74fd3f93d508b787).(&rds_doc, sds_doc, tailoring_doc, |
| 316 | tailoring_filepath, tailoring_doc_timestamp, result_file_doc, |
| 317 | session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources., session->ovalcxx . . $ xccdf_session#oval..results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping., |
| 318 | session->ovalcxx . . $ xccdf_session#oval..arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping.) != 0) { |
| 319 | goto cleanup; |
| 320 | } |
| 321 | |
| 322 | rds_source = oscap_source_new_from_xmlDoccxx . . $ oscap_source_new_from_xmlDoc(20d5db8f38e74517).(rds_doc, session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file.); |
| 323 | |
| 324 | cleanup: |
| 325 | freecxx . . $ free(5d22bdacc48458e8).(tailoring_doc_timestamp); |
| 326 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(sds_doc); |
| 327 | return rds_source; |
| 328 | } |
| 329 | |
| 330 | void xccdf_session_freecxx . . $ xccdf_session_free(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 331 | { |
| 332 | if (session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 333 | return; |
| 334 | freecxx . . $ free(5d22bdacc48458e8).(session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id.); |
| 335 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file.); |
| 336 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file.); |
| 337 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file.); |
| 338 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file.); |
| 339 | _xccdf_session_free_oval_result_sourcescxx . . $ _xccdf_session_free_oval_result_sources(fc68940e73a0edd6).(session); |
| 340 | xccdf_session_unload_check_engine_pluginscxx . . $ xccdf_session_unload_check_engine_plugins(fc68940e73a0edd6).(session); |
| 341 | oscap_list_free0cxx . . $ oscap_list_free0(27ed2064e5aec1b1).(session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins.); |
| 342 | freecxx . . $ free(5d22bdacc48458e8).(session->user_cpecxx . . $ xccdf_session#user_cpe.); |
| 343 | freecxx . . $ free(5d22bdacc48458e8).(session->ovalcxx . . $ xccdf_session#oval..product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe.); |
| 344 | _xccdf_session_free_oval_agentscxx . . $ _xccdf_session_free_oval_agents(fc68940e73a0edd6).(session); |
| 345 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources.); |
| 346 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(session->ovalcxx . . $ xccdf_session#oval..resourcescxx . . $ xccdf_session#$anonymous_type_2#resources.); |
| 347 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report.); |
| 348 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source.); |
| 349 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 350 | xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 351 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id.); |
| 352 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id.); |
| 353 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id.); |
| 354 | ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.); |
| 355 | if (session->temp_dircxx . . $ xccdf_session#temp_dir. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 356 | oscap_acquire_cleanup_dircxx . . $ oscap_acquire_cleanup_dir(3ed91490e421178f).((char **) &(session->temp_dircxx . . $ xccdf_session#temp_dir.)); |
| 357 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->sourcecxx . . $ xccdf_session#source.); |
| 358 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.); |
| 359 | freecxx . . $ free(5d22bdacc48458e8).(session->tailoringcxx . . $ xccdf_session#tailoring..user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id.); |
| 360 | oscap_htable_freecxx . . $ oscap_htable_free(efa5da5da5d523d).(session->ovalcxx . . $ xccdf_session#oval..results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 361 | oscap_htable_freecxx . . $ oscap_htable_free(efa5da5da5d523d).(session->ovalcxx . . $ xccdf_session#oval..arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 362 | oscap_signature_ctx_freecxx . . $ oscap_signature_ctx_free(62bc863e75211872).(session->signature_ctxcxx . . $ xccdf_session#signature_ctx.); |
| 363 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(session->rulescxx . . $ xccdf_session#rules., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 364 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(session->skip_rulescxx . . $ xccdf_session#skip_rules., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 365 | freecxx . . $ free(5d22bdacc48458e8).(session); |
| 366 | } |
| 367 | |
| 368 | static void _xccdf_session_reset_oval_agents_syscharcxx . . $ _xccdf_session_reset_oval_agents_syschar(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 369 | { |
| 370 | if (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 371 | for (int i=0; session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]; i++) { |
| 372 | oval_agent_reset_syscharcxx . . $ oval_agent_reset_syschar(627ebdc30b34a70a).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | static void _xccdf_session_reset_oval_agents_resultscxx . . $ _xccdf_session_reset_oval_agents_results(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 378 | { |
| 379 | if (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 380 | for (int i=0; session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]; i++) { |
| 381 | oval_agent_reset_resultscxx . . $ oval_agent_reset_results(627ebdc30b34a70a).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | void xccdf_session_result_resetcxx . . $ xccdf_session_result_reset(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 387 | { |
| 388 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 389 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.->policiescxx . . $ xccdf_policy_model#policies., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_policy_freecxx . . $ xccdf_policy_free(d81e5bae50d670c2).); |
| 390 | session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.->policiescxx . . $ xccdf_policy_model#policies. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 391 | } |
| 392 | |
| 393 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(session->rulescxx . . $ xccdf_session#rules., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 394 | session->rulescxx . . $ xccdf_session#rules. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 395 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(session->skip_rulescxx . . $ xccdf_session#skip_rules., (oscap_destruct_funccxx . . $ oscap_destruct_func#) freecxx . . $ free(5d22bdacc48458e8).); |
| 396 | session->skip_rulescxx . . $ xccdf_session#skip_rules. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 397 | |
| 398 | _xccdf_session_reset_oval_agents_syscharcxx . . $ _xccdf_session_reset_oval_agents_syschar(fc68940e73a0edd6).(session); |
| 399 | _xccdf_session_reset_oval_agents_resultscxx . . $ _xccdf_session_reset_oval_agents_results(fc68940e73a0edd6).(session); |
| 400 | } |
| 401 | |
| 402 | const char *xccdf_session_get_filenamecxx . . $ xccdf_session_get_filename(2f0ebe013abdb380).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 403 | { |
| 404 | return oscap_source_readable_origincxx . . $ oscap_source_readable_origin(1485dc36ee4b63be).(session->sourcecxx . . $ xccdf_session#source.); |
| 405 | } |
| 406 | |
| 407 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 408 | { |
| 409 | return oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(session->sourcecxx . . $ xccdf_session#source.) == OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.; |
| 410 | } |
| 411 | |
| 412 | void xccdf_session_set_rulecxx . . $ xccdf_session_set_rule(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *rule) |
| 413 | { |
| 414 | while (oscap_list_popcxx . . $ oscap_list_pop(8038dc059d248e3c).(session->rulescxx . . $ xccdf_session#rules., freecxx . . $ free(5d22bdacc48458e8).)) |
| 415 | ; |
| 416 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(session->rulescxx . . $ xccdf_session#rules., strdupcxx . . $ strdup(a8b8e32347182212).(rule)); |
| 417 | } |
| 418 | |
| 419 | void xccdf_session_add_rulecxx . . $ xccdf_session_add_rule(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *rule) |
| 420 | { |
| 421 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(session->rulescxx . . $ xccdf_session#rules., strdupcxx . . $ strdup(a8b8e32347182212).(rule)); |
| 422 | } |
| 423 | |
| 424 | void xccdf_session_skip_rulecxx . . $ xccdf_session_skip_rule(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *rule) |
| 425 | { |
| 426 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(session->skip_rulescxx . . $ xccdf_session#skip_rules., strdupcxx . . $ strdup(a8b8e32347182212).(rule)); |
| 427 | } |
| 428 | |
| 429 | void xccdf_session_set_validationcxx . . $ xccdf_session_set_validation(6c18952ef2e78e15).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! validate, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! full_validation) |
| 430 | { |
| 431 | session->validatecxx . . $ xccdf_session#validate. = validate; |
| 432 | session->full_validationcxx . . $ xccdf_session#full_validation. = full_validation; |
| 433 | } |
| 434 | |
| 435 | void xccdf_session_set_signature_validationcxx . . $ xccdf_session_set_signature_validation(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! validate) |
| 436 | { |
| 437 | session->validate_signaturecxx . . $ xccdf_session#validate_signature. = validate; |
| 438 | } |
| 439 | |
| 440 | void xccdf_session_set_signature_enforcementcxx . . $ xccdf_session_set_signature_enforcement(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! enforce) |
| 441 | { |
| 442 | session->enforce_signaturecxx . . $ xccdf_session#enforce_signature. = enforce; |
| 443 | } |
| 444 | |
| 445 | void xccdf_session_set_thin_resultscxx . . $ xccdf_session_set_thin_results(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! thin_results) |
| 446 | { |
| 447 | session->exportcxx . . $ xccdf_session#export..thin_resultscxx . . $ xccdf_session#$anonymous_type_3#thin_results. = thin_results; |
| 448 | } |
| 449 | |
| 450 | void xccdf_session_set_datastream_idcxx . . $ xccdf_session_set_datastream_id(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *datastream_id) |
| 451 | { |
| 452 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id.); |
| 453 | session->dscxx . . $ xccdf_session#ds..user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(datastream_id); |
| 454 | } |
| 455 | |
| 456 | const char *xccdf_session_get_datastream_idcxx . . $ xccdf_session_get_datastream_id(f99217dc5fad66c6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 457 | { |
| 458 | if (session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 459 | return ds_sds_session_get_datastream_idcxx . . $ ds_sds_session_get_datastream_id(5b4526c9616cba95).(session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.); |
| 460 | } |
| 461 | return session->dscxx . . $ xccdf_session#ds..user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id.; |
| 462 | } |
| 463 | |
| 464 | void xccdf_session_set_component_idcxx . . $ xccdf_session_set_component_id(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *component_id) |
| 465 | { |
| 466 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id.); |
| 467 | session->dscxx . . $ xccdf_session#ds..user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(component_id); |
| 468 | } |
| 469 | |
| 470 | const char *xccdf_session_get_component_idcxx . . $ xccdf_session_get_component_id(f99217dc5fad66c6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 471 | { |
| 472 | if (session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 473 | return ds_sds_session_get_checklist_idcxx . . $ ds_sds_session_get_checklist_id(5b4526c9616cba95).(session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.); |
| 474 | } |
| 475 | return session->dscxx . . $ xccdf_session#ds..user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id.; |
| 476 | } |
| 477 | |
| 478 | void xccdf_session_set_benchmark_idcxx . . $ xccdf_session_set_benchmark_id(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *benchmark_id) |
| 479 | { |
| 480 | freecxx . . $ free(5d22bdacc48458e8).(session->dscxx . . $ xccdf_session#ds..user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id.); |
| 481 | session->dscxx . . $ xccdf_session#ds..user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(benchmark_id); |
| 482 | } |
| 483 | |
| 484 | const char *xccdf_session_get_benchmark_idcxx . . $ xccdf_session_get_benchmark_id(f99217dc5fad66c6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 485 | { |
| 486 | return session->dscxx . . $ xccdf_session#ds..user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id.; |
| 487 | } |
| 488 | |
| 489 | const char *xccdf_session_get_result_idcxx . . $ xccdf_session_get_result_id(f99217dc5fad66c6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 490 | { |
| 491 | return xccdf_result_get_idcxx . . $ xccdf_result_get_id(9b243840ec21a788).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 492 | } |
| 493 | |
| 494 | void xccdf_session_set_user_cpecxx . . $ xccdf_session_set_user_cpe(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *user_cpe) |
| 495 | { |
| 496 | freecxx . . $ free(5d22bdacc48458e8).(session->user_cpecxx . . $ xccdf_session#user_cpe.); |
| 497 | session->user_cpecxx . . $ xccdf_session#user_cpe. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(user_cpe); |
| 498 | } |
| 499 | |
| 500 | void xccdf_session_set_user_tailoring_filecxx . . $ xccdf_session_set_user_tailoring_file(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *user_tailoring_file) |
| 501 | { |
| 502 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.); |
| 503 | session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file. = user_tailoring_file != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? |
| 504 | oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(user_tailoring_file) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 505 | } |
| 506 | |
| 507 | struct oscap_sourcecxx . . $ oscap_source# *xccdf_session_get_user_tailoring_filecxx . . $ xccdf_session_get_user_tailoring_file(66c05d76889feaa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 508 | { |
| 509 | return session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.; |
| 510 | } |
| 511 | |
| 512 | void xccdf_session_set_user_tailoring_cidcxx . . $ xccdf_session_set_user_tailoring_cid(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *user_tailoring_cid) |
| 513 | { |
| 514 | freecxx . . $ free(5d22bdacc48458e8).(session->tailoringcxx . . $ xccdf_session#tailoring..user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id.); |
| 515 | session->tailoringcxx . . $ xccdf_session#tailoring..user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(user_tailoring_cid); |
| 516 | } |
| 517 | |
| 518 | void xccdf_session_set_custom_oval_eval_fncxx . . $ xccdf_session_set_custom_oval_eval_fn(11dfec3931da66f3).(struct xccdf_sessioncxx . . $ xccdf_session# *session, xccdf_policy_engine_eval_fncxx . . $ xccdf_policy_engine_eval_fn# eval_fn) |
| 519 | { |
| 520 | session->ovalcxx . . $ xccdf_session#oval..user_eval_fncxx . . $ xccdf_session#$anonymous_type_2#user_eval_fn. = eval_fn; |
| 521 | } |
| 522 | |
| 523 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_product_cpecxx . . $ xccdf_session_set_product_cpe(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *product_cpe) |
| 524 | { |
| 525 | freecxx . . $ free(5d22bdacc48458e8).(session->ovalcxx . . $ xccdf_session#oval..product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe.); |
| 526 | session->ovalcxx . . $ xccdf_session#oval..product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(product_cpe); |
| 527 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 528 | } |
| 529 | |
| 530 | void xccdf_session_set_without_sys_chars_exportcxx . . $ xccdf_session_set_without_sys_chars_export(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! without_sys_chars) |
| 531 | { |
| 532 | session->exportcxx . . $ xccdf_session#export..without_sys_charscxx . . $ xccdf_session#$anonymous_type_3#without_sys_chars. = without_sys_chars; |
| 533 | } |
| 534 | |
| 535 | void xccdf_session_set_oval_results_exportcxx . . $ xccdf_session_set_oval_results_export(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! to_export_oval_results) |
| 536 | { |
| 537 | session->exportcxx . . $ xccdf_session#export..oval_resultscxx . . $ xccdf_session#$anonymous_type_3#oval_results. = to_export_oval_results; |
| 538 | } |
| 539 | |
| 540 | void xccdf_session_set_oval_variables_exportcxx . . $ xccdf_session_set_oval_variables_export(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! to_export_oval_variables) |
| 541 | { |
| 542 | session->exportcxx . . $ xccdf_session#export..oval_variablescxx . . $ xccdf_session#$anonymous_type_3#oval_variables. = to_export_oval_variables; |
| 543 | } |
| 544 | |
| 545 | void xccdf_session_set_check_engine_plugins_results_exportcxx . . $ xccdf_session_set_check_engine_plugins_results_export(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! to_export_results) |
| 546 | { |
| 547 | session->exportcxx . . $ xccdf_session#export..check_engine_plugins_resultscxx . . $ xccdf_session#$anonymous_type_3#check_engine_plugins_results. = to_export_results; |
| 548 | } |
| 549 | |
| 550 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_arf_exportcxx . . $ xccdf_session_set_arf_export(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *arf_file) |
| 551 | { |
| 552 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file.); |
| 553 | session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(arf_file); |
| 554 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 555 | } |
| 556 | |
| 557 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_xccdf_exportcxx . . $ xccdf_session_set_xccdf_export(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *xccdf_file) |
| 558 | { |
| 559 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file.); |
| 560 | session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(xccdf_file); |
| 561 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 562 | } |
| 563 | |
| 564 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_xccdf_stig_viewer_exportcxx . . $ xccdf_session_set_xccdf_stig_viewer_export(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *xccdf_stig_viewer_file) |
| 565 | { |
| 566 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file.); |
| 567 | session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(xccdf_stig_viewer_file); |
| 568 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 569 | } |
| 570 | |
| 571 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_report_exportcxx . . $ xccdf_session_set_report_export(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *report_file) |
| 572 | { |
| 573 | freecxx . . $ free(5d22bdacc48458e8).(session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file.); |
| 574 | session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(report_file); |
| 575 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 576 | } |
| 577 | |
| 578 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_set_profile_idcxx . . $ xccdf_session_set_profile_id(5281e12fff4127ed).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *profile_id) |
| 579 | { |
| 580 | if (xccdf_policy_model_get_policy_by_idcxx . . $ xccdf_policy_model_get_policy_by_id(3a48227fe1c1225a).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., profile_id) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 581 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 582 | freecxx . . $ free(5d22bdacc48458e8).(session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id.); |
| 583 | session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(profile_id); |
| 584 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 585 | } |
| 586 | |
| 587 | static const char *xccdf_profiles_match_profile_idcxx . . $ xccdf_profiles_match_profile_id(cf220dc29e4ace8a).(struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *profile_it, const char *profile_suffix, int *match_status) |
| 588 | { |
| 589 | const char *full_profile_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 590 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! multiple = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 591 | while (xccdf_profile_iterator_has_morecxx . . $ xccdf_profile_iterator_has_more(adef36931cdf4bdd).(profile_it)) { |
| 592 | struct xccdf_profilecxx . . $ xccdf_profile# *profile = xccdf_profile_iterator_nextcxx . . $ xccdf_profile_iterator_next(4851320650739603).(profile_it); |
| 593 | const char *profile_id = xccdf_profile_get_idcxx . . $ xccdf_profile_get_id(d143a4aa05fc37ce).(profile); |
| 594 | |
| 595 | if(oscap_str_endswithcxx . . $ oscap_str_endswith(b7a7aa4a824b7595).(profile_id, profile_suffix)) { |
| 596 | if (full_profile_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 597 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Multiple matches found:\n%s\n%s\n", |
| 598 | full_profile_id, profile_id); |
| 599 | multiple = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 600 | break; |
| 601 | } else { |
| 602 | full_profile_id = profile_id; |
| 603 | } |
| 604 | } |
| 605 | } |
| 606 | xccdf_profile_iterator_freecxx . . $ xccdf_profile_iterator_free(e346a4b111941870).(profile_it); |
| 607 | if (match_status != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 608 | if (multiple) { |
| 609 | *match_status = OSCAP_PROFILE_MULTIPLE_MATCHEScxx . . $ OSCAP_PROFILE_MULTIPLE_MATCHES.; |
| 610 | full_profile_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 611 | } else if (full_profile_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 612 | *match_status = OSCAP_PROFILE_NO_MATCHcxx . . $ OSCAP_PROFILE_NO_MATCH.; |
| 613 | } else { |
| 614 | *match_status = OSCAP_PROFILE_MATCH_OKcxx . . $ OSCAP_PROFILE_MATCH_OK.; |
| 615 | } |
| 616 | } |
| 617 | return full_profile_id; |
| 618 | } |
| 619 | |
| 620 | const char *xccdf_tailoring_match_profile_idcxx . . $ xccdf_tailoring_match_profile_id(429b5e088e99157f).(struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring, const char *profile_suffix, int *match_status) |
| 621 | { |
| 622 | struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *profile_it = xccdf_tailoring_get_profilescxx . . $ xccdf_tailoring_get_profiles(41ce0c0fc277fbfc).(tailoring); |
| 623 | return xccdf_profiles_match_profile_idcxx . . $ xccdf_profiles_match_profile_id(cf220dc29e4ace8a).(profile_it, profile_suffix, match_status); |
| 624 | } |
| 625 | |
| 626 | const char *xccdf_benchmark_match_profile_idcxx . . $ xccdf_benchmark_match_profile_id(9b9e7597774c7f37).(struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench, const char *profile_suffix, int *match_status) |
| 627 | { |
| 628 | struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *profile_it = xccdf_benchmark_get_profilescxx . . $ xccdf_benchmark_get_profiles(c49c4abda143290c).(bench); |
| 629 | return xccdf_profiles_match_profile_idcxx . . $ xccdf_profiles_match_profile_id(cf220dc29e4ace8a).(profile_it, profile_suffix, match_status); |
| 630 | } |
| 631 | |
| 632 | int xccdf_session_set_profile_id_by_suffixcxx . . $ xccdf_session_set_profile_id_by_suffix(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *profile_suffix) |
| 633 | { |
| 634 | const char *full_profile_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 635 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *bench = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 636 | |
| 637 | // Tailoring Profiles |
| 638 | struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_policy_model_get_tailoringcxx . . $ xccdf_policy_model_get_tailoring(635dafb53c61c9dd).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 639 | int return_code = OSCAP_PROFILE_NO_MATCHcxx . . $ OSCAP_PROFILE_NO_MATCH.; |
| 640 | if (tailoring != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 641 | struct xccdf_profile_iteratorcxx . . $ xccdf_profile_iterator# *profit_tailoring = xccdf_tailoring_get_profilescxx . . $ xccdf_tailoring_get_profiles(41ce0c0fc277fbfc).(tailoring); |
| 642 | while (xccdf_profile_iterator_has_morecxx . . $ xccdf_profile_iterator_has_more(adef36931cdf4bdd).(profit_tailoring)) { |
| 643 | struct xccdf_profilecxx . . $ xccdf_profile# *tailoring_profile = xccdf_profile_iterator_nextcxx . . $ xccdf_profile_iterator_next(4851320650739603).(profit_tailoring); |
| 644 | const char *tailoring_profile_id = xccdf_profile_get_idcxx . . $ xccdf_profile_get_id(d143a4aa05fc37ce).(tailoring_profile); |
| 645 | |
| 646 | if (oscap_str_endswithcxx . . $ oscap_str_endswith(b7a7aa4a824b7595).(tailoring_profile_id, profile_suffix)) { |
| 647 | if (full_profile_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 648 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Multiple matches found:\n%s\n%s\n", |
| 649 | full_profile_id, tailoring_profile_id); |
| 650 | return_code = OSCAP_PROFILE_MULTIPLE_MATCHEScxx . . $ OSCAP_PROFILE_MULTIPLE_MATCHES.; |
| 651 | break; |
| 652 | } else { |
| 653 | full_profile_id = tailoring_profile_id; |
| 654 | return_code = OSCAP_PROFILE_MATCH_OKcxx . . $ OSCAP_PROFILE_MATCH_OK.; |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | xccdf_profile_iterator_freecxx . . $ xccdf_profile_iterator_free(e346a4b111941870).(profit_tailoring); |
| 659 | } |
| 660 | |
| 661 | // Benchmark Profiles |
| 662 | if (return_code == OSCAP_PROFILE_NO_MATCHcxx . . $ OSCAP_PROFILE_NO_MATCH.) { |
| 663 | full_profile_id = xccdf_benchmark_match_profile_idcxx . . $ xccdf_benchmark_match_profile_id(9b9e7597774c7f37).(bench, profile_suffix, &return_code); |
| 664 | } |
| 665 | |
| 666 | if (return_code == OSCAP_PROFILE_MATCH_OKcxx . . $ OSCAP_PROFILE_MATCH_OK.) { |
| 667 | if (!xccdf_session_set_profile_idcxx . . $ xccdf_session_set_profile_id(5281e12fff4127ed).(session, full_profile_id)) { |
| 668 | return_code = OSCAP_PROFILE_NO_MATCHcxx . . $ OSCAP_PROFILE_NO_MATCH.; |
| 669 | } |
| 670 | } |
| 671 | return return_code; |
| 672 | } |
| 673 | |
| 674 | const char *xccdf_session_get_profile_idcxx . . $ xccdf_session_get_profile_id(f99217dc5fad66c6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 675 | { |
| 676 | return session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id.; |
| 677 | } |
| 678 | |
| 679 | static struct ds_sds_sessioncxx . . $ ds_sds_session# *xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 680 | { |
| 681 | if (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) |
| 682 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 683 | if (session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 684 | session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session. = ds_sds_session_new_from_sourcecxx . . $ ds_sds_session_new_from_source(84081d5e8394044f).(session->sourcecxx . . $ xccdf_session#source.); |
| 685 | } |
| 686 | return session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.; |
| 687 | } |
| 688 | |
| 689 | |
| 690 | void xccdf_session_configure_remote_resourcescxx . . $ xccdf_session_configure_remote_resources(39d1d6c85e4007df).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allowed, const char *local_files, download_progress_calllback_tcxx . . $ download_progress_calllback_t# callback) |
| 691 | { |
| 692 | if (callback == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 693 | // With empty cb we don't have to check for NULL |
| 694 | // when we want to use it |
| 695 | callback = download_progress_empty_calllbackcxx . . $ download_progress_empty_calllback(3ca54e6407cd3d15).; |
| 696 | } |
| 697 | |
| 698 | session->ovalcxx . . $ xccdf_session#oval..fetch_remote_resourcescxx . . $ xccdf_session#$anonymous_type_2#fetch_remote_resources. = allowed; |
| 699 | session->ovalcxx . . $ xccdf_session#oval..local_filescxx . . $ xccdf_session#$anonymous_type_2#local_files. = local_files; |
| 700 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress. = callback; |
| 701 | |
| 702 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 703 | // We have to propagate this option to allow loading |
| 704 | // of external datastream components |
| 705 | ds_sds_session_configure_remote_resourcescxx . . $ ds_sds_session_configure_remote_resources(61c5f4052dda9a0f).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), allowed, local_files, callback); |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | void xccdf_session_set_remote_resourcescxx . . $ xccdf_session_set_remote_resources(85f02994a2a8cc79).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! allowed, download_progress_calllback_tcxx . . $ download_progress_calllback_t# callback) |
| 710 | { |
| 711 | xccdf_session_configure_remote_resourcescxx . . $ xccdf_session_configure_remote_resources(39d1d6c85e4007df).(session, allowed, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, callback); |
| 712 | } |
| 713 | |
| 714 | void xccdf_session_set_loading_flagscxx . . $ xccdf_session_set_loading_flags(3c1bec58736b4360).(struct xccdf_sessioncxx . . $ xccdf_session# *session, xccdf_session_loading_flags_tcxx . . $ xccdf_session_loading_flags_t# flags) |
| 715 | { |
| 716 | session->loading_flagscxx . . $ xccdf_session#loading_flags. = flags; |
| 717 | } |
| 718 | |
| 719 | /** |
| 720 | * Get Source DataStream index of the session. |
| 721 | * @memberof xccdf_session |
| 722 | * @warning This is applicable only on sessions which are SDS. |
| 723 | * @return sds index |
| 724 | */ |
| 725 | struct ds_sds_indexcxx . . $ ds_sds_index# *xccdf_session_get_sds_idxcxx . . $ xccdf_session_get_sds_idx(78461a1198ba4a6c).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 726 | { |
| 727 | if (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) |
| 728 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 729 | |
| 730 | return ds_sds_session_get_sds_idxcxx . . $ ds_sds_session_get_sds_idx(4257cf9e93799a4d).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session)); |
| 731 | } |
| 732 | |
| 733 | int xccdf_session_loadcxx . . $ xccdf_session_load(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 734 | { |
| 735 | int ret = 0; |
| 736 | |
| 737 | if (session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.) { |
| 738 | ds_sds_session_resetcxx . . $ ds_sds_session_reset(41ab223cf3ccc737).(session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.); |
| 739 | } |
| 740 | |
| 741 | const xccdf_session_loading_flags_tcxx . . $ xccdf_session_loading_flags_t# flags = session->loading_flagscxx . . $ xccdf_session#loading_flags.; |
| 742 | if (flags & XCCDF_SESSION_LOAD_XCCDFcxx . . $ XCCDF_SESSION_LOAD_XCCDF.) { |
| 743 | if ((ret = xccdf_session_load_xccdfcxx . . $ xccdf_session_load_xccdf(dd871bf8776e7fa2).(session)) != 0) |
| 744 | return ret; |
| 745 | } |
| 746 | if (flags & XCCDF_SESSION_LOAD_CPEcxx . . $ XCCDF_SESSION_LOAD_CPE.) { |
| 747 | if ((ret = xccdf_session_load_cpecxx . . $ xccdf_session_load_cpe(dd871bf8776e7fa2).(session)) != 0) { |
| 748 | return ret; |
| 749 | } |
| 750 | } |
| 751 | if (flags & XCCDF_SESSION_LOAD_OVALcxx . . $ XCCDF_SESSION_LOAD_OVAL.) { |
| 752 | if ((ret = xccdf_session_load_ovalcxx . . $ xccdf_session_load_oval(dd871bf8776e7fa2).(session)) != 0) { |
| 753 | return ret; |
| 754 | } |
| 755 | } |
| 756 | if (flags & XCCDF_SESSION_LOAD_CHECK_ENGINE_PLUGINScxx . . $ XCCDF_SESSION_LOAD_CHECK_ENGINE_PLUGINS.) { |
| 757 | if ((ret = xccdf_session_load_check_engine_pluginscxx . . $ xccdf_session_load_check_engine_plugins(dd871bf8776e7fa2).(session)) != 0) { |
| 758 | return ret; |
| 759 | } |
| 760 | } |
| 761 | ret = xccdf_session_load_tailoringcxx . . $ xccdf_session_load_tailoring(dd871bf8776e7fa2).(session); |
| 762 | oscap_source_free_xmlDoccxx . . $ oscap_source_free_xmlDoc(1a322e80279420f6).(session->sourcecxx . . $ xccdf_session#source.); |
| 763 | return ret; |
| 764 | } |
| 765 | |
| 766 | static int _reportercxx . . $ _reporter(710d628f83af7da6).(const char *file, int line, const char *msg, void *arg) |
| 767 | { |
| 768 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "File '%s' line %d: %s", file, line, msg); |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | static inline int _xccdf_session_load_xccdf_benchmarkcxx . . $ _xccdf_session_load_xccdf_benchmark(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 773 | { |
| 774 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 775 | xccdf_policy_model_freecxx . . $ xccdf_policy_model_free(72c03b3c10433f31).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 776 | session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 777 | } |
| 778 | |
| 779 | /* Validate documents */ |
| 780 | if (session->validatecxx . . $ xccdf_session#validate. && (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session) || session->full_validationcxx . . $ xccdf_session#full_validation.)) { |
| 781 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source., _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 782 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid %s (%s) content in %s", |
| 783 | oscap_document_type_to_string(oscap_source_get_scap_type(session->source)), |
| 784 | oscap_source_get_schema_version(session->source), |
| 785 | oscap_source_readable_origin(session->source)); |
| 786 | return 1; |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | /* Load XCCDF model and XCCDF Policy model */ |
| 791 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_benchmark_import_sourcecxx . . $ xccdf_benchmark_import_source(ea77069d65e32f82).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.); |
| 792 | if (benchmark == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 793 | return 1; |
| 794 | } |
| 795 | |
| 796 | /* create the policy model */ |
| 797 | session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. = xccdf_policy_model_newcxx . . $ xccdf_policy_model_new(b3d462237ee1830).(benchmark); |
| 798 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 799 | xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(benchmark); |
| 800 | return 1; |
| 801 | } |
| 802 | xccdf_policy_model_set_show_rule_detailscxx . . $ xccdf_policy_model_set_show_rule_details(64287508088bf563).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., session->show_rule_detailscxx . . $ xccdf_session#show_rule_details.); |
| 803 | return 0; |
| 804 | } |
| 805 | |
| 806 | static int _acquire_xccdf_checklist_from_tailoringcxx . . $ _acquire_xccdf_checklist_from_tailoring(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session#* session) |
| 807 | { |
| 808 | struct ds_sds_sessioncxx . . $ ds_sds_session# *ds_sds_session = xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session); |
| 809 | if (ds_sds_session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 810 | return 1; |
| 811 | } |
| 812 | |
| 813 | xmlDoccxx . . $ xmlDoc# *tailoring_xmlDoc = xmlCopyDoccxx . . $ xmlCopyDoc(e24caa64b81680f5).(oscap_source_get_xmlDoccxx . . $ oscap_source_get_xmlDoc(51aac4e66711e6e6).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.), truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 814 | struct oscap_sourcecxx . . $ oscap_source# *tailoring_source = oscap_source_new_from_xmlDoccxx . . $ oscap_source_new_from_xmlDoc(20d5db8f38e74517).(tailoring_xmlDoc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 815 | 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`!); |
| 816 | if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 817 | /* Freeing tailoring_source also frees the tailoring_xmlDoc used to create the source */ |
| 818 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(tailoring_source); |
| 819 | return 1; |
| 820 | } |
| 821 | char *benchmark_ref = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(xccdf_tailoring_get_benchmark_refcxx . . $ xccdf_tailoring_get_benchmark_ref(8db670c91c6a1b30).(tailoring)); |
| 822 | xccdf_tailoring_freecxx . . $ xccdf_tailoring_free(b4f0b704104bd93e).(tailoring); |
| 823 | if (benchmark_ref == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 824 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(tailoring_source); |
| 825 | return 1; |
| 826 | } |
| 827 | |
| 828 | struct oscap_sourcecxx . . $ oscap_source# *xccdf_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 829 | if (oscap_str_startswithcxx . . $ oscap_str_startswith(b7a7aa4a824b7595).(benchmark_ref, "file:")) { |
| 830 | char* sep = strchrcxx . . $ strchr(2050848944e00d54).(benchmark_ref, '#'); |
| 831 | const char *filename = benchmark_ref + strlencxx . . $ strlen(751346f8406fd082).("file:"); |
| 832 | const char *component_ref = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 833 | if (sep != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 834 | component_ref = sep + 1; |
| 835 | *sep = '\0'; |
| 836 | } |
| 837 | |
| 838 | struct oscap_sourcecxx . . $ oscap_source# *external_file = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(filename); |
| 839 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(external_file) == OSCAP_DOCUMENT_SDScxx . . $ OSCAP_DOCUMENT_SDS.) { |
| 840 | if (component_ref == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 841 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 842 | "The referenced component is a datastream, but no datastream component was specified."); |
| 843 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(external_file); |
| 844 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(tailoring_source); |
| 845 | freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref); |
| 846 | return 1; |
| 847 | } |
| 848 | ds_sds_session_freecxx . . $ ds_sds_session_free(41ab223cf3ccc737).(ds_sds_session); |
| 849 | ds_sds_session = ds_sds_session_new_from_sourcecxx . . $ ds_sds_session_new_from_source(84081d5e8394044f).(external_file); |
| 850 | session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session. = ds_sds_session; |
| 851 | xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(ds_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`!); |
| 852 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(session->sourcecxx . . $ xccdf_session#source.); |
| 853 | session->sourcecxx . . $ xccdf_session#source. = external_file; |
| 854 | } else { |
| 855 | xccdf_source = external_file; |
| 856 | } |
| 857 | } else { |
| 858 | xccdf_source = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(ds_sds_session, |
| 859 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, benchmark_ref + 1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 860 | } |
| 861 | if (xccdf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 862 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 863 | "Could not find benchmark referenced from tailoring as '%s'.", benchmark_ref); |
| 864 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(tailoring_source); |
| 865 | freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref); |
| 866 | return 1; |
| 867 | } |
| 868 | |
| 869 | session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source. = xccdf_source; |
| 870 | session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file. = tailoring_source; |
| 871 | freecxx . . $ free(5d22bdacc48458e8).(benchmark_ref); |
| 872 | return 0; |
| 873 | } |
| 874 | |
| 875 | int xccdf_session_load_xccdfcxx . . $ xccdf_session_load_xccdf(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 876 | { |
| 877 | session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 878 | |
| 879 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 880 | if (session->validatecxx . . $ xccdf_session#validate.) { |
| 881 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(session->sourcecxx . . $ xccdf_session#source., _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 882 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid %s (%s) content in %s", |
| 883 | oscap_document_type_to_string(oscap_source_get_scap_type(session->source)), |
| 884 | oscap_source_get_schema_version(session->source), |
| 885 | oscap_source_readable_origin(session->source)); |
| 886 | return 1; |
| 887 | } |
| 888 | } |
| 889 | if (session->validate_signaturecxx . . $ xccdf_session#validate_signature. || session->enforce_signaturecxx . . $ xccdf_session#enforce_signature.) { |
| 890 | if (oscap_signature_validatecxx . . $ oscap_signature_validate(765ad4676bbc989a).(session->sourcecxx . . $ xccdf_session#source., session->signature_ctxcxx . . $ xccdf_session#signature_ctx., session->enforce_signaturecxx . . $ xccdf_session#enforce_signature.)) { |
| 891 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid signature in %s (%s) content in %s", |
| 892 | oscap_document_type_to_string(oscap_source_get_scap_type(session->source)), |
| 893 | oscap_source_get_schema_version(session->source), |
| 894 | oscap_source_readable_origin(session->source)); |
| 895 | return 1; |
| 896 | } |
| 897 | } |
| 898 | session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source. = ds_sds_session_select_checklistcxx . . $ ds_sds_session_select_checklist(573911ebb5a087a9).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), session->dscxx . . $ xccdf_session#ds..user_datastream_idcxx . . $ xccdf_session#$anonymous_type_1#user_datastream_id., |
| 899 | session->dscxx . . $ xccdf_session#ds..user_component_idcxx . . $ xccdf_session#$anonymous_type_1#user_component_id., session->dscxx . . $ xccdf_session#ds..user_benchmark_idcxx . . $ xccdf_session#$anonymous_type_1#user_benchmark_id.); |
| 900 | if (session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 901 | return 1; |
| 902 | } |
| 903 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.) == OSCAP_DOCUMENT_XCCDF_TAILORINGcxx . . $ OSCAP_DOCUMENT_XCCDF_TAILORING.) { |
| 904 | if (_acquire_xccdf_checklist_from_tailoringcxx . . $ _acquire_xccdf_checklist_from_tailoring(dd871bf8776e7fa2).(session)) { |
| 905 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 906 | "Could not find appropriate checklist to tailor."); |
| 907 | return 1; |
| 908 | } |
| 909 | } |
| 910 | if (oscap_source_get_scap_typecxx . . $ oscap_source_get_scap_type(1b623b3fe9f5b871).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.) != OSCAP_DOCUMENT_XCCDFcxx . . $ OSCAP_DOCUMENT_XCCDF.) { |
| 911 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "The selected checklist document is not '%s', but '%s'.", |
| 912 | oscap_document_type_to_string(OSCAP_DOCUMENT_XCCDF), |
| 913 | oscap_document_type_to_string(oscap_source_get_scap_type(session->xccdf.source))); |
| 914 | return 1; |
| 915 | } |
| 916 | } |
| 917 | else { |
| 918 | session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source. = session->sourcecxx . . $ xccdf_session#source.; |
| 919 | } |
| 920 | |
| 921 | return _xccdf_session_load_xccdf_benchmarkcxx . . $ _xccdf_session_load_xccdf_benchmark(dd871bf8776e7fa2).(session); |
| 922 | } |
| 923 | static inline void _connect_cpe_session_with_sdscxx . . $ _connect_cpe_session_with_sds(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 924 | { |
| 925 | struct cpe_sessioncxx . . $ cpe_session# *cpe_session = xccdf_policy_model_get_cpe_sessioncxx . . $ xccdf_policy_model_get_cpe_session(cfdce5f2ac9d5b55).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 926 | struct oscap_htablecxx . . $ oscap_htable# *sources_cache = ds_sds_session_get_component_sourcescxx . . $ ds_sds_session_get_component_sources(a99418aa193592e1).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session)); |
| 927 | cpe_session_set_cachecxx . . $ cpe_session_set_cache(b2bb2d418ae8a636).(cpe_session, sources_cache); |
| 928 | } |
| 929 | |
| 930 | int xccdf_session_load_cpecxx . . $ xccdf_session_load_cpe(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 931 | { |
| 932 | if (session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 933 | return 1; |
| 934 | |
| 935 | // The CPE session will load OVAL files for any CPE dicts that require it. |
| 936 | // These OVAL files are outside of scope of XCCDF session but we still want |
| 937 | // to apply the thin results settings to them. |
| 938 | struct cpe_sessioncxx . . $ cpe_session# *cpe_session = xccdf_policy_model_get_cpe_sessioncxx . . $ xccdf_policy_model_get_cpe_session(cfdce5f2ac9d5b55).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 939 | cpe_session_set_thin_resultscxx . . $ cpe_session_set_thin_results(be2cc67a7d80b751).(cpe_session, session->exportcxx . . $ xccdf_session#export..thin_resultscxx . . $ xccdf_session#$anonymous_type_3#thin_results.); |
| 940 | |
| 941 | /* Use custom CPE dict if given */ |
| 942 | if (session->user_cpecxx . . $ xccdf_session#user_cpe. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 943 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(session->user_cpecxx . . $ xccdf_session#user_cpe.); |
| 944 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 945 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 946 | return 1; |
| 947 | } |
| 948 | if (!xccdf_policy_model_add_cpe_autodetect_sourcecxx . . $ xccdf_policy_model_add_cpe_autodetect_source(d030e1cb5de4cb10).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., source)) { |
| 949 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 950 | return 1; |
| 951 | } |
| 952 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 953 | } |
| 954 | |
| 955 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 956 | _connect_cpe_session_with_sdscxx . . $ _connect_cpe_session_with_sds(fc68940e73a0edd6).(session); |
| 957 | struct ds_sds_indexcxx . . $ ds_sds_index# *sds_idx = xccdf_session_get_sds_idxcxx . . $ xccdf_session_get_sds_idx(78461a1198ba4a6c).(session); |
| 958 | if (sds_idx == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 959 | return -1; |
| 960 | } |
| 961 | struct ds_stream_indexcxx . . $ ds_stream_index#* stream_idx = ds_sds_index_get_streamcxx . . $ ds_sds_index_get_stream(5c419e4b1e68b074).(sds_idx, xccdf_session_get_datastream_idcxx . . $ xccdf_session_get_datastream_id(f99217dc5fad66c6).(session)); |
| 962 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator#* cpe_it = ds_stream_index_get_dictionariescxx . . $ ds_stream_index_get_dictionaries(4484253c305eab5e).(stream_idx); |
| 963 | |
| 964 | // This potentially allows us to skip yet another decompose if we are sure |
| 965 | // there are no CPE dictionaries or language models inside the datastream. |
| 966 | if (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(cpe_it)) { |
| 967 | if (ds_sds_session_register_component_with_dependenciescxx . . $ ds_sds_session_register_component_with_dependencies(2e27e35b07e9ac87).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), |
| 968 | "dictionaries", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 969 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Can't decompose CPE dictionaries from datastream '%s' " |
| 970 | "from file '%s'!\n", xccdf_session_get_datastream_id(session), |
| 971 | oscap_source_readable_origin(session->source)); |
| 972 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(cpe_it); |
| 973 | return 1; |
| 974 | } |
| 975 | while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(cpe_it)) { |
| 976 | const char* cpe_filename = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(cpe_it); |
| 977 | |
| 978 | struct oscap_sourcecxx . . $ oscap_source# *source = ds_sds_session_get_component_by_hrefcxx . . $ ds_sds_session_get_component_by_href(46a19ef06873a4cc).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), cpe_filename); |
| 979 | |
| 980 | if (session->full_validationcxx . . $ xccdf_session#full_validation.) { |
| 981 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 982 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid %s (%s) content in %s", |
| 983 | oscap_document_type_to_string(oscap_source_get_scap_type(source)), |
| 984 | oscap_source_get_schema_version(source), |
| 985 | oscap_source_readable_origin(source)); |
| 986 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(cpe_it); |
| 987 | return 1; |
| 988 | } |
| 989 | } |
| 990 | if (!xccdf_policy_model_add_cpe_autodetect_sourcecxx . . $ xccdf_policy_model_add_cpe_autodetect_source(d030e1cb5de4cb10).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., source)) { |
| 991 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(cpe_it); |
| 992 | return 1; |
| 993 | } |
| 994 | } |
| 995 | } |
| 996 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(cpe_it); |
| 997 | } |
| 998 | return 0; |
| 999 | } |
| 1000 | |
| 1001 | static void _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(struct oval_content_resourcecxx . . $ oval_content_resource# **resources) |
| 1002 | { |
| 1003 | if (resources) { |
| 1004 | for (int i=0; resources[i]; i++) { |
| 1005 | freecxx . . $ free(5d22bdacc48458e8).(resources[i]->hrefcxx . . $ oval_content_resource#href.); |
| 1006 | if (resources[i]->source_ownedcxx . . $ oval_content_resource#source_owned.) { |
| 1007 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(resources[i]->sourcecxx . . $ oval_content_resource#source.); |
| 1008 | } |
| 1009 | freecxx . . $ free(5d22bdacc48458e8).(resources[i]); |
| 1010 | } |
| 1011 | freecxx . . $ free(5d22bdacc48458e8).(resources); |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | void xccdf_session_set_custom_oval_filescxx . . $ xccdf_session_set_custom_oval_files(277245166264b402).(struct xccdf_sessioncxx . . $ xccdf_session# *session, char **oval_filenames) |
| 1016 | { |
| 1017 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources.); |
| 1018 | session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1019 | if (oval_filenames == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1020 | return; |
| 1021 | |
| 1022 | size_t count; |
| 1023 | for (count = 0; oval_filenames[count];) |
| 1024 | count++; |
| 1025 | struct oval_content_resourcecxx . . $ oval_content_resource# **resources = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).((count + 1) * sizeof(struct oval_content_resourcecxx . . $ oval_content_resource# *)); |
| 1026 | if (resources == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1027 | return; |
| 1028 | |
| 1029 | for (int i = 0; oval_filenames[i];) { |
| 1030 | resources[i] = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct oval_content_resourcecxx . . $ oval_content_resource#)); |
| 1031 | resources[i]->hrefcxx . . $ oval_content_resource#href. = oscap_basenamecxx . . $ oscap_basename(7a9722d75b371431).(oval_filenames[i]); |
| 1032 | resources[i]->sourcecxx . . $ oval_content_resource#source. = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(oval_filenames[i]); |
| 1033 | resources[i]->source_ownedcxx . . $ oval_content_resource#source_owned. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1034 | i++; |
| 1035 | resources[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1036 | } |
| 1037 | session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources. = resources; |
| 1038 | } |
| 1039 | |
| 1040 | static int _xccdf_session_get_oval_from_modelcxx . . $ _xccdf_session_get_oval_from_model(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1041 | { |
| 1042 | struct oval_content_resourcecxx . . $ oval_content_resource# **resources = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1043 | struct oscap_file_entry_listcxx . . $ oscap_file_entry_list# *files = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1044 | struct oscap_file_entry_iteratorcxx . . $ oscap_file_entry_iterator# *files_it = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1045 | int idx = 0; |
| 1046 | char *tmp_path; |
| 1047 | char *printable_path; |
| 1048 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! fetch_option_suggested = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1049 | char *xccdf_path_cpy = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1050 | char *dir_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1051 | int res = 0; |
| 1052 | |
| 1053 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(session->ovalcxx . . $ xccdf_session#oval..resourcescxx . . $ xccdf_session#$anonymous_type_2#resources.); |
| 1054 | |
| 1055 | xccdf_path_cpy = strdupcxx . . $ strdup(a8b8e32347182212).(oscap_source_readable_origincxx . . $ oscap_source_readable_origin(1485dc36ee4b63be).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.)); |
| 1056 | dir_path = oscap_dirnamecxx . . $ oscap_dirname(7a9722d75b371431).(xccdf_path_cpy); |
| 1057 | |
| 1058 | resources = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct oval_content_resourcecxx . . $ oval_content_resource# *)); |
| 1059 | resources[idx] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1060 | |
| 1061 | files = xccdf_policy_model_get_systems_and_filescxx . . $ xccdf_policy_model_get_systems_and_files(bd306bb648bca7f3).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1062 | files_it = oscap_file_entry_list_get_filescxx . . $ oscap_file_entry_list_get_files(f5aaec2ea5fc982f).(files); |
| 1063 | while (oscap_file_entry_iterator_has_morecxx . . $ oscap_file_entry_iterator_has_more(126961f4f01d6b48).(files_it)) { |
| 1064 | struct oscap_file_entrycxx . . $ oscap_file_entry# *file_entry; |
| 1065 | struct statcxx . . $ stat# sb; |
| 1066 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! source_owned = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1067 | |
| 1068 | file_entry = (struct oscap_file_entrycxx . . $ oscap_file_entry# *) oscap_file_entry_iterator_nextcxx . . $ oscap_file_entry_iterator_next(2dd8621e704b2d0b).(files_it); |
| 1069 | |
| 1070 | // we only care about OVAL referenced files |
| 1071 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(oscap_file_entry_get_systemcxx . . $ oscap_file_entry_get_system(7827612c21abd21f).(file_entry), oval_sysnamecxx . . $ oval_sysname.)) |
| 1072 | continue; |
| 1073 | |
| 1074 | const char *file_path = oscap_file_entry_get_filecxx . . $ oscap_file_entry_get_file(7827612c21abd21f).(file_entry); |
| 1075 | struct oscap_sourcecxx . . $ oscap_source# *source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1076 | |
| 1077 | tmp_path = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! * sizeof(char)); |
| 1078 | if (file_path[0] == '/') { // it's a simple absolute path |
| 1079 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmp_path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s", file_path); |
| 1080 | } |
| 1081 | else if (oscap_str_startswithcxx . . $ oscap_str_startswith(b7a7aa4a824b7595).(file_path, "file://")) { // it's an absolute path prefixed with file:// |
| 1082 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmp_path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s", file_path + 7); |
| 1083 | } |
| 1084 | else { // assume it's a relative path |
| 1085 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(tmp_path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s/%s", dir_path, file_path); |
| 1086 | } |
| 1087 | |
| 1088 | if (xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1089 | source = ds_sds_session_get_component_by_hrefcxx . . $ ds_sds_session_get_component_by_href(46a19ef06873a4cc).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), file_path); |
| 1090 | source_owned = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1091 | } else { |
| 1092 | if (statcxx . . $ stat(a9cd1e23e96f423c).(tmp_path, &sb) == 0) { |
| 1093 | source = oscap_source_new_from_filecxx . . $ oscap_source_new_from_file(987f8b70a317ffb9).(tmp_path); |
| 1094 | source_owned = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1095 | } |
| 1096 | } |
| 1097 | |
| 1098 | if (source != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1099 | resources[idx] = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct oval_content_resourcecxx . . $ oval_content_resource#)); |
| 1100 | resources[idx]->hrefcxx . . $ oval_content_resource#href. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(oscap_file_entry_get_filecxx . . $ oscap_file_entry_get_file(7827612c21abd21f).(file_entry)); |
| 1101 | resources[idx]->source_ownedcxx . . $ oval_content_resource#source_owned. = source_owned; |
| 1102 | resources[idx]->sourcecxx . . $ oval_content_resource#source. = source; |
| 1103 | idx++; |
| 1104 | void *new_resources = realloccxx . . $ realloc(417ab160f6baadc6).(resources, (idx + 1) * sizeof(struct oval_content_resourcecxx . . $ oval_content_resource# *)); |
| 1105 | if (new_resources == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1106 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(resources); |
| 1107 | freecxx . . $ free(5d22bdacc48458e8).(tmp_path); |
| 1108 | res = -1; |
| 1109 | goto cleanup; |
| 1110 | } |
| 1111 | resources = new_resources; |
| 1112 | resources[idx] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1113 | } |
| 1114 | else { |
| 1115 | if (oscap_acquire_url_is_supportedcxx . . $ oscap_acquire_url_is_supported(c5f7da30cbc0f4e9).(oscap_file_entry_get_filecxx . . $ oscap_file_entry_get_file(7827612c21abd21f).(file_entry))) { |
| 1116 | // Strip out the 'path' for printing the url. |
| 1117 | printable_path = (char *) oscap_file_entry_get_filecxx . . $ oscap_file_entry_get_file(7827612c21abd21f).(file_entry); |
| 1118 | |
| 1119 | if (session->ovalcxx . . $ xccdf_session#oval..fetch_remote_resourcescxx . . $ xccdf_session#$anonymous_type_2#fetch_remote_resources.) { |
| 1120 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress.(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "Downloading: %s ... ", printable_path); |
| 1121 | |
| 1122 | size_t data_size; |
| 1123 | char *data = oscap_acquire_url_downloadcxx . . $ oscap_acquire_url_download(90074be1d80d1697).(printable_path, &data_size); |
| 1124 | if (data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1125 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress.(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "error\n"); |
| 1126 | } else { |
| 1127 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress.(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, "ok\n"); |
| 1128 | |
| 1129 | resources[idx] = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct oval_content_resourcecxx . . $ oval_content_resource#)); |
| 1130 | resources[idx]->hrefcxx . . $ oval_content_resource#href. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(printable_path); |
| 1131 | resources[idx]->sourcecxx . . $ oval_content_resource#source. = oscap_source_new_take_memorycxx . . $ oscap_source_new_take_memory(2b1f5a784648902c).(data, data_size, printable_path); |
| 1132 | resources[idx]->source_ownedcxx . . $ oval_content_resource#source_owned. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1133 | idx++; |
| 1134 | void * new_resources = realloccxx . . $ realloc(417ab160f6baadc6).(resources, (idx + 1) * sizeof(struct oval_content_resourcecxx . . $ oval_content_resource# *)); |
| 1135 | if (new_resources == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1136 | _oval_content_resources_freecxx . . $ _oval_content_resources_free(7a9205de01648213).(resources); |
| 1137 | freecxx . . $ free(5d22bdacc48458e8).(tmp_path); |
| 1138 | res = -1; |
| 1139 | goto cleanup; |
| 1140 | } |
| 1141 | resources = new_resources; |
| 1142 | resources[idx] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1143 | freecxx . . $ free(5d22bdacc48458e8).(tmp_path); |
| 1144 | continue; |
| 1145 | } |
| 1146 | } |
| 1147 | else if (!fetch_option_suggested) { |
| 1148 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress.(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "WARNING: This content points out to the remote resources. " |
| 1149 | "Use `--fetch-remote-resources' option to download them.\n"); |
| 1150 | fetch_option_suggested = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1151 | } |
| 1152 | } |
| 1153 | else |
| 1154 | printable_path = tmp_path; |
| 1155 | session->ovalcxx . . $ xccdf_session#oval..progresscxx . . $ xccdf_session#$anonymous_type_2#progress.(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "WARNING: Skipping %s file which is referenced from XCCDF content\n", printable_path); |
| 1156 | } |
| 1157 | freecxx . . $ free(5d22bdacc48458e8).(tmp_path); |
| 1158 | } |
| 1159 | session->ovalcxx . . $ xccdf_session#oval..resourcescxx . . $ xccdf_session#$anonymous_type_2#resources. = resources; |
| 1160 | cleanup: |
| 1161 | freecxx . . $ free(5d22bdacc48458e8).(dir_path); |
| 1162 | oscap_file_entry_iterator_freecxx . . $ oscap_file_entry_iterator_free(9fa52656bc957f51).(files_it); |
| 1163 | oscap_file_entry_list_freecxx . . $ oscap_file_entry_list_free(46f5db83064d09fb).(files); |
| 1164 | freecxx . . $ free(5d22bdacc48458e8).(xccdf_path_cpy); |
| 1165 | return res; |
| 1166 | } |
| 1167 | |
| 1168 | static void _xccdf_session_free_oval_agentscxx . . $ _xccdf_session_free_oval_agents(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1169 | { |
| 1170 | if (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1171 | for (int i=0; session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]; i++) { |
| 1172 | struct oval_definition_modelcxx . . $ oval_definition_model# *def_model = oval_agent_get_definition_modelcxx . . $ oval_agent_get_definition_model(6e9a49c1c153e814).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 1173 | oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(def_model); |
| 1174 | oval_agent_destroy_sessioncxx . . $ oval_agent_destroy_session(627ebdc30b34a70a).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 1175 | } |
| 1176 | freecxx . . $ free(5d22bdacc48458e8).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.); |
| 1177 | session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | int xccdf_session_load_ovalcxx . . $ xccdf_session_load_oval(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1182 | { |
| 1183 | struct oval_content_resourcecxx . . $ oval_content_resource# **contents = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1184 | |
| 1185 | _xccdf_session_free_oval_agentscxx . . $ _xccdf_session_free_oval_agents(fc68940e73a0edd6).(session); |
| 1186 | |
| 1187 | /* Locate all OVAL files */ |
| 1188 | if (session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1189 | /* Use OVAL files from policy model */ |
| 1190 | if (_xccdf_session_get_oval_from_modelcxx . . $ _xccdf_session_get_oval_from_model(dd871bf8776e7fa2).(session) != 0) |
| 1191 | return 1; |
| 1192 | } |
| 1193 | |
| 1194 | contents = session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? session->ovalcxx . . $ xccdf_session#oval..custom_resourcescxx . . $ xccdf_session#$anonymous_type_2#custom_resources. : session->ovalcxx . . $ xccdf_session#oval..resourcescxx . . $ xccdf_session#$anonymous_type_2#resources.; |
| 1195 | |
| 1196 | /* Validate OVAL files. Only validate if the file doesn't come from a datastream |
| 1197 | * or if full validation was explicitly requested. |
| 1198 | */ |
| 1199 | if (session->validatecxx . . $ xccdf_session#validate. && (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session) || session->full_validationcxx . . $ xccdf_session#full_validation.)) { |
| 1200 | for (int idx=0; contents[idx]; idx++) { |
| 1201 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(contents[idx]->sourcecxx . . $ oval_content_resource#source., _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1202 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid %s (%s) content in %s", |
| 1203 | oscap_document_type_to_string(oscap_source_get_scap_type(session->source)), |
| 1204 | oscap_source_get_schema_version(session->source), |
| 1205 | contents[idx]->href); |
| 1206 | return 1; |
| 1207 | } |
| 1208 | } |
| 1209 | } |
| 1210 | |
| 1211 | for (int idx=0; contents[idx]; idx++) { |
| 1212 | /* file -> def_model */ |
| 1213 | struct oval_definition_modelcxx . . $ oval_definition_model# *tmp_def_model = oval_definition_model_import_sourcecxx . . $ oval_definition_model_import_source(5c1ce95823108a2f).(contents[idx]->sourcecxx . . $ oval_content_resource#source.); |
| 1214 | if (tmp_def_model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1215 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Failed to create OVAL definition model from: '%s'.", |
| 1216 | oscap_source_readable_origin(contents[idx]->source)); |
| 1217 | return 1; |
| 1218 | } |
| 1219 | |
| 1220 | /* def_model -> session */ |
| 1221 | struct oval_agent_sessioncxx . . $ oval_agent_session# *tmp_sess = oval_agent_new_sessioncxx . . $ oval_agent_new_session(ca85c20b742af0f5).(tmp_def_model, contents[idx]->hrefcxx . . $ oval_content_resource#href.); |
| 1222 | if (tmp_sess == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1223 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Failed to create new OVAL agent session for: '%s'.", contents[idx]->href); |
| 1224 | oval_definition_model_freecxx . . $ oval_definition_model_free(fd0cd5af216bd200).(tmp_def_model); |
| 1225 | return 2; |
| 1226 | } |
| 1227 | |
| 1228 | if (session->exportcxx . . $ xccdf_session#export..thin_resultscxx . . $ xccdf_session#$anonymous_type_3#thin_results.) { |
| 1229 | struct oval_results_modelcxx . . $ oval_results_model# *res_model = oval_agent_get_results_modelcxx . . $ oval_agent_get_results_model(8b7d7187bb31542e).(tmp_sess); |
| 1230 | struct oval_directives_modelcxx . . $ oval_directives_model# *dir_model = oval_results_model_get_directives_modelcxx . . $ oval_results_model_get_directives_model(32d519058727ea70).(res_model); |
| 1231 | // This is the worst function name in existence, despite its name, |
| 1232 | // it's getting the oval_result_directives of the oval_directives_model. |
| 1233 | // You would expect oval_directives_model_getresdirs at least, but no.. |
| 1234 | struct oval_result_directivescxx . . $ oval_result_directives# *dir = oval_directives_model_get_defdirscxx . . $ oval_directives_model_get_defdirs(3cbe8edfdf311cf3).(dir_model); |
| 1235 | oval_result_directives_set_contentcxx . . $ oval_result_directives_set_content(d6d0d72a2ce41db6).(dir, OVAL_RESULT_TRUEcxx . . $ OVAL_RESULT_TRUE. | OVAL_RESULT_FALSEcxx . . $ OVAL_RESULT_FALSE. | |
| 1236 | OVAL_RESULT_UNKNOWNcxx . . $ OVAL_RESULT_UNKNOWN. | OVAL_RESULT_NOT_EVALUATEDcxx . . $ OVAL_RESULT_NOT_EVALUATED. | |
| 1237 | OVAL_RESULT_NOT_APPLICABLEcxx . . $ OVAL_RESULT_NOT_APPLICABLE. | OVAL_RESULT_ERRORcxx . . $ OVAL_RESULT_ERROR., |
| 1238 | OVAL_DIRECTIVE_CONTENT_THINcxx . . $ OVAL_DIRECTIVE_CONTENT_THIN.); |
| 1239 | } |
| 1240 | |
| 1241 | /* store our name in the generated documents */ |
| 1242 | oval_agent_set_product_namecxx . . $ oval_agent_set_product_name(4646a8b4d8a0fdcf).(tmp_sess, session->ovalcxx . . $ xccdf_session#oval..product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? |
| 1243 | session->ovalcxx . . $ xccdf_session#oval..product_cpecxx . . $ xccdf_session#$anonymous_type_2#product_cpe. : (char *) oscap_productnamecxx . . $ oscap_productname.); |
| 1244 | |
| 1245 | /* remember sessions */ |
| 1246 | void *new_oval_agents = realloccxx . . $ realloc(417ab160f6baadc6).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents., (idx + 2) * sizeof(struct oval_agent_sessioncxx . . $ oval_agent_session# *)); |
| 1247 | if (new_oval_agents == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1248 | oval_agent_destroy_sessioncxx . . $ oval_agent_destroy_session(627ebdc30b34a70a).(tmp_sess); |
| 1249 | return -1; |
| 1250 | } |
| 1251 | session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. = new_oval_agents; |
| 1252 | session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[idx] = tmp_sess; |
| 1253 | session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[idx+1] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1254 | |
| 1255 | /* register session */ |
| 1256 | if (session->ovalcxx . . $ xccdf_session#oval..user_eval_fncxx . . $ xccdf_session#$anonymous_type_2#user_eval_fn. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1257 | xccdf_policy_model_register_engine_and_query_callbackcxx . . $ xccdf_policy_model_register_engine_and_query_callback(7fef2e0a0392b6d3).( |
| 1258 | session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., (char *) oval_sysnamecxx . . $ oval_sysname., |
| 1259 | session->ovalcxx . . $ xccdf_session#oval..user_eval_fncxx . . $ xccdf_session#$anonymous_type_2#user_eval_fn., tmp_sess, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1260 | else |
| 1261 | xccdf_policy_model_register_engine_ovalcxx . . $ xccdf_policy_model_register_engine_oval(3139c1932569a3b1).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., tmp_sess); |
| 1262 | } |
| 1263 | return 0; |
| 1264 | } |
| 1265 | |
| 1266 | int xccdf_session_load_check_engine_plugin2cxx . . $ xccdf_session_load_check_engine_plugin2(c57634f6abc3a571).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *plugin_name, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! quiet) |
| 1267 | { |
| 1268 | struct check_engine_plugin_defcxx . . $ check_engine_plugin_def# *plugin = check_engine_plugin_load2cxx . . $ check_engine_plugin_load2(9071ba705b7532d3).(plugin_name, quiet); |
| 1269 | |
| 1270 | if (!plugin) |
| 1271 | return -1; // error already set |
| 1272 | |
| 1273 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins., plugin); |
| 1274 | |
| 1275 | if (xccdf_session_get_datastream_idcxx . . $ xccdf_session_get_datastream_id(f99217dc5fad66c6).(session) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!){ |
| 1276 | return check_engine_plugin_registercxx . . $ check_engine_plugin_register(5f88fd8f7be40b51).(plugin, session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., ds_sds_session_get_target_dircxx . . $ ds_sds_session_get_target_dir(f40a0d7511d218a2).(session->dscxx . . $ xccdf_session#ds..sessioncxx . . $ xccdf_session#$anonymous_type_1#session.)); |
| 1277 | } else { |
| 1278 | char* xccdf_filename = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(oscap_source_readable_origincxx . . $ oscap_source_readable_origin(1485dc36ee4b63be).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.)); |
| 1279 | char *xccdf_dirname = oscap_dirnamecxx . . $ oscap_dirname(7a9722d75b371431).(xccdf_filename); |
| 1280 | int res = check_engine_plugin_registercxx . . $ check_engine_plugin_register(5f88fd8f7be40b51).(plugin, session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., xccdf_dirname); |
| 1281 | freecxx . . $ free(5d22bdacc48458e8).(xccdf_dirname); |
| 1282 | freecxx . . $ free(5d22bdacc48458e8).(xccdf_filename); |
| 1283 | return res; |
| 1284 | } |
| 1285 | } |
| 1286 | |
| 1287 | int xccdf_session_load_check_engine_plugincxx . . $ xccdf_session_load_check_engine_plugin(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *plugin_name) |
| 1288 | { |
| 1289 | return xccdf_session_load_check_engine_plugin2cxx . . $ xccdf_session_load_check_engine_plugin2(c57634f6abc3a571).(session, plugin_name, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 1290 | } |
| 1291 | |
| 1292 | int xccdf_session_load_check_engine_pluginscxx . . $ xccdf_session_load_check_engine_plugins(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1293 | { |
| 1294 | xccdf_session_unload_check_engine_pluginscxx . . $ xccdf_session_unload_check_engine_plugins(fc68940e73a0edd6).(session); |
| 1295 | |
| 1296 | const char * const *known_plugins = check_engine_plugin_get_known_pluginscxx . . $ check_engine_plugin_get_known_plugins(93405d8a1d31001f).(); |
| 1297 | |
| 1298 | while (*known_plugins) { |
| 1299 | // We do not report failure when a known plugin doesn't load properly, that's because they |
| 1300 | // are optional and we don't know if it's not there or if it just failed to load. |
| 1301 | if (xccdf_session_load_check_engine_plugin2cxx . . $ xccdf_session_load_check_engine_plugin2(c57634f6abc3a571).(session, *known_plugins, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) != 0) |
| 1302 | oscap_clearerrcxx . . $ oscap_clearerr(49f6e7a06ebc5aa8).(); |
| 1303 | |
| 1304 | known_plugins++; |
| 1305 | } |
| 1306 | |
| 1307 | return 0; |
| 1308 | } |
| 1309 | |
| 1310 | static void xccdf_session_unload_check_engine_pluginscxx . . $ xccdf_session_unload_check_engine_plugins(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1311 | { |
| 1312 | struct oscap_iteratorcxx . . $ oscap_iterator# *it = oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins.); |
| 1313 | |
| 1314 | while (oscap_iterator_has_morecxx . . $ oscap_iterator_has_more(63b1de9a5adb9205).(it)) { |
| 1315 | struct check_engine_plugin_defcxx . . $ check_engine_plugin_def# *plugin = (struct check_engine_plugin_defcxx . . $ check_engine_plugin_def# *)oscap_iterator_nextcxx . . $ oscap_iterator_next(4c75051c806960eb).(it); |
| 1316 | |
| 1317 | check_engine_plugin_cleanupcxx . . $ check_engine_plugin_cleanup(1e3e5a4311b15a9f).(plugin, session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1318 | check_engine_plugin_unloadcxx . . $ check_engine_plugin_unload(be78ae89c758d8d0).(plugin); |
| 1319 | } |
| 1320 | |
| 1321 | oscap_iterator_freecxx . . $ oscap_iterator_free(3cba44c1b7872358).(it); |
| 1322 | |
| 1323 | oscap_list_free0cxx . . $ oscap_list_free0(27ed2064e5aec1b1).(session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins.); |
| 1324 | session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins. = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 1325 | } |
| 1326 | |
| 1327 | int xccdf_session_load_tailoringcxx . . $ xccdf_session_load_tailoring(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1328 | { |
| 1329 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! from_sds = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1330 | struct oscap_sourcecxx . . $ oscap_source# *tailoring_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1331 | |
| 1332 | if (session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1333 | tailoring_source = session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file.; |
| 1334 | } |
| 1335 | else if (session->tailoringcxx . . $ xccdf_session#tailoring..user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1336 | if (!xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 1337 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Can't use given tailoring component ID because file isn't a source datastream."); |
| 1338 | return 1; |
| 1339 | } |
| 1340 | |
| 1341 | tailoring_source = ds_sds_session_select_tailoringcxx . . $ ds_sds_session_select_tailoring(46a19ef06873a4cc).(xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session), session->tailoringcxx . . $ xccdf_session#tailoring..user_component_idcxx . . $ xccdf_session#$anonymous_type_4#user_component_id.); |
| 1342 | if (tailoring_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1343 | return 1; |
| 1344 | } |
| 1345 | |
| 1346 | from_sds = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1347 | } |
| 1348 | |
| 1349 | // TODO: We should warn if has a XCCDF tailoring-file hint and user isn't |
| 1350 | // using that particular tailoring. |
| 1351 | |
| 1352 | if (tailoring_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1353 | return 0; // nothing to do |
| 1354 | |
| 1355 | if (session->validatecxx . . $ xccdf_session#validate. && (!from_sds || session->full_validationcxx . . $ xccdf_session#full_validation.)) { |
| 1356 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(tailoring_source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1357 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Invalid %s (%s) content in %s", |
| 1358 | oscap_document_type_to_string(oscap_source_get_scap_type(tailoring_source)), |
| 1359 | oscap_source_get_schema_version(tailoring_source), |
| 1360 | oscap_source_readable_origin(tailoring_source)); |
| 1361 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(tailoring_source); |
| 1362 | session->tailoringcxx . . $ xccdf_session#tailoring..user_filecxx . . $ xccdf_session#$anonymous_type_4#user_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1363 | return 1; |
| 1364 | } |
| 1365 | } |
| 1366 | |
| 1367 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1368 | struct xccdf_tailoringcxx . . $ xccdf_tailoring# *tailoring = xccdf_tailoring_import_sourcecxx . . $ xccdf_tailoring_import_source(725401c546835d49).(tailoring_source, benchmark); |
| 1369 | |
| 1370 | if (tailoring == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1371 | return 1; |
| 1372 | |
| 1373 | return xccdf_policy_model_set_tailoringcxx . . $ xccdf_policy_model_set_tailoring(8231a1379b761ce0).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., tailoring) ? 0 : 1; |
| 1374 | } |
| 1375 | |
| 1376 | int xccdf_session_evaluatecxx . . $ xccdf_session_evaluate(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1377 | { |
| 1378 | struct xccdf_policycxx . . $ xccdf_policy# *policy = xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session); |
| 1379 | if (policy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1380 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Cannot build xccdf_policy."); |
| 1381 | return 1; |
| 1382 | } |
| 1383 | struct oscap_iteratorcxx . . $ oscap_iterator# *it = oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(session->rulescxx . . $ xccdf_session#rules.); |
| 1384 | while (oscap_iterator_has_morecxx . . $ oscap_iterator_has_more(63b1de9a5adb9205).(it)) { |
| 1385 | const char *rule_id = oscap_iterator_nextcxx . . $ oscap_iterator_next(4c75051c806960eb).(it); |
| 1386 | oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(policy->rulescxx . . $ xccdf_policy#rules., rule_id, (void *)truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 1387 | } |
| 1388 | oscap_iterator_freecxx . . $ oscap_iterator_free(3cba44c1b7872358).(it); |
| 1389 | struct oscap_iteratorcxx . . $ oscap_iterator# *sit = oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(session->skip_rulescxx . . $ xccdf_session#skip_rules.); |
| 1390 | while (oscap_iterator_has_morecxx . . $ oscap_iterator_has_more(63b1de9a5adb9205).(sit)) { |
| 1391 | const char *rule_id = oscap_iterator_nextcxx . . $ oscap_iterator_next(4c75051c806960eb).(sit); |
| 1392 | oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(policy->skip_rulescxx . . $ xccdf_policy#skip_rules., rule_id, (void *)truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 1393 | } |
| 1394 | oscap_iterator_freecxx . . $ oscap_iterator_free(3cba44c1b7872358).(sit); |
| 1395 | |
| 1396 | if (session->reference_parametercxx . . $ xccdf_session#reference_parameter.) { |
| 1397 | xccdf_policy_set_reference_filtercxx . . $ xccdf_policy_set_reference_filter(439ce320e94f2f4c).(policy, session->reference_parametercxx . . $ xccdf_session#reference_parameter.); |
| 1398 | } |
| 1399 | session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. = xccdf_policy_evaluatecxx . . $ xccdf_policy_evaluate(93b250fa94f0dc8e).(policy); |
| 1400 | if (session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1401 | return 1; |
| 1402 | |
| 1403 | /* Write results into XCCDF Test Result model */ |
| 1404 | xccdf_result_set_benchmark_uricxx . . $ xccdf_result_set_benchmark_uri(2deabb2a41c12da7).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., oscap_source_readable_origincxx . . $ oscap_source_readable_origin(1485dc36ee4b63be).(session->sourcecxx . . $ xccdf_session#source.)); |
| 1405 | struct oscap_textcxx . . $ oscap_text# *title = oscap_text_newcxx . . $ oscap_text_new(b563511806f9674e).(); |
| 1406 | oscap_text_set_textcxx . . $ oscap_text_set_text(8aa69a4864e2c57).(title, "OSCAP Scan Result"); |
| 1407 | xccdf_result_add_titlecxx . . $ xccdf_result_add_title(5f3f9c2ea725bd69).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., title); |
| 1408 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_get_benchmarkcxx . . $ xccdf_policy_get_benchmark(2b37a6455229dc70).(policy); |
| 1409 | xccdf_result_set_versioncxx . . $ xccdf_result_set_version(2deabb2a41c12da7).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., |
| 1410 | benchmark != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? xccdf_benchmark_get_versioncxx . . $ xccdf_benchmark_get_version(6371e83a9c397dc3).(benchmark) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1411 | |
| 1412 | xccdf_result_fill_sysinfocxx . . $ xccdf_result_fill_sysinfo(731f9fbfcaef207c).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1413 | |
| 1414 | struct xccdf_model_iteratorcxx . . $ xccdf_model_iterator# *model_it = xccdf_benchmark_get_modelscxx . . $ xccdf_benchmark_get_models(a487aac0e784c495).(xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.)); |
| 1415 | while (xccdf_model_iterator_has_morecxx . . $ xccdf_model_iterator_has_more(8502154b87698104).(model_it)) { |
| 1416 | struct xccdf_modelcxx . . $ xccdf_model# *model = xccdf_model_iterator_nextcxx . . $ xccdf_model_iterator_next(d3da97982f710aaa).(model_it); |
| 1417 | const char *score_model = xccdf_model_get_systemcxx . . $ xccdf_model_get_system(2767d91305b32d1).(model); |
| 1418 | struct xccdf_scorecxx . . $ xccdf_score# *score = xccdf_policy_get_scorecxx . . $ xccdf_policy_get_score(ccecc07d9e5e436f).(policy, session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., score_model); |
| 1419 | xccdf_result_add_scorecxx . . $ xccdf_result_add_score(2dd722c8007a0b50).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., score); |
| 1420 | |
| 1421 | /* record default base score for later use */ |
| 1422 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(score_model, "urn:xccdf:scoring:default")) |
| 1423 | session->xccdfcxx . . $ xccdf_session#xccdf..base_scorecxx . . $ xccdf_session#$anonymous_type_0#base_score. = xccdf_score_get_scorecxx . . $ xccdf_score_get_score(cc5c402e4e6eb993).(score); |
| 1424 | } |
| 1425 | xccdf_model_iterator_freecxx . . $ xccdf_model_iterator_free(48859ac5f1c116d9).(model_it); |
| 1426 | return 0; |
| 1427 | } |
| 1428 | |
| 1429 | static size_t _paramlist_sizecxx . . $ _paramlist_size(53fcf07ba53ffee5).(const char **p) { size_t s = 0; if (!p) return s; while (p[s]) s += 2; return s; } |
| 1430 | |
| 1431 | static size_t _paramlist_cpycxx . . $ _paramlist_cpy(95190fbbb843de08).(const char **to, const char **p) { |
| 1432 | size_t s = 0; |
| 1433 | if (!to || !p) |
| 1434 | return s; |
| 1435 | for (;p && p[s]; s += 2) to[s] = p[s], to[s+1] = p[s+1]; |
| 1436 | to[s] = p[s]; |
| 1437 | return s; |
| 1438 | } |
| 1439 | |
| 1440 | static int _app_xsltcxx . . $ _app_xslt(d7e0091c5541e717).(struct oscap_sourcecxx . . $ oscap_source# *infile, const char *xsltfile, const char *outfile, const char **params) |
| 1441 | { |
| 1442 | char pwd[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!]; |
| 1443 | |
| 1444 | if (getcwdcxx . . $ getcwd(dff97f9eb74e1544).(pwd, sizeof(pwd)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1445 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Getcwd() failed: %s", strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 1446 | return 1; |
| 1447 | } |
| 1448 | |
| 1449 | /* add params oscap-version & pwd */ |
| 1450 | const char *stdparams[] = { "oscap-version", oscap_get_versioncxx . . $ oscap_get_version(33a1f659e94feb42).(), "pwd", pwd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! }; |
| 1451 | const size_t par_cnt = _paramlist_sizecxx . . $ _paramlist_size(53fcf07ba53ffee5).(params) + _paramlist_sizecxx . . $ _paramlist_size(53fcf07ba53ffee5).(stdparams) + 1; |
| 1452 | const char **par = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(par_cnt * sizeof(const char *)); |
| 1453 | size_t s = _paramlist_cpycxx . . $ _paramlist_cpy(95190fbbb843de08).(par, params); |
| 1454 | s += _paramlist_cpycxx . . $ _paramlist_cpy(95190fbbb843de08).(par + s, stdparams); |
| 1455 | |
| 1456 | int ret = oscap_source_apply_xslt_pathcxx . . $ oscap_source_apply_xslt_path(55db94cfa4db2719).(infile, xsltfile, outfile, par, oscap_path_to_xsltcxx . . $ oscap_path_to_xslt(33a1f659e94feb42).()); |
| 1457 | freecxx . . $ free(5d22bdacc48458e8).(par); |
| 1458 | return ret == -1; |
| 1459 | } |
| 1460 | |
| 1461 | static inline int _xccdf_gen_reportcxx . . $ _xccdf_gen_report(5c56c8ca62bd510f).(struct oscap_sourcecxx . . $ oscap_source# *infile, const char *id, const char *outfile, const char *show, const char* sce_template, const char* profile) |
| 1462 | { |
| 1463 | const char *params[] = { |
| 1464 | "result-id", id, |
| 1465 | "show", show, |
| 1466 | "profile", profile, |
| 1467 | "oval-template", "", |
| 1468 | "sce-template", sce_template, |
| 1469 | "verbosity", "", |
| 1470 | "hide-profile-info", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 1471 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!}; |
| 1472 | |
| 1473 | return _app_xsltcxx . . $ _app_xslt(d7e0091c5541e717).(infile, "xccdf-report.xsl", outfile, params); |
| 1474 | } |
| 1475 | |
| 1476 | static int _build_xccdf_result_sourcecxx . . $ _build_xccdf_result_source(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1477 | { |
| 1478 | if (session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1479 | return 0; |
| 1480 | } |
| 1481 | |
| 1482 | /* Build oscap_source of XCCDF TestResult only when needed */ |
| 1483 | if (session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1484 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1485 | |
| 1486 | if (session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1487 | // Attempt to export session before evaluation |
| 1488 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "No XCCDF results to export."); |
| 1489 | return 1; |
| 1490 | } |
| 1491 | |
| 1492 | if (session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1493 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *cloned_benchmark = xccdf_benchmark_clonecxx . . $ xccdf_benchmark_clone(b43dcbd8118bc005).(benchmark); |
| 1494 | struct xccdf_resultcxx . . $ xccdf_result# *cloned_result = xccdf_result_clonecxx . . $ xccdf_result_clone(53f64e8d9483251a).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1495 | xccdf_benchmark_add_resultcxx . . $ xccdf_benchmark_add_result(95f49eec48118fee).(cloned_benchmark, cloned_result); |
| 1496 | struct oscap_sourcecxx . . $ oscap_source# *xccdf_result_source = xccdf_benchmark_export_sourcecxx . . $ xccdf_benchmark_export_source(1f907351faeb5208).(cloned_benchmark, session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file.); |
| 1497 | // cloned_result is freed during xccdf_benchmark_free |
| 1498 | xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(cloned_benchmark); |
| 1499 | // Export XCCDF result file only when explicitly requested |
| 1500 | if (oscap_source_save_ascxx . . $ oscap_source_save_as(b44a10f6a0e05d3e).(xccdf_result_source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1501 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not save file: %s", |
| 1502 | oscap_source_readable_origin(xccdf_result_source)); |
| 1503 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(xccdf_result_source); |
| 1504 | return -1; |
| 1505 | } |
| 1506 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(xccdf_result_source); |
| 1507 | } |
| 1508 | |
| 1509 | if (session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1510 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *cloned_benchmark = xccdf_benchmark_clonecxx . . $ xccdf_benchmark_clone(b43dcbd8118bc005).(benchmark); |
| 1511 | struct xccdf_resultcxx . . $ xccdf_result# *cloned_result = xccdf_result_clonecxx . . $ xccdf_result_clone(53f64e8d9483251a).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1512 | xccdf_benchmark_add_resultcxx . . $ xccdf_benchmark_add_result(95f49eec48118fee).(cloned_benchmark, cloned_result); |
| 1513 | struct oscap_sourcecxx . . $ oscap_source# * stig_result = xccdf_result_stig_viewer_export_sourcecxx . . $ xccdf_result_stig_viewer_export_source(bc5d04d067386fad).(cloned_result, session->exportcxx . . $ xccdf_session#export..xccdf_stig_viewer_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_stig_viewer_file.); |
| 1514 | // cloned_result is freed during xccdf_benchmark_free |
| 1515 | xccdf_benchmark_freecxx . . $ xccdf_benchmark_free(55d89e1b9b447538).(cloned_benchmark); |
| 1516 | if (oscap_source_save_ascxx . . $ oscap_source_save_as(b44a10f6a0e05d3e).(stig_result, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1517 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not save file: %s", |
| 1518 | oscap_source_readable_origin(stig_result)); |
| 1519 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(stig_result); |
| 1520 | return -1; |
| 1521 | } |
| 1522 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(stig_result); |
| 1523 | } |
| 1524 | |
| 1525 | struct xccdf_resultcxx . . $ xccdf_result# *cloned_result = xccdf_result_clonecxx . . $ xccdf_result_clone(53f64e8d9483251a).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1526 | if (xccdf_session_is_sdscxx . . $ xccdf_session_is_sds(7ca1cfb6ae7817c7).(session)) { |
| 1527 | struct ds_sds_sessioncxx . . $ ds_sds_session# *sds_session = xccdf_session_get_ds_sds_sessioncxx . . $ xccdf_session_get_ds_sds_session(b0ba8265e6e08099).(session); |
| 1528 | const char *benchmark_uri = ds_sds_session_get_checklist_uricxx . . $ ds_sds_session_get_checklist_uri(5b4526c9616cba95).(sds_session); |
| 1529 | xccdf_result_set_benchmark_uricxx . . $ xccdf_result_set_benchmark_uri(2deabb2a41c12da7).(cloned_result, benchmark_uri); |
| 1530 | } |
| 1531 | xccdf_benchmark_add_resultcxx . . $ xccdf_benchmark_add_result(95f49eec48118fee).(benchmark, cloned_result); |
| 1532 | session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source. = xccdf_benchmark_export_sourcecxx . . $ xccdf_benchmark_export_source(1f907351faeb5208).(benchmark, session->exportcxx . . $ xccdf_session#export..xccdf_filecxx . . $ xccdf_session#$anonymous_type_3#xccdf_file.); |
| 1533 | /* validate XCCDF Results */ |
| 1534 | if (session->validatecxx . . $ xccdf_session#validate. && session->full_validationcxx . . $ xccdf_session#full_validation.) { |
| 1535 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source., _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 1536 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not export XCCDF Results correctly to %s", |
| 1537 | oscap_source_readable_origin(session->xccdf.result_source)); |
| 1538 | return 1; |
| 1539 | } |
| 1540 | } |
| 1541 | } |
| 1542 | return 0; |
| 1543 | } |
| 1544 | |
| 1545 | int xccdf_session_export_xccdfcxx . . $ xccdf_session_export_xccdf(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1546 | { |
| 1547 | if (_build_xccdf_result_sourcecxx . . $ _build_xccdf_result_source(dd871bf8776e7fa2).(session)) { |
| 1548 | return 1; |
| 1549 | } |
| 1550 | |
| 1551 | if (session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1552 | return 0; |
| 1553 | |
| 1554 | struct oscap_sourcecxx . . $ oscap_source#* arf = xccdf_session_create_arf_sourcecxx . . $ xccdf_session_create_arf_source(66c05d76889feaa2).(session); |
| 1555 | if (arf == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1556 | return 1; |
| 1557 | } |
| 1558 | |
| 1559 | /* generate report */ |
| 1560 | _xccdf_gen_reportcxx . . $ _xccdf_gen_report(5c56c8ca62bd510f).(arf, |
| 1561 | xccdf_result_get_idcxx . . $ xccdf_result_get_id(9b243840ec21a788).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.), |
| 1562 | session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file., |
| 1563 | "", |
| 1564 | (session->exportcxx . . $ xccdf_session#export..check_engine_plugins_resultscxx . . $ xccdf_session#$anonymous_type_3#check_engine_plugins_results. ? "%.result.xml" : ""), |
| 1565 | session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? "" : session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id. |
| 1566 | ); |
| 1567 | |
| 1568 | return 0; |
| 1569 | } |
| 1570 | |
| 1571 | static void _xccdf_session_free_oval_result_sourcescxx . . $ _xccdf_session_free_oval_result_sources(fc68940e73a0edd6).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1572 | { |
| 1573 | if (session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1574 | oscap_htable_freecxx . . $ oscap_htable_free(efa5da5da5d523d).(session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).); |
| 1575 | session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1576 | } |
| 1577 | } |
| 1578 | |
| 1579 | static char *_xccdf_session_get_unique_oval_result_filenamecxx . . $ _xccdf_session_get_unique_oval_result_filename(f22a983746bb587c).(struct xccdf_sessioncxx . . $ xccdf_session# *session, struct oval_agent_sessioncxx . . $ oval_agent_session# *oval_session, const char *oval_results_directory) |
| 1580 | { |
| 1581 | char *escaped_url = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1582 | const char *filename = oval_agent_get_filenamecxx . . $ oval_agent_get_filename(a289f324fc60a48).(oval_session); |
| 1583 | if (!filename) { |
| 1584 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Given oval_session doesn't have a valid filename. " |
| 1585 | "Can't deduce destination where we should be exporting it!"); |
| 1586 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1587 | } |
| 1588 | |
| 1589 | if (oscap_acquire_url_is_supportedcxx . . $ oscap_acquire_url_is_supported(c5f7da30cbc0f4e9).(filename) || strchrcxx . . $ strchr(2050848944e00d54).(filename, '/')) { |
| 1590 | // We need escaping if: |
| 1591 | // - filename is a URL |
| 1592 | // - filename is an absolute path |
| 1593 | |
| 1594 | escaped_url = oscap_acquire_url_to_filenamecxx . . $ oscap_acquire_url_to_filename(a8b8e32347182212).(filename); |
| 1595 | if (escaped_url == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1596 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1597 | } |
| 1598 | else if (!session->exportcxx . . $ xccdf_session#export..oval_resultscxx . . $ xccdf_session#$anonymous_type_3#oval_results. && strchrcxx . . $ strchr(2050848944e00d54).(filename, '/')) { |
| 1599 | // We need recursive mkdir_p if: |
| 1600 | // - filename is not a basename and we are exporting to a temp dir (ARF) |
| 1601 | // (we are assuming that the dir structure exists if we are exporting to '.') |
| 1602 | char *filename_cpy = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%s/%s", oval_results_directory, filename); |
| 1603 | if (oscap_acquire_ensure_parent_dircxx . . $ oscap_acquire_ensure_parent_dir(5c4306d8553b3696).(filename_cpy) != 0) { |
| 1604 | freecxx . . $ free(5d22bdacc48458e8).(filename_cpy); |
| 1605 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1606 | } |
| 1607 | freecxx . . $ free(5d22bdacc48458e8).(filename_cpy); |
| 1608 | } |
| 1609 | |
| 1610 | char *name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1611 | unsigned int suffix = 1; |
| 1612 | while (suffix < UINT_MAXcxx . . $ `<external>/67164224788392828/limits.h:124:9`!) |
| 1613 | { |
| 1614 | name = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`! * sizeof(char)); |
| 1615 | if (suffix == 1) |
| 1616 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(name, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s/%s.result.xml", oval_results_directory, escaped_url != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? escaped_url : filename); |
| 1617 | else |
| 1618 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(name, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%s/%s.result%i.xml", oval_results_directory, escaped_url != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? escaped_url : filename, suffix); |
| 1619 | |
| 1620 | // Try to guess how the real path will look like. This should avoid us rewriting |
| 1621 | // the results files if the OVAL happens to have the same name. We allow users |
| 1622 | // to shoot themselves to the foot, but it is not easy. They need to set-up |
| 1623 | // file->file symlink before scanning. |
| 1624 | char *final_name = oscap_acquire_guess_realpathcxx . . $ oscap_acquire_guess_realpath(a8b8e32347182212).(name); |
| 1625 | freecxx . . $ free(5d22bdacc48458e8).(name); |
| 1626 | name = final_name; |
| 1627 | if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1628 | freecxx . . $ free(5d22bdacc48458e8).(escaped_url); |
| 1629 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1630 | } |
| 1631 | if (oscap_htable_getcxx . . $ oscap_htable_get(f5c7e8ff6c970cd3).(session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources., name) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1632 | // Check if this export name conflicts with any other exported OVAL result. |
| 1633 | // |
| 1634 | // One example where a conflict can easily happen is if we have the |
| 1635 | // same OVAL file used for CPE platform evaluation and check evaluation. |
| 1636 | // |
| 1637 | // openscap will create 2 OVAL sessions for the same file and will try |
| 1638 | // to export 2 different OVAL result files to the same path. |
| 1639 | break; |
| 1640 | } |
| 1641 | |
| 1642 | freecxx . . $ free(5d22bdacc48458e8).(name); |
| 1643 | name = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1644 | ++suffix; |
| 1645 | } |
| 1646 | |
| 1647 | if (escaped_url != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1648 | freecxx . . $ free(5d22bdacc48458e8).(escaped_url); |
| 1649 | |
| 1650 | return name; |
| 1651 | } |
| 1652 | |
| 1653 | static char *_xccdf_session_export_oval_result_filecxx . . $ _xccdf_session_export_oval_result_file(4612fdb9227d41a0).(struct xccdf_sessioncxx . . $ xccdf_session# *session, struct oval_agent_sessioncxx . . $ oval_agent_session# *oval_session) |
| 1654 | { |
| 1655 | /* get result model and session name */ |
| 1656 | struct oval_results_modelcxx . . $ oval_results_model# *res_model = oval_agent_get_results_modelcxx . . $ oval_agent_get_results_model(8b7d7187bb31542e).(oval_session); |
| 1657 | /* Import XCCDF session without_sys_chars flag to res_model */ |
| 1658 | oval_results_model_set_export_system_characteristicscxx . . $ oval_results_model_set_export_system_characteristics(6f36610d00c3f37a).(res_model, !session->exportcxx . . $ xccdf_session#export..without_sys_charscxx . . $ xccdf_session#$anonymous_type_3#without_sys_chars.); |
| 1659 | const char* oval_results_directory = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1660 | |
| 1661 | if (session->exportcxx . . $ xccdf_session#export..oval_resultscxx . . $ xccdf_session#$anonymous_type_3#oval_results. == truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!) { |
| 1662 | oval_results_directory = "."; |
| 1663 | } |
| 1664 | else { |
| 1665 | if (!session->temp_dircxx . . $ xccdf_session#temp_dir.) |
| 1666 | session->temp_dircxx . . $ xccdf_session#temp_dir. = oscap_acquire_temp_dircxx . . $ oscap_acquire_temp_dir(41208ce6ca65dd58).(); |
| 1667 | if (session->temp_dircxx . . $ xccdf_session#temp_dir. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1668 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1669 | |
| 1670 | oval_results_directory = session->temp_dircxx . . $ xccdf_session#temp_dir.; |
| 1671 | } |
| 1672 | |
| 1673 | char *name = _xccdf_session_get_unique_oval_result_filenamecxx . . $ _xccdf_session_get_unique_oval_result_filename(f22a983746bb587c).(session, oval_session, oval_results_directory); |
| 1674 | |
| 1675 | if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1676 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Can't figure out the right filename for OVAL result file. Can't export that file!"); |
| 1677 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1678 | } |
| 1679 | |
| 1680 | struct oscap_sourcecxx . . $ oscap_source# *source = oval_results_model_export_sourcecxx . . $ oval_results_model_export_source(e532d9403ded9eaf).(res_model, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, name); |
| 1681 | if (source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1682 | freecxx . . $ free(5d22bdacc48458e8).(name); |
| 1683 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1684 | } |
| 1685 | if (oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources., name, source) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!) { |
| 1686 | // The source is already there, but it shouldn't be |
| 1687 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Internal error: attempted to export file %s twice", name); |
| 1688 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(source); |
| 1689 | freecxx . . $ free(5d22bdacc48458e8).(name); |
| 1690 | abortcxx . . $ abort(8df32a62017fbbf6).(); // Let's make this visible in debug mode |
| 1691 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1692 | } |
| 1693 | |
| 1694 | static int counter = 0; |
| 1695 | char *report_id = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("oval%d", counter++); |
| 1696 | const char *original_name = oval_agent_get_filenamecxx . . $ oval_agent_get_filename(a289f324fc60a48).(oval_session); |
| 1697 | char *results_file_name = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(name); |
| 1698 | if (!oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(session->ovalcxx . . $ xccdf_session#oval..results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping., original_name, results_file_name)){ |
| 1699 | freecxx . . $ free(5d22bdacc48458e8).(results_file_name); |
| 1700 | } |
| 1701 | if (!oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(session->ovalcxx . . $ xccdf_session#oval..arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping., original_name, report_id)) { |
| 1702 | freecxx . . $ free(5d22bdacc48458e8).(report_id); |
| 1703 | }; |
| 1704 | |
| 1705 | /* validate OVAL Results */ |
| 1706 | if (session->validatecxx . . $ xccdf_session#validate. && session->full_validationcxx . . $ xccdf_session#full_validation.) { |
| 1707 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) { |
| 1708 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not export OVAL Results correctly to %s", |
| 1709 | oscap_source_readable_origin(source)); |
| 1710 | freecxx . . $ free(5d22bdacc48458e8).(name); |
| 1711 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1712 | } |
| 1713 | } |
| 1714 | return name; |
| 1715 | } |
| 1716 | |
| 1717 | static int _build_oval_result_sourcescxx . . $ _build_oval_result_sources(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1718 | { |
| 1719 | if (session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1720 | return 0; |
| 1721 | } |
| 1722 | |
| 1723 | /* Export OVAL results */ |
| 1724 | session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources. = oscap_htable_newcxx . . $ oscap_htable_new(3c1cb2b6f390ad38).(); |
| 1725 | session->ovalcxx . . $ xccdf_session#oval..results_mappingcxx . . $ xccdf_session#$anonymous_type_2#results_mapping. = oscap_htable_newcxx . . $ oscap_htable_new(3c1cb2b6f390ad38).(); |
| 1726 | session->ovalcxx . . $ xccdf_session#oval..arf_report_mappingcxx . . $ xccdf_session#$anonymous_type_2#arf_report_mapping. = oscap_htable_newcxx . . $ oscap_htable_new(3c1cb2b6f390ad38).(); |
| 1727 | if (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.) { |
| 1728 | for (int i = 0; session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]; i++) { |
| 1729 | char *filename = _xccdf_session_export_oval_result_filecxx . . $ _xccdf_session_export_oval_result_file(4612fdb9227d41a0).(session, session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 1730 | if (filename == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1731 | _xccdf_session_free_oval_result_sourcescxx . . $ _xccdf_session_free_oval_result_sources(fc68940e73a0edd6).(session); |
| 1732 | return 1; |
| 1733 | } |
| 1734 | freecxx . . $ free(5d22bdacc48458e8).(filename); |
| 1735 | } |
| 1736 | } |
| 1737 | |
| 1738 | struct oscap_htable_iteratorcxx . . $ oscap_htable_iterator# *cpe_it = xccdf_policy_model_get_cpe_oval_sessionscxx . . $ xccdf_policy_model_get_cpe_oval_sessions(9b554956ed04d75e).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1739 | while (oscap_htable_iterator_has_morecxx . . $ oscap_htable_iterator_has_more(eba4198ab3388c55).(cpe_it)) { |
| 1740 | const char *key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1741 | struct oval_agent_sessioncxx . . $ oval_agent_session# *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1742 | oscap_htable_iterator_next_kvcxx . . $ oscap_htable_iterator_next_kv(6fdd88671b26854e).(cpe_it, &key, (void*)&value); |
| 1743 | |
| 1744 | char *filename = _xccdf_session_export_oval_result_filecxx . . $ _xccdf_session_export_oval_result_file(4612fdb9227d41a0).(session, value); |
| 1745 | if (filename == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1746 | _xccdf_session_free_oval_result_sourcescxx . . $ _xccdf_session_free_oval_result_sources(fc68940e73a0edd6).(session); |
| 1747 | oscap_htable_iterator_freecxx . . $ oscap_htable_iterator_free(e07ea5562ff119bd).(cpe_it); |
| 1748 | return 1; |
| 1749 | } |
| 1750 | freecxx . . $ free(5d22bdacc48458e8).(filename); |
| 1751 | } |
| 1752 | oscap_htable_iterator_freecxx . . $ oscap_htable_iterator_free(e07ea5562ff119bd).(cpe_it); |
| 1753 | return 0; |
| 1754 | } |
| 1755 | |
| 1756 | int xccdf_session_export_ovalcxx . . $ xccdf_session_export_oval(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1757 | { |
| 1758 | if (_build_oval_result_sourcescxx . . $ _build_oval_result_sources(dd871bf8776e7fa2).(session) != 0) { |
| 1759 | return 1; |
| 1760 | } |
| 1761 | struct oscap_htable_iteratorcxx . . $ oscap_htable_iterator# *hit = oscap_htable_iterator_newcxx . . $ oscap_htable_iterator_new(81743c99830972e7).(session->ovalcxx . . $ xccdf_session#oval..result_sourcescxx . . $ xccdf_session#$anonymous_type_2#result_sources.); |
| 1762 | while (oscap_htable_iterator_has_morecxx . . $ oscap_htable_iterator_has_more(eba4198ab3388c55).(hit)) { |
| 1763 | struct oscap_sourcecxx . . $ oscap_source# *source = oscap_htable_iterator_next_valuecxx . . $ oscap_htable_iterator_next_value(4e1156670e4376db).(hit); |
| 1764 | if (oscap_source_save_ascxx . . $ oscap_source_save_as(b44a10f6a0e05d3e).(source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1765 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not save file: %s", oscap_source_readable_origin(source)); |
| 1766 | oscap_htable_iterator_freecxx . . $ oscap_htable_iterator_free(e07ea5562ff119bd).(hit); |
| 1767 | return 1; |
| 1768 | } |
| 1769 | } |
| 1770 | oscap_htable_iterator_freecxx . . $ oscap_htable_iterator_free(e07ea5562ff119bd).(hit); |
| 1771 | |
| 1772 | /* Export variables */ |
| 1773 | if (session->exportcxx . . $ xccdf_session#export..oval_variablescxx . . $ xccdf_session#$anonymous_type_3#oval_variables. && session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1774 | for (int i = 0; session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]; ++i) { |
| 1775 | int j; |
| 1776 | char *sname; |
| 1777 | struct oval_definition_modelcxx . . $ oval_definition_model# *defmod; |
| 1778 | struct oval_variable_model_iteratorcxx . . $ oval_variable_model_iterator# *varmod_itr; |
| 1779 | char *escaped_url = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1780 | |
| 1781 | sname = (char *) oval_agent_get_filenamecxx . . $ oval_agent_get_filename(a289f324fc60a48).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 1782 | if (oscap_acquire_url_is_supportedcxx . . $ oscap_acquire_url_is_supported(c5f7da30cbc0f4e9).(sname)) { |
| 1783 | escaped_url = oscap_acquire_url_to_filenamecxx . . $ oscap_acquire_url_to_filename(a8b8e32347182212).(sname); |
| 1784 | if (escaped_url == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1785 | return 1; |
| 1786 | sname = escaped_url; |
| 1787 | } |
| 1788 | defmod = oval_agent_get_definition_modelcxx . . $ oval_agent_get_definition_model(6e9a49c1c153e814).(session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]); |
| 1789 | j = 0; |
| 1790 | varmod_itr = oval_definition_model_get_variable_modelscxx . . $ oval_definition_model_get_variable_models(c53421ebab0542be).(defmod); |
| 1791 | while (oval_variable_model_iterator_has_morecxx . . $ oval_variable_model_iterator_has_more(4ecf502c50f92d8e).(varmod_itr)) { |
| 1792 | const size_t fname_len = strlencxx . . $ strlen(751346f8406fd082).(sname) + 32; |
| 1793 | char *fname = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(fname_len); |
| 1794 | struct oval_variable_modelcxx . . $ oval_variable_model# *varmod; |
| 1795 | |
| 1796 | varmod = oval_variable_model_iterator_nextcxx . . $ oval_variable_model_iterator_next(883bbd22cc5fc798).(varmod_itr); |
| 1797 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(fname, fname_len, "%s-%d.variables-%d.xml", sname, i, j++); |
| 1798 | oval_variable_model_exportcxx . . $ oval_variable_model_export(85539664f1111985).(varmod, fname); |
| 1799 | freecxx . . $ free(5d22bdacc48458e8).(fname); |
| 1800 | } |
| 1801 | if (escaped_url != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1802 | freecxx . . $ free(5d22bdacc48458e8).(escaped_url); |
| 1803 | oval_variable_model_iterator_freecxx . . $ oval_variable_model_iterator_free(2dd836cbecd801ed).(varmod_itr); |
| 1804 | } |
| 1805 | } |
| 1806 | return 0; |
| 1807 | } |
| 1808 | |
| 1809 | int xccdf_session_export_check_engine_pluginscxx . . $ xccdf_session_export_check_engine_plugins(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1810 | { |
| 1811 | if (!session->exportcxx . . $ xccdf_session#export..check_engine_plugins_resultscxx . . $ xccdf_session#$anonymous_type_3#check_engine_plugins_results.) |
| 1812 | return 0; |
| 1813 | |
| 1814 | struct oscap_iteratorcxx . . $ oscap_iterator# *it = oscap_iterator_newcxx . . $ oscap_iterator_new(f89fb456dfd589d7).(session->check_engine_pluginscxx . . $ xccdf_session#check_engine_plugins.); |
| 1815 | |
| 1816 | int ret = 0; |
| 1817 | while (oscap_iterator_has_morecxx . . $ oscap_iterator_has_more(63b1de9a5adb9205).(it)) { |
| 1818 | struct check_engine_plugin_defcxx . . $ check_engine_plugin_def# *plugin = (struct check_engine_plugin_defcxx . . $ check_engine_plugin_def# *)oscap_iterator_nextcxx . . $ oscap_iterator_next(4c75051c806960eb).(it); |
| 1819 | |
| 1820 | if (check_engine_plugin_export_resultscxx . . $ check_engine_plugin_export_results(91b4e5814a106804).( |
| 1821 | plugin, |
| 1822 | session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., |
| 1823 | session->validatecxx . . $ xccdf_session#validate. && session->full_validationcxx . . $ xccdf_session#full_validation., |
| 1824 | oscap_source_readable_origincxx . . $ oscap_source_readable_origin(1485dc36ee4b63be).(session->xccdfcxx . . $ xccdf_session#xccdf..sourcecxx . . $ xccdf_session#$anonymous_type_0#source.)) != 0) |
| 1825 | ret = 1; |
| 1826 | } |
| 1827 | |
| 1828 | oscap_iterator_freecxx . . $ oscap_iterator_free(3cba44c1b7872358).(it); |
| 1829 | |
| 1830 | return ret; |
| 1831 | } |
| 1832 | |
| 1833 | int xccdf_session_export_arfcxx . . $ xccdf_session_export_arf(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1834 | { |
| 1835 | if (session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1836 | struct oscap_sourcecxx . . $ oscap_source#* arf_source = xccdf_session_create_arf_sourcecxx . . $ xccdf_session_create_arf_source(66c05d76889feaa2).(session); |
| 1837 | if (arf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1838 | return 1; |
| 1839 | } |
| 1840 | |
| 1841 | if (oscap_source_save_ascxx . . $ oscap_source_save_as(b44a10f6a0e05d3e).(arf_source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1842 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(arf_source); |
| 1843 | session->ovalcxx . . $ xccdf_session#oval..arf_reportcxx . . $ xccdf_session#$anonymous_type_2#arf_report. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1844 | return 1; |
| 1845 | } |
| 1846 | if (session->full_validationcxx . . $ xccdf_session#full_validation.) { |
| 1847 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(arf_source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 1848 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(arf_source); |
| 1849 | return 1; |
| 1850 | } |
| 1851 | } |
| 1852 | } |
| 1853 | return 0; |
| 1854 | } |
| 1855 | |
| 1856 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(struct xccdf_policy_model *, xccdf_session, policy_model, xccdf.policy_model) |
| 1857 | OSCAP_GENERIC_GETTERcxx . . $ `src/common/util.h:78:9`!(float, xccdf_session, base_score, xccdf.base_score); |
| 1858 | |
| 1859 | struct xccdf_policycxx . . $ xccdf_policy# *xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1860 | { |
| 1861 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1862 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Cannot build xccdf_policy."); |
| 1863 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1864 | } |
| 1865 | return xccdf_policy_model_get_policy_by_idcxx . . $ xccdf_policy_model_get_policy_by_id(3a48227fe1c1225a).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id.); |
| 1866 | } |
| 1867 | |
| 1868 | unsigned int xccdf_session_get_oval_agents_countcxx . . $ xccdf_session_get_oval_agents_count(7d574afcdd801a3).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1869 | { |
| 1870 | unsigned int i = 0; |
| 1871 | if (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1872 | while (session->ovalcxx . . $ xccdf_session#oval..agentscxx . . $ xccdf_session#$anonymous_type_2#agents.[i]) |
| 1873 | i++; |
| 1874 | return i; |
| 1875 | } |
| 1876 | |
| 1877 | unsigned int xccdf_session_get_cpe_oval_agents_countcxx . . $ xccdf_session_get_cpe_oval_agents_count(7d574afcdd801a3).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1878 | { |
| 1879 | if (session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1880 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Cannot build xccdf_policy."); |
| 1881 | return 0; |
| 1882 | } |
| 1883 | |
| 1884 | unsigned int i = 0; |
| 1885 | struct oscap_htable_iteratorcxx . . $ oscap_htable_iterator# *it = xccdf_policy_model_get_cpe_oval_sessionscxx . . $ xccdf_policy_model_get_cpe_oval_sessions(9b554956ed04d75e).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1886 | while (oscap_htable_iterator_has_morecxx . . $ oscap_htable_iterator_has_more(eba4198ab3388c55).(it)) { |
| 1887 | oscap_htable_iterator_nextcxx . . $ oscap_htable_iterator_next(98c5256d433bc020).(it); |
| 1888 | i++; |
| 1889 | } |
| 1890 | oscap_htable_iterator_freecxx . . $ oscap_htable_iterator_free(e07ea5562ff119bd).(it); |
| 1891 | |
| 1892 | return i; |
| 1893 | } |
| 1894 | |
| 1895 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_session_contains_fail_resultcxx . . $ xccdf_session_contains_fail_result(7ca1cfb6ae7817c7).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1896 | { |
| 1897 | struct xccdf_rule_result_iteratorcxx . . $ xccdf_rule_result_iterator# *res_it = xccdf_result_get_rule_resultscxx . . $ xccdf_result_get_rule_results(6465447fe4419503).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1898 | while (xccdf_rule_result_iterator_has_morecxx . . $ xccdf_rule_result_iterator_has_more(4b8217bc6f572439).(res_it)) { |
| 1899 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *res = xccdf_rule_result_iterator_nextcxx . . $ xccdf_rule_result_iterator_next(e8bc98eb60cdbb5a).(res_it); |
| 1900 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# rule_result = xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(res); |
| 1901 | if (rule_result == XCCDF_RESULT_FAILcxx . . $ XCCDF_RESULT_FAIL. || |
| 1902 | rule_result == XCCDF_RESULT_UNKNOWNcxx . . $ XCCDF_RESULT_UNKNOWN. || |
| 1903 | rule_result == XCCDF_RESULT_ERRORcxx . . $ XCCDF_RESULT_ERROR.) { |
| 1904 | xccdf_rule_result_iterator_freecxx . . $ xccdf_rule_result_iterator_free(c5d87bde560339c3).(res_it); |
| 1905 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 1906 | } |
| 1907 | } |
| 1908 | xccdf_rule_result_iterator_freecxx . . $ xccdf_rule_result_iterator_free(c5d87bde560339c3).(res_it); |
| 1909 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1910 | } |
| 1911 | |
| 1912 | struct xccdf_rule_result_iteratorcxx . . $ xccdf_rule_result_iterator# *xccdf_session_get_rule_resultscxx . . $ xccdf_session_get_rule_results(81a24db930d8aadf).(const struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1913 | { |
| 1914 | return xccdf_result_get_rule_resultscxx . . $ xccdf_result_get_rule_results(6465447fe4419503).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1915 | } |
| 1916 | |
| 1917 | int xccdf_session_remediatecxx . . $ xccdf_session_remediate(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 1918 | { |
| 1919 | int res = 0; |
| 1920 | if (session == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || |
| 1921 | xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || |
| 1922 | session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1923 | return 1; |
| 1924 | if(getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT") != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1925 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Can't perform remediation in offline mode: not implemented"); |
| 1926 | return 1; |
| 1927 | } |
| 1928 | xccdf_policy_model_unregister_enginescxx . . $ xccdf_policy_model_unregister_engines(7c84e7be56876a5f).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model., oval_sysnamecxx . . $ oval_sysname.); |
| 1929 | if ((res = xccdf_session_load_ovalcxx . . $ xccdf_session_load_oval(dd871bf8776e7fa2).(session)) != 0) |
| 1930 | return res; |
| 1931 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_get_benchmarkcxx . . $ xccdf_policy_get_benchmark(2b37a6455229dc70).(xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session)); |
| 1932 | xccdf_result_set_versioncxx . . $ xccdf_result_set_version(2deabb2a41c12da7).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result., |
| 1933 | benchmark != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? xccdf_benchmark_get_versioncxx . . $ xccdf_benchmark_get_version(6371e83a9c397dc3).(benchmark) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1934 | xccdf_result_fill_sysinfocxx . . $ xccdf_result_fill_sysinfo(731f9fbfcaef207c).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1935 | |
| 1936 | if ((res = xccdf_policy_remediatecxx . . $ xccdf_policy_remediate(c13e896f71b5e244).(xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session), session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.)) != 0) |
| 1937 | return res; |
| 1938 | |
| 1939 | xccdf_result_set_start_time_currentcxx . . $ xccdf_result_set_start_time_current(d573a91df5d5af14).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1940 | return xccdf_policy_recalculate_scorecxx . . $ xccdf_policy_recalculate_score(c13e896f71b5e244).(xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session), session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1941 | } |
| 1942 | |
| 1943 | int xccdf_session_build_policy_from_testresultcxx . . $ xccdf_session_build_policy_from_testresult(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *testresult_id) |
| 1944 | { |
| 1945 | if (session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1946 | session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1947 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(session->xccdfcxx . . $ xccdf_session#xccdf..policy_modelcxx . . $ xccdf_session#$anonymous_type_0#policy_model.); |
| 1948 | struct xccdf_resultcxx . . $ xccdf_result# *result = xccdf_benchmark_get_result_by_id_suffixcxx . . $ xccdf_benchmark_get_result_by_id_suffix(b753539274b1de3b).(benchmark, testresult_id); |
| 1949 | if (result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1950 | if (testresult_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1951 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not find latest TestResult element."); |
| 1952 | else |
| 1953 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not find TestResult/@id=\"%s\"", testresult_id); |
| 1954 | return 1; |
| 1955 | } |
| 1956 | session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. = xccdf_result_clonecxx . . $ xccdf_result_clone(53f64e8d9483251a).(result); |
| 1957 | } |
| 1958 | |
| 1959 | const char *profile_id = xccdf_result_get_profilecxx . . $ xccdf_result_get_profile(9b243840ec21a788).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1960 | if (xccdf_session_set_profile_idcxx . . $ xccdf_session_set_profile_id(5281e12fff4127ed).(session, profile_id) == falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!) { |
| 1961 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 1962 | "Could not find Profile/@id=\"%s\" to build policy from TestResult/@id=\"%s\"", |
| 1963 | profile_id, testresult_id); |
| 1964 | return 1; |
| 1965 | } |
| 1966 | struct xccdf_policycxx . . $ xccdf_policy# *xccdf_policy = xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session); |
| 1967 | if (xccdf_policy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1968 | return 1; |
| 1969 | xccdf_policy_add_resultcxx . . $ xccdf_policy_add_result(f4ee17754169c3e6).(xccdf_policy, session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.); |
| 1970 | return 0; |
| 1971 | } |
| 1972 | |
| 1973 | int xccdf_session_add_report_from_sourcecxx . . $ xccdf_session_add_report_from_source(6b23355d2c1822cf).(struct xccdf_sessioncxx . . $ xccdf_session# *session, struct oscap_sourcecxx . . $ oscap_source# *report_source) |
| 1974 | { |
| 1975 | struct xccdf_resultcxx . . $ xccdf_result# *result = xccdf_result_import_sourcecxx . . $ xccdf_result_import_source(973913e43cf53496).(report_source); |
| 1976 | if (result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1977 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not find TestResult element."); |
| 1978 | return 1; |
| 1979 | } |
| 1980 | session->xccdfcxx . . $ xccdf_session#xccdf..result_sourcecxx . . $ xccdf_session#$anonymous_type_0#result_source. = report_source; |
| 1981 | session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result. = result; |
| 1982 | return 0; |
| 1983 | } |
| 1984 | |
| 1985 | int xccdf_session_generate_guidecxx . . $ xccdf_session_generate_guide(c44cfbc8af8f9f18).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *outfile) |
| 1986 | { |
| 1987 | struct xccdf_policycxx . . $ xccdf_policy# *policy = xccdf_session_get_xccdf_policycxx . . $ xccdf_session_get_xccdf_policy(7e1ccd92df822b71).(session); |
| 1988 | if (policy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1989 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not get XCCDF policy."); |
| 1990 | return 1; |
| 1991 | } |
| 1992 | struct xccdf_policy_modelcxx . . $ xccdf_policy_model# *model = xccdf_policy_get_modelcxx . . $ xccdf_policy_get_model(f98af4da2524e136).(policy); |
| 1993 | if (model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1994 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not get XCCDF policy model."); |
| 1995 | return 1; |
| 1996 | } |
| 1997 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark = xccdf_policy_model_get_benchmarkcxx . . $ xccdf_policy_model_get_benchmark(a911a8e37770e756).(model); |
| 1998 | if (benchmark == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1999 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not get XCCDF benchmark."); |
| 2000 | return 1; |
| 2001 | } |
| 2002 | xccdf_benchmark_include_tailored_profilescxx . . $ xccdf_benchmark_include_tailored_profiles(d7a6825148f95977).(benchmark); |
| 2003 | const char *params[] = { |
| 2004 | "oscap-version", oscap_get_versioncxx . . $ oscap_get_version(33a1f659e94feb42).(), |
| 2005 | "benchmark_id", xccdf_benchmark_get_idcxx . . $ xccdf_benchmark_get_id(6371e83a9c397dc3).(benchmark), |
| 2006 | "profile_id", xccdf_session_get_profile_idcxx . . $ xccdf_session_get_profile_id(f99217dc5fad66c6).(session), |
| 2007 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 2008 | }; |
| 2009 | struct oscap_sourcecxx . . $ oscap_source# *benchmark_source = xccdf_benchmark_export_sourcecxx . . $ xccdf_benchmark_export_source(1f907351faeb5208).(benchmark, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 2010 | if (benchmark_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 2011 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, |
| 2012 | "Failed to export source from XCCDF benchmark %s.", |
| 2013 | xccdf_benchmark_get_id(benchmark)); |
| 2014 | return 1; |
| 2015 | } |
| 2016 | int ret = oscap_source_apply_xslt_pathcxx . . $ oscap_source_apply_xslt_path(55db94cfa4db2719).(benchmark_source, |
| 2017 | "xccdf-guide.xsl", outfile, params, oscap_path_to_xsltcxx . . $ oscap_path_to_xslt(33a1f659e94feb42).()); |
| 2018 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(benchmark_source); |
| 2019 | if (ret < 0) { |
| 2020 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_OSCAPcxx . . $ `src/common/public/oscap_error.h:60:9`!, "Could not apply XSLT."); |
| 2021 | return 1; |
| 2022 | } |
| 2023 | return 0; |
| 2024 | } |
| 2025 | |
| 2026 | int xccdf_session_export_allcxx . . $ xccdf_session_export_all(dd871bf8776e7fa2).(struct xccdf_sessioncxx . . $ xccdf_session# *session) |
| 2027 | { |
| 2028 | int ret = 0; |
| 2029 | struct oscap_sourcecxx . . $ oscap_source# *arf_source = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 2030 | |
| 2031 | if (_build_xccdf_result_sourcecxx . . $ _build_xccdf_result_source(dd871bf8776e7fa2).(session)) { |
| 2032 | ret = 1; |
| 2033 | goto cleanup; |
| 2034 | } |
| 2035 | |
| 2036 | if (session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 2037 | goto cleanup; |
| 2038 | } |
| 2039 | |
| 2040 | arf_source = xccdf_session_extract_arf_sourcecxx . . $ xccdf_session_extract_arf_source(66c05d76889feaa2).(session); |
| 2041 | if (arf_source == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 2042 | ret = 1; |
| 2043 | goto cleanup; |
| 2044 | } |
| 2045 | |
| 2046 | if (session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 2047 | /* generate report */ |
| 2048 | _xccdf_gen_reportcxx . . $ _xccdf_gen_report(5c56c8ca62bd510f).(arf_source, |
| 2049 | xccdf_result_get_idcxx . . $ xccdf_result_get_id(9b243840ec21a788).(session->xccdfcxx . . $ xccdf_session#xccdf..resultcxx . . $ xccdf_session#$anonymous_type_0#result.), |
| 2050 | session->exportcxx . . $ xccdf_session#export..report_filecxx . . $ xccdf_session#$anonymous_type_3#report_file., |
| 2051 | "", |
| 2052 | (session->exportcxx . . $ xccdf_session#export..check_engine_plugins_resultscxx . . $ xccdf_session#$anonymous_type_3#check_engine_plugins_results. ? "%.result.xml" : ""), |
| 2053 | session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? "" : session->xccdfcxx . . $ xccdf_session#xccdf..profile_idcxx . . $ xccdf_session#$anonymous_type_0#profile_id. |
| 2054 | ); |
| 2055 | } |
| 2056 | |
| 2057 | if (session->exportcxx . . $ xccdf_session#export..arf_filecxx . . $ xccdf_session#$anonymous_type_3#arf_file. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 2058 | if (oscap_source_save_ascxx . . $ oscap_source_save_as(b44a10f6a0e05d3e).(arf_source, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 2059 | ret = 1; |
| 2060 | goto cleanup; |
| 2061 | } |
| 2062 | if (session->full_validationcxx . . $ xccdf_session#full_validation.) { |
| 2063 | if (oscap_source_validatecxx . . $ oscap_source_validate(58e1cfedb30f1c20).(arf_source, _reportercxx . . $ _reporter(710d628f83af7da6)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) != 0) { |
| 2064 | ret = 1; |
| 2065 | goto cleanup; |
| 2066 | } |
| 2067 | } |
| 2068 | } |
| 2069 | |
| 2070 | cleanup: |
| 2071 | oscap_source_freecxx . . $ oscap_source_free(1a322e80279420f6).(arf_source); |
| 2072 | return ret; |
| 2073 | } |
| 2074 | |
| 2075 | void xccdf_session_set_reference_filtercxx . . $ xccdf_session_set_reference_filter(e1b914460d223154).(struct xccdf_sessioncxx . . $ xccdf_session# *session, const char *reference_filter) |
| 2076 | { |
| 2077 | session->reference_parametercxx . . $ xccdf_session#reference_parameter. = reference_filter; |
| 2078 | } |
| 2079 | |
| 2080 | void xccdf_session_set_show_rule_detailscxx . . $ xccdf_session_set_show_rule_details(5724eff0bd74b67a).(struct xccdf_sessioncxx . . $ xccdf_session# *session, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! show_rule_details) |
| 2081 | { |
| 2082 | session->show_rule_detailscxx . . $ xccdf_session#show_rule_details. = show_rule_details; |
| 2083 | } |