| 1 | /* |
| 2 | * Copyright 2010 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * Lukas Kuklinek <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 24 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 25 | #endif |
| 26 | |
| 27 | #include <math.h> |
| 28 | #include <string.h> |
| 29 | |
| 30 | #ifdef OS_WINDOWS |
| 31 | /* By defining WIN32_LEAN_AND_MEAN we ensure that Windows.h won't include |
| 32 | * winsock.h, which would conflict with symbols from WinSock2.h. |
| 33 | */ |
| 34 | #ifndef WIN32_LEAN_AND_MEAN |
| 35 | #define WIN32_LEAN_AND_MEAN |
| 36 | #endif |
| 37 | #include <winsock2.h> |
| 38 | #include <iphlpapi.h> |
| 39 | #include <windows.h> |
| 40 | #include <ws2def.h> |
| 41 | #include <io.h> |
| 42 | #include <winternl.h> |
| 43 | #include <lmcons.h> |
| 44 | #else |
| 45 | #include <unistd.h> |
| 46 | #endif |
| 47 | |
| 48 | #ifdef OSCAP_UNIXcxx . . $ `compat/compat.h:41:9`! |
| 49 | #include <sys/utsname.h> |
| 50 | #include <arpa/inet.h> |
| 51 | #include <netdb.h> |
| 52 | #include <sys/socket.h> |
| 53 | #include <pwd.h> |
| 54 | #include <sys/types.h> |
| 55 | #endif |
| 56 | |
| 57 | #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!) |
| 58 | #include <ifaddrs.h> |
| 59 | #include <net/if.h> |
| 60 | #include <sys/ioctl.h> |
| 61 | #endif |
| 62 | |
| 63 | #if defined(OS_FREEBSD) |
| 64 | #include <arpa/inet.h> |
| 65 | #include <arpa/inet.h> |
| 66 | #include <ifaddrs.h> |
| 67 | #include <net/if.h> |
| 68 | #include <netinet/in.h> |
| 69 | #include <sys/ioctl.h> |
| 70 | #include <sys/sockio.h> |
| 71 | #endif |
| 72 | |
| 73 | #include "item.h"cxx . . $ `<file>/src/XCCDF/item.h`/ |
| 74 | #include "helpers.h"cxx . . $ `<file>/src/XCCDF/helpers.h`/ |
| 75 | #include "xccdf_impl.h"cxx . . $ `<file>/src/XCCDF/xccdf_impl.h`/ |
| 76 | #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/ |
| 77 | #include "oscap_text.h"cxx . . $ `<file>/src/common/public/oscap_text.h`/ |
| 78 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 79 | #include "source/oscap_source_priv.h"cxx . . $ `<file>/src/source/oscap_source_priv.h`/ |
| 80 | #include "oscap_helpers.h"cxx . . $ `<file>/src/common/public/oscap_helpers.h`/ |
| 81 | |
| 82 | #define XCCDF_NUMERIC_SIZEcxx . . $ `src/XCCDF/result.c:82:9`! 32 |
| 83 | |
| 84 | #ifdef OS_WINDOWS |
| 85 | #define timezone _timezone |
| 86 | #endif |
| 87 | |
| 88 | #ifndef HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`! |
| 89 | #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX |
| 90 | #endif |
| 91 | |
| 92 | // References containing STIG Rule IDs can be found by their href attribute, it must match the following url |
| 93 | static const char *DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[] = { "http://iase.disa.mil/stigs/Pages/stig-viewing-guidance.aspx", |
| 94 | "https://public.cyber.mil/stigs/srg-stig-tools/", |
| 95 | "https://www.cyber.mil/stigs/srg-stig-tools/" }; |
| 96 | |
| 97 | // constants |
| 98 | static const xccdf_numericcxx . . $ xccdf_numeric# XCCDF_SCORE_MAX_DAFAULTcxx . . $ XCCDF_SCORE_MAX_DAFAULT. = 100.0f; |
| 99 | static const char *XCCDF_INSTANCE_DEFAULT_CONTEXTcxx . . $ XCCDF_INSTANCE_DEFAULT_CONTEXT. = "undefined"; |
| 100 | const char *XCCDF_NUMERIC_FORMATcxx . . $ XCCDF_NUMERIC_FORMAT. = "%f"; |
| 101 | |
| 102 | // prototypes |
| 103 | void xccdf_rule_result_freecxx . . $ xccdf_rule_result_free(c1e523a8884af7c6).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rr); |
| 104 | void xccdf_identity_freecxx . . $ xccdf_identity_free(da17430d7491a0b1).(struct xccdf_identitycxx . . $ xccdf_identity# *identity); |
| 105 | void xccdf_score_freecxx . . $ xccdf_score_free(3879543088f5564c).(struct xccdf_scorecxx . . $ xccdf_score# *score); |
| 106 | void xccdf_target_fact_freecxx . . $ xccdf_target_fact_free(6eebfbd756c3469b).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact); |
| 107 | void xccdf_message_freecxx . . $ xccdf_message_free(e43b8b7aa83d98d8).(struct xccdf_messagecxx . . $ xccdf_message# *msg); |
| 108 | void xccdf_instance_freecxx . . $ xccdf_instance_free(f0e1e3efba2b10f5).(struct xccdf_instancecxx . . $ xccdf_instance# *inst); |
| 109 | void xccdf_override_freecxx . . $ xccdf_override_free(a9dcf5f2d9947221).(struct xccdf_overridecxx . . $ xccdf_override# *oride); |
| 110 | |
| 111 | struct xccdf_resultcxx . . $ xccdf_result# *xccdf_result_newcxx . . $ xccdf_result_new(619d03edcb8ef9cb).(void) |
| 112 | { |
| 113 | struct xccdf_itemcxx . . $ xccdf_item# *result = xccdf_item_newcxx . . $ xccdf_item_new(8094a7806c065071).(XCCDF_RESULTcxx . . $ XCCDF_RESULT., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 114 | oscap_create_listscxx . . $ oscap_create_lists(ec4abf0a650ab9a0).(&result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..identitiescxx . . $ xccdf_result_item#identities., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., |
| 115 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..remarkscxx . . $ xccdf_result_item#remarks., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., |
| 116 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_factscxx . . $ xccdf_result_item#target_facts., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_id_refscxx . . $ xccdf_result_item#target_id_refs., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..applicable_platformscxx . . $ xccdf_result_item#applicable_platforms., |
| 117 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..setvaluescxx . . $ xccdf_result_item#setvalues., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..organizationscxx . . $ xccdf_result_item#organizations., |
| 118 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..rule_resultscxx . . $ xccdf_result_item#rule_results., &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..scorescxx . . $ xccdf_result_item#scores., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 119 | return XRESULTcxx . . $ `src/XCCDF/helpers.h:37:9`!(result); |
| 120 | } |
| 121 | |
| 122 | struct xccdf_resultcxx . . $ xccdf_result# * xccdf_result_clonecxx . . $ xccdf_result_clone(53f64e8d9483251a).(const struct xccdf_resultcxx . . $ xccdf_result# * result) |
| 123 | { |
| 124 | struct xccdf_itemcxx . . $ xccdf_item# *new_result = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_itemcxx . . $ xccdf_item#) + sizeof(struct xccdf_result_itemcxx . . $ xccdf_result_item#)); |
| 125 | struct xccdf_itemcxx . . $ xccdf_item# *old = XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(result); |
| 126 | xccdf_item_base_clonecxx . . $ xccdf_item_base_clone(f0db45ff8e952d03).(&new_result->itemcxx . . $ xccdf_item#item., &(old->itemcxx . . $ xccdf_item#item.)); |
| 127 | new_result->typecxx . . $ xccdf_item#type. = old->typecxx . . $ xccdf_item#type.; |
| 128 | xccdf_result_item_clonecxx . . $ xccdf_result_item_clone(35c0cd21daafc548).(&new_result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result., &old->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result.); |
| 129 | return XRESULTcxx . . $ `src/XCCDF/helpers.h:37:9`!(new_result); |
| 130 | } |
| 131 | |
| 132 | static inline void xccdf_result_free_implcxx . . $ xccdf_result_free_impl(9e1ae929b010245a).(struct xccdf_itemcxx . . $ xccdf_item# *result) |
| 133 | { |
| 134 | if (result != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 135 | freecxx . . $ free(5d22bdacc48458e8).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..start_timecxx . . $ xccdf_result_item#start_time.); |
| 136 | freecxx . . $ free(5d22bdacc48458e8).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..end_timecxx . . $ xccdf_result_item#end_time.); |
| 137 | freecxx . . $ free(5d22bdacc48458e8).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..test_systemcxx . . $ xccdf_result_item#test_system.); |
| 138 | freecxx . . $ free(5d22bdacc48458e8).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..benchmark_uricxx . . $ xccdf_result_item#benchmark_uri.); |
| 139 | freecxx . . $ free(5d22bdacc48458e8).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..profilecxx . . $ xccdf_result_item#profile.); |
| 140 | |
| 141 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..identitiescxx . . $ xccdf_result_item#identities., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_identity_freecxx . . $ xccdf_identity_free(da17430d7491a0b1).); |
| 142 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_factscxx . . $ xccdf_result_item#target_facts., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_target_fact_freecxx . . $ xccdf_target_fact_free(6eebfbd756c3469b).); |
| 143 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_id_refscxx . . $ xccdf_result_item#target_id_refs., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_target_identifier_freecxx . . $ xccdf_target_identifier_free(d2d502002cc89565).); |
| 144 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..applicable_platformscxx . . $ xccdf_result_item#applicable_platforms., freecxx . . $ free(5d22bdacc48458e8).); |
| 145 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., freecxx . . $ free(5d22bdacc48458e8).); |
| 146 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..scorescxx . . $ xccdf_result_item#scores., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_score_freecxx . . $ xccdf_score_free(3879543088f5564c).); |
| 147 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..remarkscxx . . $ xccdf_result_item#remarks., (oscap_destruct_funccxx . . $ oscap_destruct_func#) oscap_text_freecxx . . $ oscap_text_free(c2630df24779e845).); |
| 148 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., freecxx . . $ free(5d22bdacc48458e8).); |
| 149 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..setvaluescxx . . $ xccdf_result_item#setvalues., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_setvalue_freecxx . . $ xccdf_setvalue_free(4e1721da774cec50).); |
| 150 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..rule_resultscxx . . $ xccdf_result_item#rule_results., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_rule_result_freecxx . . $ xccdf_rule_result_free(c1e523a8884af7c6).); |
| 151 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..organizationscxx . . $ xccdf_result_item#organizations., freecxx . . $ free(5d22bdacc48458e8).); |
| 152 | |
| 153 | xccdf_item_releasecxx . . $ xccdf_item_release(9e1ae929b010245a).(result); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | XCCDF_FREE_GENcxx . . $ `src/XCCDF/helpers.h:221:9`!(result) |
| 158 | |
| 159 | XCCDF_ACCESSOR_SIMPLEcxx . . $ `src/XCCDF/helpers.h:115:9`!(result, const struct xccdf_version_info*, schema_version); |
| 160 | XCCDF_ACCESSOR_STRINGcxx . . $ `src/XCCDF/helpers.h:113:9`!(result, start_time) |
| 161 | XCCDF_ACCESSOR_STRINGcxx . . $ `src/XCCDF/helpers.h:113:9`!(result, end_time) |
| 162 | XCCDF_ACCESSOR_STRINGcxx . . $ `src/XCCDF/helpers.h:113:9`!(result, test_system) |
| 163 | XCCDF_ACCESSOR_STRINGcxx . . $ `src/XCCDF/helpers.h:113:9`!(result, benchmark_uri) |
| 164 | XCCDF_ACCESSOR_STRINGcxx . . $ `src/XCCDF/helpers.h:113:9`!(result, profile) |
| 165 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, identity, identities) |
| 166 | XCCDF_LISTMANIP_STRINGcxx . . $ `src/XCCDF/helpers.h:124:9`!(result, target, targets) |
| 167 | XCCDF_LISTMANIP_STRINGcxx . . $ `src/XCCDF/helpers.h:124:9`!(result, target_address, target_addresses) |
| 168 | XCCDF_LISTMANIP_STRINGcxx . . $ `src/XCCDF/helpers.h:124:9`!(result, organization, organizations) |
| 169 | XCCDF_LISTMANIP_TEXTcxx . . $ `src/XCCDF/helpers.h:128:9`!(result, remark, remarks) |
| 170 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, target_fact, target_facts) |
| 171 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, target_identifier, target_id_refs) |
| 172 | XCCDF_LISTMANIP_STRINGcxx . . $ `src/XCCDF/helpers.h:124:9`!(result, applicable_platform, applicable_platforms) |
| 173 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, setvalue, setvalues) |
| 174 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, rule_result, rule_results) |
| 175 | XCCDF_LISTMANIPcxx . . $ `src/XCCDF/helpers.h:122:9`!(result, score, scores) |
| 176 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_result) |
| 177 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_result) |
| 178 | |
| 179 | static inline void _xccdf_result_add_target_fact_uniqcxx . . $ _xccdf_result_add_target_fact_uniq(30b51456bf657b59).(struct xccdf_resultcxx . . $ xccdf_result# *result, struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact) |
| 180 | { |
| 181 | struct xccdf_target_fact_iteratorcxx . . $ xccdf_target_fact_iterator# *target_facts = xccdf_result_get_target_factscxx . . $ xccdf_result_get_target_facts(23d7992f0d28a237).(result); |
| 182 | while (xccdf_target_fact_iterator_has_morecxx . . $ xccdf_target_fact_iterator_has_more(cad91995bc54c721).(target_facts)) { |
| 183 | struct xccdf_target_factcxx . . $ xccdf_target_fact# *target_fact = xccdf_target_fact_iterator_nextcxx . . $ xccdf_target_fact_iterator_next(f0af6a17bc4899ff).(target_facts); |
| 184 | if (target_fact->typecxx . . $ xccdf_target_fact#type. == fact->typecxx . . $ xccdf_target_fact#type.) |
| 185 | if (target_fact->namecxx . . $ xccdf_target_fact#name. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && fact->namecxx . . $ xccdf_target_fact#name. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(target_fact->namecxx . . $ xccdf_target_fact#name., fact->namecxx . . $ xccdf_target_fact#name.)) |
| 186 | if (target_fact->valuecxx . . $ xccdf_target_fact#value. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && fact->valuecxx . . $ xccdf_target_fact#value. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(target_fact->valuecxx . . $ xccdf_target_fact#value., fact->valuecxx . . $ xccdf_target_fact#value.)) { |
| 187 | xccdf_target_fact_freecxx . . $ xccdf_target_fact_free(6eebfbd756c3469b).(fact); |
| 188 | goto exit; |
| 189 | } |
| 190 | } |
| 191 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 192 | exit: |
| 193 | xccdf_target_fact_iterator_freecxx . . $ xccdf_target_fact_iterator_free(530a04dc77960699).(target_facts); |
| 194 | } |
| 195 | |
| 196 | static inline void _xccdf_result_fill_scannercxx . . $ _xccdf_result_fill_scanner(731f9fbfcaef207c).(struct xccdf_resultcxx . . $ xccdf_result# *result) |
| 197 | { |
| 198 | struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 199 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 200 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:scanner:name"); |
| 201 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, "OpenSCAP"); |
| 202 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 203 | |
| 204 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 205 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:scanner:version"); |
| 206 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, oscap_get_versioncxx . . $ oscap_get_version(33a1f659e94feb42).()); |
| 207 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 208 | } |
| 209 | |
| 210 | #if defined(OSCAP_UNIXcxx . . $ `compat/compat.h:41:9`!) |
| 211 | static inline char *_unix_get_name_fallbackcxx . . $ _unix_get_name_fallback(41208ce6ca65dd58).(void) { |
| 212 | struct passwdcxx . . $ passwd# *passwd; |
| 213 | |
| 214 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0; |
| 215 | passwd = getpwuidcxx . . $ getpwuid(fd5493c96892938c).(getuidcxx . . $ getuid(db52760e79bf9054).()); |
| 216 | if (passwd == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || passwd->pw_namecxx . . $ passwd#pw_name. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 217 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("Error when calling getpwuid(): %d, %s\n", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 218 | return "\0"; |
| 219 | } |
| 220 | |
| 221 | return passwd->pw_namecxx . . $ passwd#pw_name.; |
| 222 | } |
| 223 | #endif |
| 224 | |
| 225 | static inline void _xccdf_result_fill_identitycxx . . $ _xccdf_result_fill_identity(731f9fbfcaef207c).(struct xccdf_resultcxx . . $ xccdf_result# *result) |
| 226 | { |
| 227 | struct xccdf_identitycxx . . $ xccdf_identity# *id = xccdf_identity_newcxx . . $ xccdf_identity_new(d95b72a8d99e0b49).(); |
| 228 | #if defined(OS_WINDOWS) |
| 229 | TCHAR w32_username[UNLEN + 1]; |
| 230 | DWORD w32_usernamesize = UNLEN + 1; |
| 231 | #endif |
| 232 | // Reasoning here is that OpenSCAP does not authenticate user |
| 233 | // nor it grants she any additional privileges |
| 234 | xccdf_identity_set_authenticatedcxx . . $ xccdf_identity_set_authenticated(12a05199239664e9).(id, 0); |
| 235 | xccdf_identity_set_privilegedcxx . . $ xccdf_identity_set_privileged(12a05199239664e9).(id, 0); |
| 236 | #ifdef OSCAP_UNIXcxx . . $ `compat/compat.h:41:9`! |
| 237 | char *name = getlogincxx . . $ getlogin(41208ce6ca65dd58).(); |
| 238 | if (name == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 239 | name = _unix_get_name_fallbackcxx . . $ _unix_get_name_fallback(41208ce6ca65dd58).(); |
| 240 | xccdf_identity_set_namecxx . . $ xccdf_identity_set_name(494bace9721fe6d0).(id, name); |
| 241 | #elif defined(OS_WINDOWS) |
| 242 | GetUserName((TCHAR *) w32_username, &w32_usernamesize); /* XXX: Check the return value? */ |
| 243 | xccdf_identity_set_name(id, w32_username); |
| 244 | #else |
| 245 | # warning "_xccdf_result_fill_identity: no support for identity on this OS" |
| 246 | #endif |
| 247 | xccdf_result_add_identitycxx . . $ xccdf_result_add_identity(3d033f7b2435ac8b).(result, id); |
| 248 | } |
| 249 | |
| 250 | static inline void _xccdf_result_clear_metadatacxx . . $ _xccdf_result_clear_metadata(9e1ae929b010245a).(struct xccdf_itemcxx . . $ xccdf_item# *result) |
| 251 | { |
| 252 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., freecxx . . $ free(5d22bdacc48458e8).); |
| 253 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., freecxx . . $ free(5d22bdacc48458e8).); |
| 254 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_factscxx . . $ xccdf_result_item#target_facts., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_target_fact_freecxx . . $ xccdf_target_fact_free(6eebfbd756c3469b).); |
| 255 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..identitiescxx . . $ xccdf_result_item#identities., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_identity_freecxx . . $ xccdf_identity_free(da17430d7491a0b1).); |
| 256 | oscap_create_listscxx . . $ oscap_create_lists(ec4abf0a650ab9a0).( |
| 257 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., |
| 258 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., |
| 259 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_factscxx . . $ xccdf_result_item#target_facts., |
| 260 | &result->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..identitiescxx . . $ xccdf_result_item#identities., |
| 261 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 262 | } |
| 263 | |
| 264 | #ifdef OSCAP_UNIXcxx . . $ `compat/compat.h:41:9`! |
| 265 | static char *_get_etc_hostnamecxx . . $ _get_etc_hostname(a8b8e32347182212).(const char *oscap_probe_root) |
| 266 | { |
| 267 | FILEcxx . . $ FILE# *fp; |
| 268 | char hname[HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!+1] = { '\0' }; |
| 269 | char *ret = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 270 | int rc; |
| 271 | |
| 272 | fp = oscap_fopen_with_prefixcxx . . $ oscap_fopen_with_prefix(82ec0787cd37e0a3).(oscap_probe_root, "/etc/hostname"); |
| 273 | |
| 274 | if (fp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 275 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("Trying to use /proc/sys/kernel/hostname instead of /etc/hostname"); |
| 276 | fp = oscap_fopen_with_prefixcxx . . $ oscap_fopen_with_prefix(82ec0787cd37e0a3).(oscap_probe_root, "/proc/sys/kernel/hostname"); |
| 277 | } |
| 278 | |
| 279 | if (fp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 280 | goto fail; |
| 281 | |
| 282 | rc = freadcxx . . $ fread(738fc8ac1d711e58).(hname, 1, HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!, fp); |
| 283 | /* If file is empty, we don't want to allocate an empty string for it */ |
| 284 | if (ferrorcxx . . $ ferror(89bc1efcdac0ca22).(fp) || rc == 0 ) |
| 285 | goto finish; |
| 286 | |
| 287 | hname[strcspncxx . . $ strcspn(335c1dc86f5c867f).(hname, "\n")] = '\0'; |
| 288 | ret = strdupcxx . . $ strdup(a8b8e32347182212).(hname); |
| 289 | |
| 290 | finish: |
| 291 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp); |
| 292 | fail: |
| 293 | return ret; |
| 294 | } |
| 295 | #endif |
| 296 | |
| 297 | void xccdf_result_fill_sysinfocxx . . $ xccdf_result_fill_sysinfo(731f9fbfcaef207c).(struct xccdf_resultcxx . . $ xccdf_result# *result) |
| 298 | { |
| 299 | #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!) || defined(OS_FREEBSD) |
| 300 | struct ifaddrscxx . . $ ifaddrs# *ifaddr, *ifa; |
| 301 | int fd; |
| 302 | #endif |
| 303 | struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 304 | const char *probe_root = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_PROBE_ROOT"); |
| 305 | |
| 306 | _xccdf_result_clear_metadatacxx . . $ _xccdf_result_clear_metadata(9e1ae929b010245a).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(result)); |
| 307 | _xccdf_result_fill_scannercxx . . $ _xccdf_result_fill_scanner(731f9fbfcaef207c).(result); |
| 308 | |
| 309 | #ifdef OSCAP_UNIXcxx . . $ `compat/compat.h:41:9`! |
| 310 | char *hostname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 311 | char *fqdn = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 312 | if (probe_root) { |
| 313 | hostname = _get_etc_hostnamecxx . . $ _get_etc_hostname(a8b8e32347182212).(probe_root); |
| 314 | } else { |
| 315 | char hname[_POSIX_HOST_NAME_MAXcxx . . $ `<external>/2534844627595019613/posix1_lim.h:52:9`!+1] = {0}; |
| 316 | if (gethostnamecxx . . $ gethostname(b6d9217c5e0a83f0).(hname, _POSIX_HOST_NAME_MAXcxx . . $ `<external>/2534844627595019613/posix1_lim.h:52:9`!)) { |
| 317 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("Unable to get hostname: %s", strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 318 | } else { |
| 319 | hostname = strdupcxx . . $ strdup(a8b8e32347182212).(hname); |
| 320 | } |
| 321 | |
| 322 | if (hostname) { |
| 323 | struct addrinfocxx . . $ addrinfo# hints, *info, *p; |
| 324 | int gai_res; |
| 325 | |
| 326 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&hints, 0, sizeof hints); |
| 327 | hints.ai_familycxx . . $ addrinfo#ai_family. = AF_UNSPECcxx . . $ `<external>/8962547315054503424/socket.h:93:9`!; |
| 328 | hints.ai_socktypecxx . . $ addrinfo#ai_socktype. = SOCK_STREAMcxx . . $ `<external>/5956532346368192945/socket_type.h:28:9`!; |
| 329 | hints.ai_flagscxx . . $ addrinfo#ai_flags. = AI_CANONNAMEcxx . . $ `<external>/564697342961150458/netdb.h:597:10`!; |
| 330 | |
| 331 | if (!(gai_res = getaddrinfocxx . . $ getaddrinfo(f68af21b9849b03e).(hostname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &hints, &info))) { |
| 332 | for(p = info; p != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; p = p->ai_nextcxx . . $ addrinfo#ai_next.) { |
| 333 | if (!p->ai_canonnamecxx . . $ addrinfo#ai_canonname.) |
| 334 | continue; |
| 335 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 336 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:asset:identifier:fqdn"); |
| 337 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, p->ai_canonnamecxx . . $ addrinfo#ai_canonname.); |
| 338 | /* store FQDN under XCCDF1.2 (6.6.3) predefined name */ |
| 339 | _xccdf_result_add_target_fact_uniqcxx . . $ _xccdf_result_add_target_fact_uniq(30b51456bf657b59).(result, fact); |
| 340 | if (!fqdn) |
| 341 | fqdn = strdupcxx . . $ strdup(a8b8e32347182212).(p->ai_canonnamecxx . . $ addrinfo#ai_canonname.); |
| 342 | } |
| 343 | freeaddrinfocxx . . $ freeaddrinfo(aadc8f19092a28e8).(info); |
| 344 | } else { |
| 345 | dIcxx . . $ `src/common/debug_priv.h:61:9`!("Unable to get FQDN(s) via getaddrinfo: %s", gai_strerror(gai_res)); |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | /* store target's host name */ |
| 350 | xccdf_result_add_targetcxx . . $ xccdf_result_add_target(2deabb2a41c12da7).(result, fqdn ? fqdn : (hostname ? hostname : "unknown")); |
| 351 | if (hostname) { |
| 352 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 353 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:asset:identifier:host_name"); |
| 354 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, hostname); |
| 355 | /* store host name under XCCDF1.2 (6.6.3) predefined name */ |
| 356 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 357 | } |
| 358 | freecxx . . $ free(5d22bdacc48458e8).(hostname); |
| 359 | freecxx . . $ free(5d22bdacc48458e8).(fqdn); |
| 360 | #elif defined(OS_WINDOWS) |
| 361 | TCHAR computer_name[MAX_COMPUTERNAME_LENGTH + 1]; |
| 362 | DWORD computer_name_size = MAX_COMPUTERNAME_LENGTH + 1; |
| 363 | GetComputerName(computer_name, &computer_name_size); |
| 364 | /* store target name */ |
| 365 | xccdf_result_add_target(result, computer_name); |
| 366 | |
| 367 | fact = xccdf_target_fact_new(); |
| 368 | xccdf_target_fact_set_name(fact, "urn:xccdf:fact:asset:identifier:host_name"); |
| 369 | xccdf_target_fact_set_string(fact, computer_name); |
| 370 | /* store host name under XCCDF1.2 (6.6.3) predefined name */ |
| 371 | xccdf_result_add_target_fact(result, fact); |
| 372 | #endif |
| 373 | |
| 374 | const char *ev_target = getenvcxx . . $ getenv(a8b8e32347182212).("OSCAP_EVALUATION_TARGET"); |
| 375 | if (ev_target) { |
| 376 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 377 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:identifier"); |
| 378 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, ev_target); |
| 379 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 380 | |
| 381 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 382 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:asset:identifier:ein"); |
| 383 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, ev_target); |
| 384 | /* store target id under XCCDF1.2 (6.6.3) predefined name */ |
| 385 | xccdf_result_add_target_factcxx . . $ xccdf_result_add_target_fact(3a90e414854b3ab2).(result, fact); |
| 386 | } |
| 387 | |
| 388 | if (!probe_root) |
| 389 | _xccdf_result_fill_identitycxx . . $ _xccdf_result_fill_identity(731f9fbfcaef207c).(result); |
| 390 | |
| 391 | #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!) || defined(OS_FREEBSD) |
| 392 | if (!probe_root) { |
| 393 | /* get network interfaces */ |
| 394 | if (getifaddrscxx . . $ getifaddrs(1d1e0a5ba40b9a63).(&ifaddr) == -1) |
| 395 | return; |
| 396 | |
| 397 | fd = socketcxx . . $ socket(2326284602b0bb2d).(PF_INETcxx . . $ `<external>/8962547315054503424/socket.h:45:9`!, SOCK_DGRAMcxx . . $ `<external>/5956532346368192945/socket_type.h:31:9`!, IPPROTO_IPcxx . . $ `<external>/9581057695539925927/in.h:43:9`!); |
| 398 | if (fd == -1) |
| 399 | goto out1; |
| 400 | |
| 401 | for (ifa = ifaddr; ifa != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; ifa = ifa->ifa_nextcxx . . $ ifaddrs#ifa_next.) { |
| 402 | int family; |
| 403 | char hostip[NI_MAXHOSTcxx . . $ `<external>/564697342961150458/netdb.h:638:11`!]; |
| 404 | struct ifreqcxx . . $ ifreq# ifr; |
| 405 | |
| 406 | if (!ifa->ifa_addrcxx . . $ ifaddrs#ifa_addr.) |
| 407 | continue; |
| 408 | family = ifa->ifa_addrcxx . . $ ifaddrs#ifa_addr.->sa_familycxx . . $ sockaddr#sa_family.; |
| 409 | |
| 410 | if (family == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`! || family == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) { |
| 411 | if (family == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!) { |
| 412 | if (getnameinfocxx . . $ getnameinfo(44a49899269c09ff).(ifa->ifa_addrcxx . . $ ifaddrs#ifa_addr., sizeof(struct sockaddr_incxx . . $ sockaddr_in#), |
| 413 | hostip, sizeof(hostip), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NI_NUMERICHOSTcxx . . $ `<external>/564697342961150458/netdb.h:642:10`!)) |
| 414 | goto out2; |
| 415 | } else if (family == AF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:105:9`!) { |
| 416 | struct sockaddr_in6cxx . . $ sockaddr_in6# *sin6; |
| 417 | |
| 418 | sin6 = (struct sockaddr_in6cxx . . $ sockaddr_in6# *) ifa->ifa_addrcxx . . $ ifaddrs#ifa_addr.; |
| 419 | if (!inet_ntopcxx . . $ inet_ntop(6a923972b45bea03).(family, (const void *) &sin6->sin6_addrcxx . . $ sockaddr_in6#sin6_addr., |
| 420 | hostip, sizeof(hostip))) |
| 421 | goto out2; |
| 422 | } |
| 423 | /* store ip address */ |
| 424 | xccdf_result_add_target_addresscxx . . $ xccdf_result_add_target_address(2deabb2a41c12da7).(result, hostip); |
| 425 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 426 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, family == AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`! ? "urn:xccdf:fact:asset:identifier:ipv4" : "urn:xccdf:fact:asset:identifier:ipv6"); |
| 427 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, hostip); |
| 428 | /* store ipv4(6) address under XCCDF1.2 (6.6.3) predefined name */ |
| 429 | _xccdf_result_add_target_fact_uniqcxx . . $ _xccdf_result_add_target_fact_uniq(30b51456bf657b59).(result, fact); |
| 430 | } |
| 431 | |
| 432 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&ifr, 0, sizeof(ifr)); |
| 433 | strncpycxx . . $ strncpy(255158a415b673b0).(ifr.ifr_namecxx . . $ `<external>/2638090476884991293/if.h:151:10`!, ifa->ifa_namecxx . . $ ifaddrs#ifa_name., IFNAMSIZcxx . . $ `<external>/2638090476884991293/if.h:129:10`!); |
| 434 | ifr.ifr_namecxx . . $ `<external>/2638090476884991293/if.h:151:10`![IFNAMSIZcxx . . $ `<external>/2638090476884991293/if.h:129:10`! - 1] = 0; |
| 435 | #if defined(OS_LINUXcxx . . $ `compat/oscap_platforms.h:38:10`!) |
| 436 | if (ioctlcxx . . $ ioctl(67fa1c773b05068c).(fd, SIOCGIFHWADDRcxx . . $ `<external>/13324550044150506404/sockios.h:80:9`!, &ifr) >= 0) { |
| 437 | unsigned char mac[6]; |
| 438 | char macbuf[20]; |
| 439 | |
| 440 | memcpycxx . . $ memcpy(cc817cb175f282d).(mac, ifr.ifr_hwaddrcxx . . $ `<external>/2638090476884991293/if.h:152:10`!.sa_datacxx . . $ sockaddr#sa_data., sizeof(mac)); |
| 441 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(macbuf, sizeof(macbuf), "%02X:%02X:%02X:%02X:%02X:%02X", |
| 442 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
| 443 | #elif defined(OS_FREEBSD) |
| 444 | if (ioctl(fd, SIOCGHWADDR, &ifr) >= 0) { |
| 445 | unsigned char mac[6]; |
| 446 | char macbuf[20]; |
| 447 | |
| 448 | memcpy(mac, ifr.ifr_addr.sa_data, sizeof(mac)); |
| 449 | snprintf(macbuf, sizeof(macbuf), "%02X:%02X:%02X:%02X:%02X:%02X", |
| 450 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
| 451 | #endif |
| 452 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 453 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:ethernet:MAC"); |
| 454 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, macbuf); |
| 455 | /* store mac address */ |
| 456 | _xccdf_result_add_target_fact_uniqcxx . . $ _xccdf_result_add_target_fact_uniq(30b51456bf657b59).(result, fact); |
| 457 | |
| 458 | fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 459 | xccdf_target_fact_set_namecxx . . $ xccdf_target_fact_set_name(e7cb227701114981).(fact, "urn:xccdf:fact:asset:identifier:mac"); |
| 460 | xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(fact, macbuf); |
| 461 | /* store mac address under XCCDF1.2 (6.6.3) predefined name */ |
| 462 | _xccdf_result_add_target_fact_uniqcxx . . $ _xccdf_result_add_target_fact_uniq(30b51456bf657b59).(result, fact); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | out2: |
| 467 | closecxx . . $ close(7864480464b09eea).(fd); |
| 468 | out1: |
| 469 | freeifaddrscxx . . $ freeifaddrs(195192b4a808fd42).(ifaddr); |
| 470 | } |
| 471 | #elif defined(OS_WINDOWS) |
| 472 | |
| 473 | #define VERSION_LEN 32 |
| 474 | /* Microsoft recommends to start with a 15 kB buffer for GetAdaptersAddresses. */ |
| 475 | #define ADDRESSES_BUFFER_SIZE 15000 |
| 476 | #define MAX_TRIES 3 |
| 477 | #define MAX_IP_ADDRESS_STRING_LENGTH 128 |
| 478 | |
| 479 | /* |
| 480 | * Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h |
| 481 | * to define the Windows Socket specification version we will use. |
| 482 | * The current version of the Windows Sockets specification is version 2.2. |
| 483 | * Version 2.2 is supported on all systems since Windows 95 OSR2. |
| 484 | */ |
| 485 | WORD requested_version = MAKEWORD(2, 2); |
| 486 | |
| 487 | WSADATA wsa_data; |
| 488 | int err = WSAStartup(requested_version, &wsa_data); |
| 489 | if (err != 0) { |
| 490 | char *error_message = oscap_windows_error_message(err); |
| 491 | dE("Can't initialize Winsock DLL. WSAStartup failed: %s", error_message); |
| 492 | free(error_message); |
| 493 | return; |
| 494 | } |
| 495 | |
| 496 | PIP_ADAPTER_ADDRESSES addresses = NULL; |
| 497 | ULONG ret_val = 0; |
| 498 | ULONG addresses_size = ADDRESSES_BUFFER_SIZE; |
| 499 | ULONG family = AF_UNSPEC; // both IPv4 and IPv6 |
| 500 | ULONG flags = GAA_FLAG_INCLUDE_PREFIX; |
| 501 | int iterations = 0; |
| 502 | |
| 503 | /* Try to get information about network adapters and their adresses */ |
| 504 | do { |
| 505 | addresses = malloc(addresses_size); |
| 506 | ret_val = GetAdaptersAddresses(family, flags, NULL, addresses, &addresses_size); |
| 507 | if (ret_val == ERROR_BUFFER_OVERFLOW) { |
| 508 | free(addresses); |
| 509 | addresses = NULL; |
| 510 | } |
| 511 | iterations++; |
| 512 | } while (ret_val == ERROR_BUFFER_OVERFLOW && iterations < MAX_TRIES); |
| 513 | |
| 514 | if (ret_val != NO_ERROR) { |
| 515 | char *error_message = oscap_windows_error_message(err); |
| 516 | dE("Can't get information about network adapters and their adresses. %s", error_message); |
| 517 | free(error_message); |
| 518 | free(addresses); |
| 519 | WSACleanup(); |
| 520 | return; |
| 521 | } |
| 522 | |
| 523 | /* Iterate over all network adapters */ |
| 524 | PIP_ADAPTER_ADDRESSES current_address = addresses; |
| 525 | while (current_address != NULL) { |
| 526 | /* MAC address */ |
| 527 | char *mac_address_str = NULL; |
| 528 | if (current_address->PhysicalAddressLength != 0) { |
| 529 | /* n bytes of MAC address will be printed as: |
| 530 | (2 * n) hexa numbers + (n - 1) delimiters + 1 terminating null byte = 3 * n */ |
| 531 | const size_t mac_address_str_len = current_address->PhysicalAddressLength * 3; |
| 532 | mac_address_str = malloc(mac_address_str_len); |
| 533 | |
| 534 | for (unsigned i = 0; i < current_address->PhysicalAddressLength; i++) { |
| 535 | if (i == (current_address->PhysicalAddressLength - 1)) { |
| 536 | snprintf(mac_address_str + i * 3, mac_address_str_len, "%.2X", |
| 537 | (int)current_address->PhysicalAddress[i]); |
| 538 | } |
| 539 | else { |
| 540 | snprintf(mac_address_str + i * 3, mac_address_str_len, "%.2X-", |
| 541 | (int)current_address->PhysicalAddress[i]); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | /* Add the MAC address to XCCDF TestResult/target-facts */ |
| 546 | struct xccdf_target_fact *fact = xccdf_target_fact_new(); |
| 547 | xccdf_target_fact_set_name(fact, "urn:xccdf:fact:ethernet:MAC"); |
| 548 | xccdf_target_fact_set_string(fact, mac_address_str); |
| 549 | /* store mac address */ |
| 550 | _xccdf_result_add_target_fact_uniq(result, fact); |
| 551 | |
| 552 | fact = xccdf_target_fact_new(); |
| 553 | xccdf_target_fact_set_name(fact, "urn:xccdf:fact:asset:identifier:mac"); |
| 554 | xccdf_target_fact_set_string(fact, mac_address_str); |
| 555 | /* store mac address under XCCDF1.2 (6.6.3) predefined name */ |
| 556 | _xccdf_result_add_target_fact_uniq(result, fact); |
| 557 | |
| 558 | free(mac_address_str); |
| 559 | } |
| 560 | |
| 561 | /* Iterate over all unicast IP addresses of the network interface */ |
| 562 | PIP_ADAPTER_UNICAST_ADDRESS unicast_address = current_address->FirstUnicastAddress; |
| 563 | while (unicast_address != NULL) { |
| 564 | SOCKET_ADDRESS socket_address = unicast_address->Address; |
| 565 | WCHAR ip_address_wstr[MAX_IP_ADDRESS_STRING_LENGTH]; |
| 566 | DWORD ip_address_wstr_length = MAX_IP_ADDRESS_STRING_LENGTH; |
| 567 | int rc = WSAAddressToStringW(socket_address.lpSockaddr, socket_address.iSockaddrLength, NULL, ip_address_wstr, &ip_address_wstr_length); |
| 568 | if (rc != 0) { |
| 569 | free(addresses); |
| 570 | WSACleanup(); |
| 571 | return; |
| 572 | } |
| 573 | |
| 574 | /* Add the IP address to XCCDF TestResult/target-address */ |
| 575 | char *ip_address_str = oscap_windows_wstr_to_str(ip_address_wstr); |
| 576 | xccdf_result_add_target_address(result, ip_address_str); |
| 577 | |
| 578 | fact = xccdf_target_fact_new(); |
| 579 | xccdf_target_fact_set_name(fact, socket_address.lpSockaddr->sa_family == AF_INET ? "urn:xccdf:fact:asset:identifier:ipv4" : "urn:xccdf:fact:asset:identifier:ipv6"); |
| 580 | xccdf_target_fact_set_string(fact, ip_address_str); |
| 581 | /* store ipv4(6) address under XCCDF1.2 (6.6.3) predefined name */ |
| 582 | _xccdf_result_add_target_fact_uniq(result, fact); |
| 583 | |
| 584 | free(ip_address_str); |
| 585 | |
| 586 | unicast_address = unicast_address->Next; |
| 587 | } |
| 588 | current_address = current_address->Next; |
| 589 | } |
| 590 | |
| 591 | free(addresses); |
| 592 | WSACleanup(); |
| 593 | return 0; |
| 594 | |
| 595 | #endif |
| 596 | } |
| 597 | |
| 598 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *xccdf_rule_result_newcxx . . $ xccdf_rule_result_new(8246cd908aadc7ea).(void) |
| 599 | { |
| 600 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rr = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_rule_resultcxx . . $ xccdf_rule_result#)); |
| 601 | oscap_create_listscxx . . $ oscap_create_lists(ec4abf0a650ab9a0).(&rr->overridescxx . . $ xccdf_rule_result#overrides., &rr->identscxx . . $ xccdf_rule_result#idents., &rr->messagescxx . . $ xccdf_rule_result#messages., |
| 602 | &rr->instancescxx . . $ xccdf_rule_result#instances., &rr->fixescxx . . $ xccdf_rule_result#fixes., &rr->checkscxx . . $ xccdf_rule_result#checks., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 603 | return rr; |
| 604 | } |
| 605 | |
| 606 | void xccdf_rule_result_freecxx . . $ xccdf_rule_result_free(c1e523a8884af7c6).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rr) |
| 607 | { |
| 608 | if (rr != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 609 | freecxx . . $ free(5d22bdacc48458e8).(rr->idrefcxx . . $ xccdf_rule_result#idref.); |
| 610 | freecxx . . $ free(5d22bdacc48458e8).(rr->versioncxx . . $ xccdf_rule_result#version.); |
| 611 | freecxx . . $ free(5d22bdacc48458e8).(rr->timecxx . . $ xccdf_rule_result#time.); |
| 612 | |
| 613 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->overridescxx . . $ xccdf_rule_result#overrides., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_override_freecxx . . $ xccdf_override_free(a9dcf5f2d9947221).); |
| 614 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->identscxx . . $ xccdf_rule_result#idents., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_ident_freecxx . . $ xccdf_ident_free(9a3cd491c0c01da2).); |
| 615 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->messagescxx . . $ xccdf_rule_result#messages., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_message_freecxx . . $ xccdf_message_free(e43b8b7aa83d98d8).); |
| 616 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->instancescxx . . $ xccdf_rule_result#instances., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_instance_freecxx . . $ xccdf_instance_free(f0e1e3efba2b10f5).); |
| 617 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->fixescxx . . $ xccdf_rule_result#fixes., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_fix_freecxx . . $ xccdf_fix_free(c140d0eff936239d).); |
| 618 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(rr->checkscxx . . $ xccdf_rule_result#checks., (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_check_freecxx . . $ xccdf_check_free(5c0307a75faadf5).); |
| 619 | |
| 620 | freecxx . . $ free(5d22bdacc48458e8).(rr); |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_role_t, xccdf_rule_result, role) |
| 625 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(float, xccdf_rule_result, weight) |
| 626 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_level_t, xccdf_rule_result, severity) |
| 627 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_test_result_type_t, xccdf_rule_result, result) |
| 628 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_rule_result, time) |
| 629 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_rule_result, version) |
| 630 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_rule_result, idref) |
| 631 | OSCAP_IGETINScxx . . $ `src/common/util.h:283:9`!(xccdf_ident, xccdf_rule_result, idents, ident) |
| 632 | OSCAP_IGETINScxx . . $ `src/common/util.h:283:9`!(xccdf_fix, xccdf_rule_result, fixes, fix) |
| 633 | OSCAP_IGETINScxx . . $ `src/common/util.h:283:9`!(xccdf_check, xccdf_rule_result, checks, check) |
| 634 | OSCAP_IGETINS_GENcxx . . $ `src/common/util.h:286:9`!(xccdf_override, xccdf_rule_result, overrides, override) |
| 635 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_override) |
| 636 | OSCAP_IGETINS_GENcxx . . $ `src/common/util.h:286:9`!(xccdf_message, xccdf_rule_result, messages, message) |
| 637 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_message) |
| 638 | OSCAP_IGETINS_GENcxx . . $ `src/common/util.h:286:9`!(xccdf_instance, xccdf_rule_result, instances, instance) |
| 639 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_instance) |
| 640 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_rule_result) |
| 641 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_rule_result) |
| 642 | |
| 643 | |
| 644 | struct xccdf_identitycxx . . $ xccdf_identity# *xccdf_identity_newcxx . . $ xccdf_identity_new(d95b72a8d99e0b49).(void) |
| 645 | { |
| 646 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_identitycxx . . $ xccdf_identity#)); |
| 647 | } |
| 648 | |
| 649 | void xccdf_identity_freecxx . . $ xccdf_identity_free(da17430d7491a0b1).(struct xccdf_identitycxx . . $ xccdf_identity# *identity) |
| 650 | { |
| 651 | if (identity != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 652 | freecxx . . $ free(5d22bdacc48458e8).(identity->namecxx . . $ xccdf_identity#name.); |
| 653 | freecxx . . $ free(5d22bdacc48458e8).(identity); |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | OSCAP_ACCESSOR_EXPcxx . . $ `src/common/util.h:265:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, xccdf_identity, authenticated, sub.authenticated) |
| 658 | OSCAP_ACCESSOR_EXPcxx . . $ `src/common/util.h:265:9`!(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`!, xccdf_identity, privileged, sub.privileged) |
| 659 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_identity, name) |
| 660 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_identity) |
| 661 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_identity) |
| 662 | |
| 663 | struct xccdf_scorecxx . . $ xccdf_score# *xccdf_score_newcxx . . $ xccdf_score_new(cc37c8c82be3ddf2).(void) |
| 664 | { |
| 665 | struct xccdf_scorecxx . . $ xccdf_score# *score = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_scorecxx . . $ xccdf_score#)); |
| 666 | score->scorecxx . . $ xccdf_score#score. = NANcxx . . $ `<external>/11263917310783833665/math.h:101:12`!; |
| 667 | score->maximumcxx . . $ xccdf_score#maximum. = XCCDF_SCORE_MAX_DAFAULTcxx . . $ XCCDF_SCORE_MAX_DAFAULT.; |
| 668 | return score; |
| 669 | } |
| 670 | |
| 671 | void xccdf_score_freecxx . . $ xccdf_score_free(3879543088f5564c).(struct xccdf_scorecxx . . $ xccdf_score# *score) |
| 672 | { |
| 673 | if (score != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 674 | freecxx . . $ free(5d22bdacc48458e8).(score->systemcxx . . $ xccdf_score#system.); |
| 675 | freecxx . . $ free(5d22bdacc48458e8).(score); |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_numeric, xccdf_score, maximum) |
| 680 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_numeric, xccdf_score, score) |
| 681 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_score, system) |
| 682 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_score) |
| 683 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_score) |
| 684 | |
| 685 | struct xccdf_overridecxx . . $ xccdf_override# *xccdf_override_newcxx . . $ xccdf_override_new(9e8c2415cc10d7f7).(void) |
| 686 | { |
| 687 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_overridecxx . . $ xccdf_override#)); |
| 688 | } |
| 689 | |
| 690 | void xccdf_override_freecxx . . $ xccdf_override_free(a9dcf5f2d9947221).(struct xccdf_overridecxx . . $ xccdf_override# *oride) |
| 691 | { |
| 692 | if (oride != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 693 | freecxx . . $ free(5d22bdacc48458e8).(oride->authoritycxx . . $ xccdf_override#authority.); |
| 694 | oscap_text_freecxx . . $ oscap_text_free(c2630df24779e845).(oride->remarkcxx . . $ xccdf_override#remark.); |
| 695 | freecxx . . $ free(5d22bdacc48458e8).(oride); |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_test_result_type_t, xccdf_override, new_result) |
| 700 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_test_result_type_t, xccdf_override, old_result) |
| 701 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_override, time) |
| 702 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_override, authority) |
| 703 | OSCAP_ACCESSOR_TEXTcxx . . $ `src/common/util.h:251:9`!(xccdf_override, remark) |
| 704 | |
| 705 | struct xccdf_messagecxx . . $ xccdf_message# *xccdf_message_newcxx . . $ xccdf_message_new(19dd3caa70854cb9).(void) |
| 706 | { |
| 707 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_messagecxx . . $ xccdf_message#)); |
| 708 | } |
| 709 | |
| 710 | void xccdf_message_freecxx . . $ xccdf_message_free(e43b8b7aa83d98d8).(struct xccdf_messagecxx . . $ xccdf_message# *msg) |
| 711 | { |
| 712 | if (msg != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 713 | freecxx . . $ free(5d22bdacc48458e8).(msg->contentcxx . . $ xccdf_message#content.); |
| 714 | freecxx . . $ free(5d22bdacc48458e8).(msg); |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_message_set_contentcxx . . $ xccdf_message_set_content(2941e8c3910a009a).(struct xccdf_messagecxx . . $ xccdf_message# *obj, const char *newval){ |
| 719 | // in debug mode, we handle all new messages in case where the xccdf_message is never displayed |
| 720 | dDcxx . . $ `src/common/debug_priv.h:64:9`!("XCCDF_SET_MESSAGE: %s", newval); |
| 721 | freecxx . . $ free(5d22bdacc48458e8).(obj->contentcxx . . $ xccdf_message#content.); |
| 722 | obj->contentcxx . . $ xccdf_message#content.=oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(newval); |
| 723 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 724 | } |
| 725 | |
| 726 | OSCAP_ACCESSOR_SIMPLEcxx . . $ `src/common/util.h:258:9`!(xccdf_message_severity_t, xccdf_message, severity) |
| 727 | OSCAP_GETTERcxx . . $ `src/common/util.h:111:9`!(const char*, xccdf_message, content) |
| 728 | |
| 729 | struct xccdf_target_factcxx . . $ xccdf_target_fact#* xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(void) |
| 730 | { |
| 731 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_target_factcxx . . $ xccdf_target_fact#)); |
| 732 | } |
| 733 | |
| 734 | void xccdf_target_fact_freecxx . . $ xccdf_target_fact_free(6eebfbd756c3469b).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact) |
| 735 | { |
| 736 | if (fact != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 737 | freecxx . . $ free(5d22bdacc48458e8).(fact->namecxx . . $ xccdf_target_fact#name.); |
| 738 | freecxx . . $ free(5d22bdacc48458e8).(fact->valuecxx . . $ xccdf_target_fact#value.); |
| 739 | freecxx . . $ free(5d22bdacc48458e8).(fact); |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | static inline boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_fact_set_valuecxx . . $ xccdf_target_fact_set_value(3ea9cdeb2bfa8280).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact, xccdf_value_type_tcxx . . $ xccdf_value_type_t# type, const char *str) |
| 744 | { |
| 745 | assertcxx . . $ `/usr/include/assert.h:50:10`!(fact != NULL); |
| 746 | freecxx . . $ free(5d22bdacc48458e8).(fact->valuecxx . . $ xccdf_target_fact#value.); |
| 747 | fact->valuecxx . . $ xccdf_target_fact#value. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(str); |
| 748 | fact->typecxx . . $ xccdf_target_fact#type. = type; |
| 749 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 750 | } |
| 751 | |
| 752 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_fact_set_stringcxx . . $ xccdf_target_fact_set_string(e7cb227701114981).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact, const char *str) |
| 753 | { |
| 754 | return xccdf_target_fact_set_valuecxx . . $ xccdf_target_fact_set_value(3ea9cdeb2bfa8280).(fact, XCCDF_TYPE_STRINGcxx . . $ XCCDF_TYPE_STRING., str); |
| 755 | } |
| 756 | |
| 757 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_fact_set_numbercxx . . $ xccdf_target_fact_set_number(790a9dc4ef6425e5).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact, xccdf_numericcxx . . $ xccdf_numeric# val) |
| 758 | { |
| 759 | char buff[XCCDF_NUMERIC_SIZEcxx . . $ `src/XCCDF/result.c:82:9`!]; |
| 760 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(buff, XCCDF_NUMERIC_FORMATcxx . . $ XCCDF_NUMERIC_FORMAT., val); |
| 761 | return xccdf_target_fact_set_valuecxx . . $ xccdf_target_fact_set_value(3ea9cdeb2bfa8280).(fact, XCCDF_TYPE_NUMBERcxx . . $ XCCDF_TYPE_NUMBER., buff); |
| 762 | } |
| 763 | |
| 764 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_fact_set_booleancxx . . $ xccdf_target_fact_set_boolean(5f437fc4c9d5909d).(struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! val) |
| 765 | { |
| 766 | return xccdf_target_fact_set_valuecxx . . $ xccdf_target_fact_set_value(3ea9cdeb2bfa8280).(fact, XCCDF_TYPE_BOOLEANcxx . . $ XCCDF_TYPE_BOOLEAN., oscap_enum_to_stringcxx . . $ oscap_enum_to_string(64165c519d473d40).(OSCAP_BOOL_MAPcxx . . $ OSCAP_BOOL_MAP., val)); |
| 767 | } |
| 768 | |
| 769 | OSCAP_GETTERcxx . . $ `src/common/util.h:111:9`!(xccdf_value_type_t, xccdf_target_fact, type) |
| 770 | OSCAP_GETTERcxx . . $ `src/common/util.h:111:9`!(const char *, xccdf_target_fact, value) |
| 771 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_target_fact, name) |
| 772 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_target_fact) |
| 773 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_target_fact) |
| 774 | |
| 775 | struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* xccdf_target_identifier_newcxx . . $ xccdf_target_identifier_new(3af78340b9ca3e6).(void) |
| 776 | { |
| 777 | return calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#)); |
| 778 | } |
| 779 | |
| 780 | struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* xccdf_target_identifier_clonecxx . . $ xccdf_target_identifier_clone(2bbb3750a4ad55c6).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ti) |
| 781 | { |
| 782 | struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ret = xccdf_target_identifier_newcxx . . $ xccdf_target_identifier_new(3af78340b9ca3e6).(); |
| 783 | |
| 784 | if (xccdf_target_identifier_get_xml_nodecxx . . $ xccdf_target_identifier_get_xml_node(2546da61855da35f).(ti)) { |
| 785 | xccdf_target_identifier_set_xml_nodecxx . . $ xccdf_target_identifier_set_xml_node(3a2662d9c959b185).(ret, xccdf_target_identifier_get_xml_nodecxx . . $ xccdf_target_identifier_get_xml_node(2546da61855da35f).(ti)); |
| 786 | } |
| 787 | else { |
| 788 | xccdf_target_identifier_set_systemcxx . . $ xccdf_target_identifier_set_system(ef7124cc66950652).(ret, xccdf_target_identifier_get_systemcxx . . $ xccdf_target_identifier_get_system(2a92a705ae10eb92).(ti)); |
| 789 | xccdf_target_identifier_set_namecxx . . $ xccdf_target_identifier_set_name(ef7124cc66950652).(ret, xccdf_target_identifier_get_namecxx . . $ xccdf_target_identifier_get_name(2a92a705ae10eb92).(ti)); |
| 790 | xccdf_target_identifier_set_hrefcxx . . $ xccdf_target_identifier_set_href(ef7124cc66950652).(ret, xccdf_target_identifier_get_hrefcxx . . $ xccdf_target_identifier_get_href(2a92a705ae10eb92).(ti)); |
| 791 | } |
| 792 | |
| 793 | return ret; |
| 794 | } |
| 795 | |
| 796 | void xccdf_target_identifier_freecxx . . $ xccdf_target_identifier_free(d2d502002cc89565).(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti) |
| 797 | { |
| 798 | if (ti != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 799 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 800 | xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(ti->elementcxx . . $ xccdf_target_identifier#element.); |
| 801 | } |
| 802 | else { |
| 803 | freecxx . . $ free(5d22bdacc48458e8).(ti->systemcxx . . $ xccdf_target_identifier#system.); |
| 804 | freecxx . . $ free(5d22bdacc48458e8).(ti->hrefcxx . . $ xccdf_target_identifier#href.); |
| 805 | freecxx . . $ free(5d22bdacc48458e8).(ti->namecxx . . $ xccdf_target_identifier#name.); |
| 806 | } |
| 807 | |
| 808 | freecxx . . $ free(5d22bdacc48458e8).(ti); |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_identifier_set_xml_nodecxx . . $ xccdf_target_identifier_set_xml_node(3a2662d9c959b185).(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti, void* node) |
| 813 | { |
| 814 | if (!ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 815 | freecxx . . $ free(5d22bdacc48458e8).(ti->systemcxx . . $ xccdf_target_identifier#system.); |
| 816 | freecxx . . $ free(5d22bdacc48458e8).(ti->hrefcxx . . $ xccdf_target_identifier#href.); |
| 817 | freecxx . . $ free(5d22bdacc48458e8).(ti->namecxx . . $ xccdf_target_identifier#name.); |
| 818 | } |
| 819 | else if (ti->elementcxx . . $ xccdf_target_identifier#element.) |
| 820 | xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(ti->elementcxx . . $ xccdf_target_identifier#element.); |
| 821 | |
| 822 | ti->any_elementcxx . . $ xccdf_target_identifier#any_element. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 823 | ti->elementcxx . . $ xccdf_target_identifier#element. = (xmlNodePtrcxx . . $ xmlNodePtr#)node; |
| 824 | |
| 825 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 826 | } |
| 827 | |
| 828 | void* xccdf_target_identifier_get_xml_nodecxx . . $ xccdf_target_identifier_get_xml_node(2546da61855da35f).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ti) |
| 829 | { |
| 830 | if (!ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) |
| 831 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 832 | |
| 833 | return ti->elementcxx . . $ xccdf_target_identifier#element.; |
| 834 | } |
| 835 | |
| 836 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_identifier_set_systemcxx . . $ xccdf_target_identifier_set_system(ef7124cc66950652).(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti, const char *newval) |
| 837 | { |
| 838 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 839 | if (ti->elementcxx . . $ xccdf_target_identifier#element.) |
| 840 | xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(ti->elementcxx . . $ xccdf_target_identifier#element.); |
| 841 | } |
| 842 | |
| 843 | ti->any_elementcxx . . $ xccdf_target_identifier#any_element. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 844 | freecxx . . $ free(5d22bdacc48458e8).(ti->systemcxx . . $ xccdf_target_identifier#system.); |
| 845 | ti->systemcxx . . $ xccdf_target_identifier#system. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(newval); |
| 846 | |
| 847 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 848 | } |
| 849 | |
| 850 | const char* xccdf_target_identifier_get_systemcxx . . $ xccdf_target_identifier_get_system(2a92a705ae10eb92).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ti) |
| 851 | { |
| 852 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) |
| 853 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 854 | |
| 855 | return ti->systemcxx . . $ xccdf_target_identifier#system.; |
| 856 | } |
| 857 | |
| 858 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_identifier_set_hrefcxx . . $ xccdf_target_identifier_set_href(ef7124cc66950652).(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti, const char *newval) |
| 859 | { |
| 860 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 861 | if (ti->elementcxx . . $ xccdf_target_identifier#element.) |
| 862 | xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(ti->elementcxx . . $ xccdf_target_identifier#element.); |
| 863 | } |
| 864 | |
| 865 | ti->any_elementcxx . . $ xccdf_target_identifier#any_element. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 866 | freecxx . . $ free(5d22bdacc48458e8).(ti->hrefcxx . . $ xccdf_target_identifier#href.); |
| 867 | ti->hrefcxx . . $ xccdf_target_identifier#href. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(newval); |
| 868 | |
| 869 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 870 | } |
| 871 | |
| 872 | const char* xccdf_target_identifier_get_hrefcxx . . $ xccdf_target_identifier_get_href(2a92a705ae10eb92).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ti) |
| 873 | { |
| 874 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) |
| 875 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 876 | |
| 877 | return ti->hrefcxx . . $ xccdf_target_identifier#href.; |
| 878 | } |
| 879 | |
| 880 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_target_identifier_set_namecxx . . $ xccdf_target_identifier_set_name(ef7124cc66950652).(struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti, const char *newval) |
| 881 | { |
| 882 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 883 | if (ti->elementcxx . . $ xccdf_target_identifier#element.) |
| 884 | xmlFreeNodecxx . . $ xmlFreeNode(5712c9d4a25253).(ti->elementcxx . . $ xccdf_target_identifier#element.); |
| 885 | } |
| 886 | |
| 887 | ti->any_elementcxx . . $ xccdf_target_identifier#any_element. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 888 | freecxx . . $ free(5d22bdacc48458e8).(ti->namecxx . . $ xccdf_target_identifier#name.); |
| 889 | ti->namecxx . . $ xccdf_target_identifier#name. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(newval); |
| 890 | |
| 891 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 892 | } |
| 893 | |
| 894 | const char* xccdf_target_identifier_get_namecxx . . $ xccdf_target_identifier_get_name(2a92a705ae10eb92).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier#* ti) |
| 895 | { |
| 896 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) |
| 897 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 898 | |
| 899 | return ti->namecxx . . $ xccdf_target_identifier#name.; |
| 900 | } |
| 901 | |
| 902 | OSCAP_ITERATOR_GENcxx . . $ `src/common/util.h:123:9`!(xccdf_target_identifier) |
| 903 | OSCAP_ITERATOR_REMOVE_Fcxx . . $ `src/common/util.h:128:9`!(xccdf_target_identifier) |
| 904 | |
| 905 | struct xccdf_instancecxx . . $ xccdf_instance# *xccdf_instance_newcxx . . $ xccdf_instance_new(939dd1c087dd0274).(void) |
| 906 | { |
| 907 | struct xccdf_instancecxx . . $ xccdf_instance# *inst = calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(struct xccdf_instancecxx . . $ xccdf_instance#)); |
| 908 | inst->contextcxx . . $ xccdf_instance#context. = oscap_strdupcxx . . $ oscap_strdup(a8b8e32347182212).(XCCDF_INSTANCE_DEFAULT_CONTEXTcxx . . $ XCCDF_INSTANCE_DEFAULT_CONTEXT.); |
| 909 | return inst; |
| 910 | } |
| 911 | |
| 912 | void xccdf_instance_freecxx . . $ xccdf_instance_free(f0e1e3efba2b10f5).(struct xccdf_instancecxx . . $ xccdf_instance# *inst) |
| 913 | { |
| 914 | if (inst != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 915 | freecxx . . $ free(5d22bdacc48458e8).(inst->contextcxx . . $ xccdf_instance#context.); |
| 916 | freecxx . . $ free(5d22bdacc48458e8).(inst->parent_contextcxx . . $ xccdf_instance#parent_context.); |
| 917 | freecxx . . $ free(5d22bdacc48458e8).(inst->contentcxx . . $ xccdf_instance#content.); |
| 918 | freecxx . . $ free(5d22bdacc48458e8).(inst); |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_instance, context) |
| 923 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_instance, parent_context) |
| 924 | OSCAP_ACCESSOR_STRINGcxx . . $ `src/common/util.h:245:9`!(xccdf_instance, content) |
| 925 | |
| 926 | /* ------ string maps ------ */ |
| 927 | |
| 928 | const struct oscap_string_mapcxx . . $ oscap_string_map# XCCDF_FACT_TYPE_MAPcxx . . $ XCCDF_FACT_TYPE_MAP.[] = { |
| 929 | { XCCDF_TYPE_BOOLEANcxx . . $ XCCDF_TYPE_BOOLEAN., "boolean" }, |
| 930 | { XCCDF_TYPE_STRINGcxx . . $ XCCDF_TYPE_STRING., "string" }, |
| 931 | { XCCDF_TYPE_NUMBERcxx . . $ XCCDF_TYPE_NUMBER., "number" }, |
| 932 | { XCCDF_TYPE_BOOLEANcxx . . $ XCCDF_TYPE_BOOLEAN., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 933 | }; |
| 934 | |
| 935 | const struct oscap_string_mapcxx . . $ oscap_string_map# XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP.[] = { |
| 936 | { XCCDF_RESULT_PASScxx . . $ XCCDF_RESULT_PASS., "pass" }, |
| 937 | { XCCDF_RESULT_FAILcxx . . $ XCCDF_RESULT_FAIL., "fail" }, |
| 938 | { XCCDF_RESULT_ERRORcxx . . $ XCCDF_RESULT_ERROR., "error" }, |
| 939 | { XCCDF_RESULT_UNKNOWNcxx . . $ XCCDF_RESULT_UNKNOWN., "unknown" }, |
| 940 | { XCCDF_RESULT_NOT_APPLICABLEcxx . . $ XCCDF_RESULT_NOT_APPLICABLE., "notapplicable" }, |
| 941 | { XCCDF_RESULT_NOT_CHECKEDcxx . . $ XCCDF_RESULT_NOT_CHECKED., "notchecked" }, |
| 942 | { XCCDF_RESULT_NOT_SELECTEDcxx . . $ XCCDF_RESULT_NOT_SELECTED., "notselected" }, |
| 943 | { XCCDF_RESULT_INFORMATIONALcxx . . $ XCCDF_RESULT_INFORMATIONAL., "informational" }, |
| 944 | { XCCDF_RESULT_FIXEDcxx . . $ XCCDF_RESULT_FIXED., "fixed" }, |
| 945 | { 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 946 | }; |
| 947 | |
| 948 | /* --------- import -------- */ |
| 949 | |
| 950 | static struct xccdf_identitycxx . . $ xccdf_identity# *xccdf_identity_new_parsecxx . . $ xccdf_identity_new_parse(1cc443c15a8eb392).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 951 | static struct xccdf_target_factcxx . . $ xccdf_target_fact# *xccdf_target_fact_new_parsecxx . . $ xccdf_target_fact_new_parse(ea2357bc94c7ce9).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 952 | static struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *xccdf_target_identifier_new_parsecxx . . $ xccdf_target_identifier_new_parse(8ccc57f656961ae4).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 953 | static struct xccdf_scorecxx . . $ xccdf_score# *xccdf_score_new_parsecxx . . $ xccdf_score_new_parse(f68d1fc2a3311064).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 954 | static struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *xccdf_rule_result_new_parsecxx . . $ xccdf_rule_result_new_parse(a65bf7c6548f7334).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 955 | static struct xccdf_overridecxx . . $ xccdf_override# *xccdf_override_new_parsecxx . . $ xccdf_override_new_parse(99d6e22bd6d32a2a).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 956 | static struct xccdf_messagecxx . . $ xccdf_message# *xccdf_message_new_parsecxx . . $ xccdf_message_new_parse(f40fc962c3c1a423).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 957 | static struct xccdf_instancecxx . . $ xccdf_instance# *xccdf_instance_new_parsecxx . . $ xccdf_instance_new_parse(237cad402f5d2d2c).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader); |
| 958 | |
| 959 | struct xccdf_resultcxx . . $ xccdf_result# *xccdf_result_import_sourcecxx . . $ xccdf_result_import_source(973913e43cf53496).(struct oscap_sourcecxx . . $ oscap_source# *source) |
| 960 | { |
| 961 | xmlTextReadercxx . . $ xmlTextReader# *reader = oscap_source_get_xmlTextReadercxx . . $ oscap_source_get_xmlTextReader(9a7ef22a0934f79d).(source); |
| 962 | if (reader == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 963 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 964 | } |
| 965 | while (xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader) == 1 |
| 966 | && xmlTextReaderNodeTypecxx . . $ xmlTextReaderNodeType(82a242a19623f75).(reader) != XML_READER_TYPE_ELEMENTcxx . . $ XML_READER_TYPE_ELEMENT.); |
| 967 | struct xccdf_resultcxx . . $ xccdf_result# *result = xccdf_result_new_parsecxx . . $ xccdf_result_new_parse(d53eff5a40c1825f).(reader); |
| 968 | xmlFreeTextReadercxx . . $ xmlFreeTextReader(724dbfdba9ec3ce8).(reader); |
| 969 | return result; |
| 970 | } |
| 971 | |
| 972 | struct xccdf_resultcxx . . $ xccdf_result# *xccdf_result_new_parsecxx . . $ xccdf_result_new_parse(d53eff5a40c1825f).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 973 | { |
| 974 | assertcxx . . $ `/usr/include/assert.h:50:10`!(reader != NULL); |
| 975 | if (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader) != XCCDFE_TESTRESULTcxx . . $ XCCDFE_TESTRESULT.) { |
| 976 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XCCDFcxx . . $ `src/common/public/oscap_error.h:62:9`!, "Expected 'TestResult' element while found '%s'.", |
| 977 | xmlTextReaderConstLocalName(reader)); |
| 978 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 979 | } |
| 980 | |
| 981 | struct xccdf_itemcxx . . $ xccdf_item# *res = XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(xccdf_result_new()); |
| 982 | xccdf_result_set_schema_versioncxx . . $ xccdf_result_set_schema_version(95c73830e13a8cf).(XRESULTcxx . . $ `src/XCCDF/helpers.h:37:9`!(res), xccdf_detect_version_parsercxx . . $ xccdf_detect_version_parser(7d21fc833ae00d0a).(reader)); |
| 983 | |
| 984 | if (!xccdf_item_process_attributescxx . . $ xccdf_item_process_attributes(bf0f85c13dd5e40b).(res, reader)) |
| 985 | goto fail; |
| 986 | |
| 987 | /* end time attribute is mandatory */ |
| 988 | if (!xccdf_attribute_hascxx . . $ xccdf_attribute_has(5c4b5ba7d6a00a2).(reader, XCCDFA_END_TIMEcxx . . $ XCCDFA_END_TIME.)) { |
| 989 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XCCDFcxx . . $ `src/common/public/oscap_error.h:62:9`!, "Missing end-time attribute in TestResult element: %s", xccdf_item_get_id(res)); |
| 990 | goto fail; |
| 991 | } |
| 992 | res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..end_timecxx . . $ xccdf_result_item#end_time. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_END_TIMEcxx . . $ XCCDFA_END_TIME.); |
| 993 | res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..start_timecxx . . $ xccdf_result_item#start_time. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_START_TIMEcxx . . $ XCCDFA_START_TIME.); |
| 994 | |
| 995 | res->itemcxx . . $ xccdf_item#item..versioncxx . . $ xccdf_item_base#version. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_VERSIONcxx . . $ XCCDFA_VERSION.); |
| 996 | res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..test_systemcxx . . $ xccdf_result_item#test_system. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_TEST_SYSTEMcxx . . $ XCCDFA_TEST_SYSTEM.); |
| 997 | |
| 998 | int depth = oscap_element_depthcxx . . $ oscap_element_depth(82a242a19623f75).(reader) + 1; |
| 999 | |
| 1000 | while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, depth)) { |
| 1001 | switch (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader)) { |
| 1002 | case XCCDFE_ORGANIZATIONcxx . . $ XCCDFE_ORGANIZATION.: |
| 1003 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..organizationscxx . . $ xccdf_result_item#organizations., oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader)); |
| 1004 | break; |
| 1005 | case XCCDFE_IDENTITYcxx . . $ XCCDFE_IDENTITY.: |
| 1006 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..identitiescxx . . $ xccdf_result_item#identities., xccdf_identity_new_parsecxx . . $ xccdf_identity_new_parse(1cc443c15a8eb392).(reader)); |
| 1007 | break; |
| 1008 | case XCCDFE_RESULT_PROFILEcxx . . $ XCCDFE_RESULT_PROFILE.: |
| 1009 | if (res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..profilecxx . . $ xccdf_result_item#profile. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1010 | res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..profilecxx . . $ xccdf_result_item#profile. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_IDREFcxx . . $ XCCDFA_IDREF.); |
| 1011 | break; |
| 1012 | case XCCDFE_TARGETcxx . . $ XCCDFE_TARGET.: |
| 1013 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader)); |
| 1014 | break; |
| 1015 | case XCCDFE_TARGET_ADDRESScxx . . $ XCCDFE_TARGET_ADDRESS.: |
| 1016 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader)); |
| 1017 | break; |
| 1018 | case XCCDFE_TARGET_FACTScxx . . $ XCCDFE_TARGET_FACTS.: |
| 1019 | // we have to read inside the target-facts element |
| 1020 | xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader); |
| 1021 | |
| 1022 | // iterate over all inner elements of the target-facts element |
| 1023 | while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, depth + 1)) { |
| 1024 | if (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader) == XCCDFE_FACTcxx . . $ XCCDFE_FACT.) |
| 1025 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_factscxx . . $ xccdf_result_item#target_facts., xccdf_target_fact_new_parsecxx . . $ xccdf_target_fact_new_parse(ea2357bc94c7ce9).(reader)); |
| 1026 | xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader); |
| 1027 | } |
| 1028 | break; |
| 1029 | case XCCDFE_TARGET_IDENTIFIERcxx . . $ XCCDFE_TARGET_IDENTIFIER.: |
| 1030 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_id_refscxx . . $ xccdf_result_item#target_id_refs., xccdf_target_identifier_new_parsecxx . . $ xccdf_target_identifier_new_parse(8ccc57f656961ae4).(reader)); |
| 1031 | break; |
| 1032 | case XCCDFE_SET_VALUEcxx . . $ XCCDFE_SET_VALUE.: |
| 1033 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..setvaluescxx . . $ xccdf_result_item#setvalues., xccdf_setvalue_new_parsecxx . . $ xccdf_setvalue_new_parse(92aa55c78198afc).(reader)); |
| 1034 | break; |
| 1035 | case XCCDFE_RULE_RESULTcxx . . $ XCCDFE_RULE_RESULT.: |
| 1036 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..rule_resultscxx . . $ xccdf_result_item#rule_results., xccdf_rule_result_new_parsecxx . . $ xccdf_rule_result_new_parse(a65bf7c6548f7334).(reader)); |
| 1037 | break; |
| 1038 | case XCCDFE_SCOREcxx . . $ XCCDFE_SCORE.: |
| 1039 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..scorescxx . . $ xccdf_result_item#scores., xccdf_score_new_parsecxx . . $ xccdf_score_new_parse(f68d1fc2a3311064).(reader)); |
| 1040 | break; |
| 1041 | case XCCDFE_RESULT_BENCHMARKcxx . . $ XCCDFE_RESULT_BENCHMARK.: |
| 1042 | if (res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..benchmark_uricxx . . $ xccdf_result_item#benchmark_uri. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1043 | res->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..benchmark_uricxx . . $ xccdf_result_item#benchmark_uri. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_HREFcxx . . $ XCCDFA_HREF.); |
| 1044 | break; |
| 1045 | default: |
| 1046 | if (!xccdf_item_process_elementcxx . . $ xccdf_item_process_element(bf0f85c13dd5e40b).(res, reader)) |
| 1047 | dWcxx . . $ `src/common/debug_priv.h:62:9`!("Encountered an unknown element '%s' while parsing XCCDF result.", |
| 1048 | xmlTextReaderConstLocalName(reader)); |
| 1049 | break; |
| 1050 | |
| 1051 | // TODO: any element from other namespace is supposed to go into xccdf_target_identifier |
| 1052 | } |
| 1053 | xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader); |
| 1054 | } |
| 1055 | |
| 1056 | return XRESULTcxx . . $ `src/XCCDF/helpers.h:37:9`!(res); |
| 1057 | |
| 1058 | fail: |
| 1059 | xccdf_result_freecxx . . $ xccdf_result_free(731f9fbfcaef207c).(XRESULTcxx . . $ `src/XCCDF/helpers.h:37:9`!(res)); |
| 1060 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1061 | } |
| 1062 | |
| 1063 | struct oscap_sourcecxx . . $ oscap_source# *xccdf_result_export_sourcecxx . . $ xccdf_result_export_source(bc5d04d067386fad).(struct xccdf_resultcxx . . $ xccdf_result# *result, const char *filepath) |
| 1064 | { |
| 1065 | xmlDocPtrcxx . . $ xmlDocPtr# doc = xmlNewDoccxx . . $ xmlNewDoc(6ad5ddcc52642397).(BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "1.0"); |
| 1066 | if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1067 | oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError()); |
| 1068 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1069 | } |
| 1070 | |
| 1071 | xccdf_result_to_domcxx . . $ xccdf_result_to_dom(f4ff93e1741a6a9d).(result, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 1072 | return oscap_source_new_from_xmlDoccxx . . $ oscap_source_new_from_xmlDoc(20d5db8f38e74517).(doc, filepath); |
| 1073 | } |
| 1074 | |
| 1075 | struct oscap_sourcecxx . . $ oscap_source# *xccdf_result_stig_viewer_export_sourcecxx . . $ xccdf_result_stig_viewer_export_source(bc5d04d067386fad).(struct xccdf_resultcxx . . $ xccdf_result# *result, const char *filepath) |
| 1076 | { |
| 1077 | xmlDocPtrcxx . . $ xmlDocPtr# doc = xmlNewDoccxx . . $ xmlNewDoc(6ad5ddcc52642397).(BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "1.0"); |
| 1078 | if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1079 | oscap_setxmlerrcxx . . $ `src/common/_error.h:36:9`!(xmlGetLastError()); |
| 1080 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1081 | } |
| 1082 | |
| 1083 | xccdf_result_to_domcxx . . $ xccdf_result_to_dom(f4ff93e1741a6a9d).(result, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 1084 | return oscap_source_new_from_xmlDoccxx . . $ oscap_source_new_from_xmlDoc(20d5db8f38e74517).(doc, filepath); |
| 1085 | } |
| 1086 | |
| 1087 | void xccdf_result_to_domcxx . . $ xccdf_result_to_dom(f4ff93e1741a6a9d).(struct xccdf_resultcxx . . $ xccdf_result# *result, xmlNodecxx . . $ xmlNode# *result_node, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! use_stig_rule_id) |
| 1088 | { |
| 1089 | xmlNscxx . . $ xmlNs# *ns_xccdf = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1090 | struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *associated_benchmark = xccdf_result_get_benchmarkcxx . . $ xccdf_result_get_benchmark(3d54a51fe0371fc6).(result); |
| 1091 | const char *benchmark_ref_uri = xccdf_result_get_benchmark_uricxx . . $ xccdf_result_get_benchmark_uri(9b243840ec21a788).(result); |
| 1092 | const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info = xccdf_item_get_schema_versioncxx . . $ xccdf_item_get_schema_version(a15732c9a5bba7d0).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(result)); |
| 1093 | if (parent) { |
| 1094 | ns_xccdf = lookup_xccdf_nscxx . . $ lookup_xccdf_ns(145fb009c13e3a1).(doc, parent, version_info); |
| 1095 | } else { |
| 1096 | if (!result_node) result_node = xccdf_item_to_domcxx . . $ xccdf_item_to_dom(974faac3a53a529f).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(result), doc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, version_info); |
| 1097 | ns_xccdf = xmlNewNscxx . . $ xmlNewNs(f962c8aae91c9a10).(result_node, |
| 1098 | (const xmlCharcxx . . $ xmlChar#*)xccdf_version_info_get_namespace_uricxx . . $ xccdf_version_info_get_namespace_uri(1e170957141ea993).(version_info), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1099 | xmlDocSetRootElementcxx . . $ xmlDocSetRootElement(ad0e42d5f79fdac5).(doc, result_node); |
| 1100 | |
| 1101 | // TestResult is the root element, we have to provide reference to |
| 1102 | // the benchmark that was the source of this test result |
| 1103 | |
| 1104 | if (benchmark_ref_uri == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1105 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XCCDFcxx . . $ `src/common/public/oscap_error.h:62:9`!, |
| 1106 | "Exporting TestResult as root element with no benchmark URI available. " |
| 1107 | "Specification requires us to provide a reference to the Benchmark in this " |
| 1108 | "case, this will result in XML file that won't be valid!"); |
| 1109 | } |
| 1110 | } |
| 1111 | |
| 1112 | if (benchmark_ref_uri) { |
| 1113 | // We need to prepend this previous to the "title" element |
| 1114 | // to satisfy the specification. |
| 1115 | |
| 1116 | xmlNodePtrcxx . . $ xmlNodePtr# title_node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1117 | xmlNodePtrcxx . . $ xmlNodePtr# title_node_candidate = result_node->childrencxx . . $ _xmlNode#children.; |
| 1118 | while (title_node_candidate) { |
| 1119 | if (title_node_candidate->typecxx . . $ _xmlNode#type. == XML_ELEMENT_NODEcxx . . $ XML_ELEMENT_NODE. && |
| 1120 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char*)title_node_candidate->namecxx . . $ _xmlNode#name., "title") == 0) { |
| 1121 | title_node = title_node_candidate; |
| 1122 | break; |
| 1123 | } |
| 1124 | |
| 1125 | title_node_candidate = title_node_candidate->nextcxx . . $ _xmlNode#next.; |
| 1126 | } |
| 1127 | |
| 1128 | if (title_node == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1129 | oscap_seterrcxx . . $ `src/common/_error.h:52:9`!(OSCAP_EFAMILY_XCCDFcxx . . $ `src/common/public/oscap_error.h:62:9`!, |
| 1130 | "Can't find title node in the exported TestResult. This is most likely " |
| 1131 | "an internal issue with openscap, please report the bug!"); |
| 1132 | } |
| 1133 | else { |
| 1134 | xmlNodePtrcxx . . $ xmlNodePtr# benchmark_ref = xmlNewNodecxx . . $ xmlNewNode(cc9f3f2e425bac4).(ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "benchmark"); |
| 1135 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(benchmark_ref, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "href", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! benchmark_ref_uri); |
| 1136 | |
| 1137 | // @id is disallowed in XCCDF 1.1 and optional in XCCDF 1.2 |
| 1138 | if (xccdf_version_cmpcxx . . $ xccdf_version_cmp(90211f1159e0810f).(xccdf_item_get_schema_versioncxx . . $ xccdf_item_get_schema_version(a15732c9a5bba7d0).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(result)), "1.2") >= 0 && associated_benchmark) { |
| 1139 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(benchmark_ref, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "id", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! xccdf_benchmark_get_idcxx . . $ xccdf_benchmark_get_id(6371e83a9c397dc3).(associated_benchmark)); |
| 1140 | } |
| 1141 | |
| 1142 | xmlAddPrevSiblingcxx . . $ xmlAddPrevSibling(93e65f4d4ebd68bd).(title_node, benchmark_ref); |
| 1143 | } |
| 1144 | } |
| 1145 | |
| 1146 | /* Handle attributes */ |
| 1147 | const char * start = xccdf_result_get_start_timecxx . . $ xccdf_result_get_start_time(9b243840ec21a788).(result); |
| 1148 | if (start) { |
| 1149 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "start-time", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! start); |
| 1150 | } |
| 1151 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "end-time", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! xccdf_result_get_end_timecxx . . $ xccdf_result_get_end_time(9b243840ec21a788).(result)); |
| 1152 | const char *version = xccdf_result_get_versioncxx . . $ xccdf_result_get_version(9b243840ec21a788).(result); |
| 1153 | if (version != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1154 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! version); |
| 1155 | const char *test_system = xccdf_result_get_test_systemcxx . . $ xccdf_result_get_test_system(9b243840ec21a788).(result); |
| 1156 | if (test_system != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1157 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "test-system", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! test_system); |
| 1158 | } |
| 1159 | |
| 1160 | /* Handle children */ |
| 1161 | xccdf_texts_to_domcxx . . $ xccdf_texts_to_dom(c13e4d88df8e39b1).(xccdf_result_get_remarkscxx . . $ xccdf_result_get_remarks(3a678574d2775360).(result), result_node, "remark"); |
| 1162 | |
| 1163 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *orgs = xccdf_result_get_organizationscxx . . $ xccdf_result_get_organizations(afd714a9d6f8cb).(result); |
| 1164 | while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(orgs)) { |
| 1165 | const char *org = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(orgs); |
| 1166 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "organization", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! org); |
| 1167 | } |
| 1168 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(orgs); |
| 1169 | |
| 1170 | struct xccdf_identity_iteratorcxx . . $ xccdf_identity_iterator# *identities = xccdf_result_get_identitiescxx . . $ xccdf_result_get_identities(8becab0dfbc5faf9).(result); |
| 1171 | while (xccdf_identity_iterator_has_morecxx . . $ xccdf_identity_iterator_has_more(b1f349ae4febc07a).(identities)) { |
| 1172 | struct xccdf_identitycxx . . $ xccdf_identity# *identity = xccdf_identity_iterator_nextcxx . . $ xccdf_identity_iterator_next(7c0c4a84f29f1189).(identities); |
| 1173 | xmlNodecxx . . $ xmlNode# *identity_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "identity", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! xccdf_identity_get_namecxx . . $ xccdf_identity_get_name(6309af79331506b9).(identity)); |
| 1174 | |
| 1175 | if (xccdf_identity_get_authenticatedcxx . . $ xccdf_identity_get_authenticated(12e5f26ddaaba5ce).(identity)) |
| 1176 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(identity_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "authenticated", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 1177 | else |
| 1178 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(identity_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "authenticated", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "false"); |
| 1179 | |
| 1180 | if (xccdf_identity_get_privilegedcxx . . $ xccdf_identity_get_privileged(12e5f26ddaaba5ce).(identity)) |
| 1181 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(identity_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "privileged", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "true"); |
| 1182 | else |
| 1183 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(identity_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "privileged", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "false"); |
| 1184 | } |
| 1185 | xccdf_identity_iterator_freecxx . . $ xccdf_identity_iterator_free(c49d9fbfc631436a).(identities); |
| 1186 | |
| 1187 | const char *profile = xccdf_result_get_profilecxx . . $ xccdf_result_get_profile(9b243840ec21a788).(result); |
| 1188 | if (profile) { |
| 1189 | xmlNodecxx . . $ xmlNode# *prof_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "profile", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1190 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(prof_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "idref", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! profile); |
| 1191 | } |
| 1192 | |
| 1193 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *targets = xccdf_result_get_targetscxx . . $ xccdf_result_get_targets(afd714a9d6f8cb).(result); |
| 1194 | while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(targets)) { |
| 1195 | const char *target = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(targets); |
| 1196 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "target", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! target); |
| 1197 | } |
| 1198 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(targets); |
| 1199 | |
| 1200 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *target_addresses = xccdf_result_get_target_addressescxx . . $ xccdf_result_get_target_addresses(afd714a9d6f8cb).(result); |
| 1201 | while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(target_addresses)) { |
| 1202 | const char *target_address = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(target_addresses); |
| 1203 | if (strchrcxx . . $ strchr(2050848944e00d54).(target_address, ':') != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { // a very simplistic check for IPv6 |
| 1204 | char *expanded_ipv6 = oscap_expand_ipv6cxx . . $ oscap_expand_ipv6(a8b8e32347182212).(target_address); |
| 1205 | // Not all but a lot of datastream or even XCCDF test result schematrons |
| 1206 | // require a fully expanded IPv6. It doesn't hurt anything to expand it |
| 1207 | // here. All tools should be able to consume both shorthand and |
| 1208 | // expanded IPv6 addresses. |
| 1209 | |
| 1210 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "target-address", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! expanded_ipv6); |
| 1211 | freecxx . . $ free(5d22bdacc48458e8).(expanded_ipv6); |
| 1212 | } |
| 1213 | else { |
| 1214 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "target-address", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! target_address); |
| 1215 | } |
| 1216 | } |
| 1217 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(target_addresses); |
| 1218 | |
| 1219 | // platform |
| 1220 | |
| 1221 | struct xccdf_target_fact_iteratorcxx . . $ xccdf_target_fact_iterator# *target_facts = xccdf_result_get_target_factscxx . . $ xccdf_result_get_target_facts(23d7992f0d28a237).(result); |
| 1222 | if (xccdf_target_fact_iterator_has_morecxx . . $ xccdf_target_fact_iterator_has_more(cad91995bc54c721).(target_facts)) { |
| 1223 | xmlNodecxx . . $ xmlNode# *target_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "target-facts", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1224 | while (xccdf_target_fact_iterator_has_morecxx . . $ xccdf_target_fact_iterator_has_more(cad91995bc54c721).(target_facts)) { |
| 1225 | struct xccdf_target_factcxx . . $ xccdf_target_fact# *target_fact = xccdf_target_fact_iterator_nextcxx . . $ xccdf_target_fact_iterator_next(f0af6a17bc4899ff).(target_facts); |
| 1226 | xmlNodecxx . . $ xmlNode# *fact_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(target_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "fact", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! target_fact->valuecxx . . $ xccdf_target_fact#value.); |
| 1227 | |
| 1228 | const char *name = xccdf_target_fact_get_namecxx . . $ xccdf_target_fact_get_name(55878dcec54f2ac1).(target_fact); |
| 1229 | if (name) |
| 1230 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(fact_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "name", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! name); |
| 1231 | |
| 1232 | xccdf_value_type_tcxx . . $ xccdf_value_type_t# value = xccdf_target_fact_get_typecxx . . $ xccdf_target_fact_get_type(7c7257e1ac15d14e).(target_fact); |
| 1233 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(fact_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "type", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_FACT_TYPE_MAPcxx . . $ XCCDF_FACT_TYPE_MAP.[value - 1].stringcxx . . $ oscap_string_map#string.); |
| 1234 | } |
| 1235 | } |
| 1236 | xccdf_target_fact_iterator_freecxx . . $ xccdf_target_fact_iterator_free(530a04dc77960699).(target_facts); |
| 1237 | |
| 1238 | struct xccdf_target_identifier_iteratorcxx . . $ xccdf_target_identifier_iterator# *target_id_refs = xccdf_result_get_target_id_refscxx . . $ xccdf_result_get_target_id_refs(52709af4a1bac1a7).(result); |
| 1239 | while (xccdf_target_identifier_iterator_has_morecxx . . $ xccdf_target_identifier_iterator_has_more(64f1f6bbfd603870).(target_id_refs)) { |
| 1240 | struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *target_identifier = xccdf_target_identifier_iterator_nextcxx . . $ xccdf_target_identifier_iterator_next(57465782488df590).(target_id_refs); |
| 1241 | xccdf_target_identifier_to_domcxx . . $ xccdf_target_identifier_to_dom(25b56f9178787f96).(target_identifier, doc, result_node, version_info); |
| 1242 | } |
| 1243 | xccdf_target_identifier_iterator_freecxx . . $ xccdf_target_identifier_iterator_free(cb5fc82b7cf9cf67).(target_id_refs); |
| 1244 | |
| 1245 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *applicable_platforms = xccdf_result_get_applicable_platformscxx . . $ xccdf_result_get_applicable_platforms(afd714a9d6f8cb).(result); |
| 1246 | while (oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(applicable_platforms)) { |
| 1247 | const char *platform = oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(applicable_platforms); |
| 1248 | xmlNodecxx . . $ xmlNode# *platform_element = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "platform", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1249 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(platform_element, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "idref", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! platform); |
| 1250 | } |
| 1251 | oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(applicable_platforms); |
| 1252 | |
| 1253 | struct xccdf_setvalue_iteratorcxx . . $ xccdf_setvalue_iterator# *setvalues = xccdf_result_get_setvaluescxx . . $ xccdf_result_get_setvalues(fcd7cb6a019d3376).(result); |
| 1254 | while (xccdf_setvalue_iterator_has_morecxx . . $ xccdf_setvalue_iterator_has_more(3ec70e5e2abc17db).(setvalues)) { |
| 1255 | struct xccdf_setvaluecxx . . $ xccdf_setvalue# *setvalue = xccdf_setvalue_iterator_nextcxx . . $ xccdf_setvalue_iterator_next(753fc4cd25f5e085).(setvalues); |
| 1256 | xccdf_setvalue_to_domcxx . . $ xccdf_setvalue_to_dom(3992d20e59720dd2).(setvalue, doc, result_node, version_info); |
| 1257 | } |
| 1258 | xccdf_setvalue_iterator_freecxx . . $ xccdf_setvalue_iterator_free(88ac5f99059bb7a3).(setvalues); |
| 1259 | |
| 1260 | struct oscap_htablecxx . . $ oscap_htable# *nodes_by_rule_id = oscap_htable_newcxx . . $ oscap_htable_new(3c1cb2b6f390ad38).(); |
| 1261 | |
| 1262 | struct xccdf_rule_result_iteratorcxx . . $ xccdf_rule_result_iterator# *rule_results = xccdf_result_get_rule_resultscxx . . $ xccdf_result_get_rule_results(6465447fe4419503).(result); |
| 1263 | if (use_stig_rule_id) { |
| 1264 | while (xccdf_rule_result_iterator_has_morecxx . . $ xccdf_rule_result_iterator_has_more(4b8217bc6f572439).(rule_results)) { |
| 1265 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rule_result = xccdf_rule_result_iterator_nextcxx . . $ xccdf_rule_result_iterator_next(e8bc98eb60cdbb5a).(rule_results); |
| 1266 | |
| 1267 | const char *idref = xccdf_rule_result_get_idrefcxx . . $ xccdf_rule_result_get_idref(d7da8a9a9f9bf6c8).(rule_result); |
| 1268 | if (!idref) |
| 1269 | continue; |
| 1270 | |
| 1271 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# test_res = xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result); |
| 1272 | |
| 1273 | const struct xccdf_itemcxx . . $ xccdf_item# *item = xccdf_benchmark_get_membercxx . . $ xccdf_benchmark_get_member(51139a28f6959fd9).(associated_benchmark, XCCDF_RULEcxx . . $ XCCDF_RULE., idref); |
| 1274 | if (!item) |
| 1275 | continue; |
| 1276 | |
| 1277 | struct oscap_reference_iteratorcxx . . $ oscap_reference_iterator# *references = xccdf_item_get_referencescxx . . $ xccdf_item_get_references(58b511645be6226a).(item); |
| 1278 | while (oscap_reference_iterator_has_morecxx . . $ oscap_reference_iterator_has_more(3902913d46f91173).(references)) { |
| 1279 | struct oscap_referencecxx . . $ oscap_reference# *ref = oscap_reference_iterator_nextcxx . . $ oscap_reference_iterator_next(81bc9a067126085c).(references); |
| 1280 | const char *href = oscap_reference_get_hrefcxx . . $ oscap_reference_get_href(2a9eef276a992895).(ref); |
| 1281 | if (href && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[0]) == 0 || |
| 1282 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[1]) == 0 || |
| 1283 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[2]) == 0)) { |
| 1284 | const char *stig_rule_id = oscap_reference_get_titlecxx . . $ oscap_reference_get_title(2a9eef276a992895).(ref); |
| 1285 | |
| 1286 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# other_res = (xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t#)oscap_htable_detachcxx . . $ oscap_htable_detach(f5c7e8ff6c970cd3).(nodes_by_rule_id, stig_rule_id); |
| 1287 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# wanted_res; |
| 1288 | if (other_res == 0) { |
| 1289 | wanted_res = test_res; |
| 1290 | } else { |
| 1291 | // if one test passed, and the other didn't, the other one should win |
| 1292 | if (test_res == XCCDF_RESULT_PASScxx . . $ XCCDF_RESULT_PASS.) { |
| 1293 | wanted_res = other_res; |
| 1294 | } else if (other_res == XCCDF_RESULT_PASScxx . . $ XCCDF_RESULT_PASS.) { |
| 1295 | wanted_res = test_res; |
| 1296 | // if one had an error, that should win |
| 1297 | } else if (test_res == XCCDF_RESULT_ERRORcxx . . $ XCCDF_RESULT_ERROR. || other_res == XCCDF_RESULT_ERRORcxx . . $ XCCDF_RESULT_ERROR.) { |
| 1298 | wanted_res = XCCDF_RESULT_ERRORcxx . . $ XCCDF_RESULT_ERROR.; |
| 1299 | // next prio: failures |
| 1300 | } else if (test_res == XCCDF_RESULT_FAILcxx . . $ XCCDF_RESULT_FAIL. || other_res == XCCDF_RESULT_FAILcxx . . $ XCCDF_RESULT_FAIL.) { |
| 1301 | wanted_res = XCCDF_RESULT_FAILcxx . . $ XCCDF_RESULT_FAIL.; |
| 1302 | // next prio: unknown |
| 1303 | } else if (test_res == XCCDF_RESULT_UNKNOWNcxx . . $ XCCDF_RESULT_UNKNOWN. || other_res == XCCDF_RESULT_UNKNOWNcxx . . $ XCCDF_RESULT_UNKNOWN.) { |
| 1304 | wanted_res = XCCDF_RESULT_UNKNOWNcxx . . $ XCCDF_RESULT_UNKNOWN.; |
| 1305 | // otherwise, just pick the lower one (more or less arbitrarily) |
| 1306 | } else { |
| 1307 | wanted_res = (test_res < other_res) ? test_res : other_res; |
| 1308 | } |
| 1309 | } |
| 1310 | oscap_htable_addcxx . . $ oscap_htable_add(d9abe78f59fa00eb).(nodes_by_rule_id, stig_rule_id, (void*)wanted_res); |
| 1311 | } |
| 1312 | } |
| 1313 | oscap_reference_iterator_freecxx . . $ oscap_reference_iterator_free(3e07142178288e0).(references); |
| 1314 | } |
| 1315 | xccdf_rule_result_iterator_resetcxx . . $ xccdf_rule_result_iterator_reset(c5d87bde560339c3).(rule_results); |
| 1316 | } |
| 1317 | while (xccdf_rule_result_iterator_has_morecxx . . $ xccdf_rule_result_iterator_has_more(4b8217bc6f572439).(rule_results)) { |
| 1318 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rule_result = xccdf_rule_result_iterator_nextcxx . . $ xccdf_rule_result_iterator_next(e8bc98eb60cdbb5a).(rule_results); |
| 1319 | xccdf_rule_result_to_domcxx . . $ xccdf_rule_result_to_dom(429f7d99c14d4a4e).(rule_result, doc, result_node, version_info, associated_benchmark, use_stig_rule_id, nodes_by_rule_id); |
| 1320 | } |
| 1321 | xccdf_rule_result_iterator_freecxx . . $ xccdf_rule_result_iterator_free(c5d87bde560339c3).(rule_results); |
| 1322 | |
| 1323 | oscap_htable_free0cxx . . $ oscap_htable_free0(dbd8f9d05ba37fd5).(nodes_by_rule_id); |
| 1324 | |
| 1325 | struct xccdf_score_iteratorcxx . . $ xccdf_score_iterator# *scores = xccdf_result_get_scorescxx . . $ xccdf_result_get_scores(a3b292ed40c82681).(result); |
| 1326 | while (xccdf_score_iterator_has_morecxx . . $ xccdf_score_iterator_has_more(4e460e487b6b1826).(scores)) { |
| 1327 | struct xccdf_scorecxx . . $ xccdf_score# *score = xccdf_score_iterator_nextcxx . . $ xccdf_score_iterator_next(fc7ac81b6182e27f).(scores); |
| 1328 | |
| 1329 | float value = xccdf_score_get_scorecxx . . $ xccdf_score_get_score(cc5c402e4e6eb993).(score); |
| 1330 | char *value_str = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%f", value); |
| 1331 | xmlNodecxx . . $ xmlNode# *score_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "score", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! value_str); |
| 1332 | freecxx . . $ free(5d22bdacc48458e8).(value_str); |
| 1333 | |
| 1334 | const char *sys = xccdf_score_get_systemcxx . . $ xccdf_score_get_system(f75571dd70fd8ead).(score); |
| 1335 | if (sys) |
| 1336 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(score_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "system", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! sys); |
| 1337 | |
| 1338 | float max = xccdf_score_get_maximumcxx . . $ xccdf_score_get_maximum(cc5c402e4e6eb993).(score); |
| 1339 | char *max_str = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%f", max); |
| 1340 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(score_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "maximum", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! max_str); |
| 1341 | freecxx . . $ free(5d22bdacc48458e8).(max_str); |
| 1342 | } |
| 1343 | xccdf_score_iterator_freecxx . . $ xccdf_score_iterator_free(cb6faecc50174f86).(scores); |
| 1344 | } |
| 1345 | |
| 1346 | static struct xccdf_identitycxx . . $ xccdf_identity# *xccdf_identity_new_parsecxx . . $ xccdf_identity_new_parse(1cc443c15a8eb392).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1347 | { |
| 1348 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_IDENTITY); |
| 1349 | |
| 1350 | struct xccdf_identitycxx . . $ xccdf_identity# *identity = xccdf_identity_newcxx . . $ xccdf_identity_new(d95b72a8d99e0b49).(); |
| 1351 | identity->subcxx . . $ xccdf_identity#sub..authenticatedcxx . . $ xccdf_identity#$anonymous_type_2#authenticated. = xccdf_attribute_get_boolcxx . . $ xccdf_attribute_get_bool(5c4b5ba7d6a00a2).(reader, XCCDFA_AUTHENTICATEDcxx . . $ XCCDFA_AUTHENTICATED.); |
| 1352 | identity->subcxx . . $ xccdf_identity#sub..privilegedcxx . . $ xccdf_identity#$anonymous_type_2#privileged. = xccdf_attribute_get_boolcxx . . $ xccdf_attribute_get_bool(5c4b5ba7d6a00a2).(reader, XCCDFA_PRIVILEDGEDcxx . . $ XCCDFA_PRIVILEDGED.); |
| 1353 | identity->namecxx . . $ xccdf_identity#name. = oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader); |
| 1354 | return identity; |
| 1355 | } |
| 1356 | |
| 1357 | static struct xccdf_target_factcxx . . $ xccdf_target_fact# *xccdf_target_fact_new_parsecxx . . $ xccdf_target_fact_new_parse(ea2357bc94c7ce9).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1358 | { |
| 1359 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_FACT); |
| 1360 | |
| 1361 | struct xccdf_target_factcxx . . $ xccdf_target_fact# *fact = xccdf_target_fact_newcxx . . $ xccdf_target_fact_new(cede96539be96dc0).(); |
| 1362 | fact->typecxx . . $ xccdf_target_fact#type. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_FACT_TYPE_MAPcxx . . $ XCCDF_FACT_TYPE_MAP., xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_TYPEcxx . . $ XCCDFA_TYPE.)); |
| 1363 | fact->namecxx . . $ xccdf_target_fact#name. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_NAMEcxx . . $ XCCDFA_NAME.); |
| 1364 | fact->valuecxx . . $ xccdf_target_fact#value. = oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader); |
| 1365 | return fact; |
| 1366 | } |
| 1367 | |
| 1368 | static struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *xccdf_target_identifier_new_parsecxx . . $ xccdf_target_identifier_new_parse(8ccc57f656961ae4).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1369 | { |
| 1370 | struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ret = xccdf_target_identifier_newcxx . . $ xccdf_target_identifier_new(3af78340b9ca3e6).(); |
| 1371 | |
| 1372 | if (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader) == XCCDFE_TARGET_IDENTIFIERcxx . . $ XCCDFE_TARGET_IDENTIFIER.) { |
| 1373 | xccdf_target_identifier_set_systemcxx . . $ xccdf_target_identifier_set_system(ef7124cc66950652).(ret, xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_SYSTEMcxx . . $ XCCDFA_SYSTEM.)); |
| 1374 | xccdf_target_identifier_set_hrefcxx . . $ xccdf_target_identifier_set_href(ef7124cc66950652).(ret, xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_HREFcxx . . $ XCCDFA_HREF.)); |
| 1375 | xccdf_target_identifier_set_namecxx . . $ xccdf_target_identifier_set_name(ef7124cc66950652).(ret, xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_NAMEcxx . . $ XCCDFA_NAME.)); |
| 1376 | } |
| 1377 | else { |
| 1378 | // this is OK because we clone the node in the setter |
| 1379 | xccdf_target_identifier_set_xml_nodecxx . . $ xccdf_target_identifier_set_xml_node(3a2662d9c959b185).(ret, xmlTextReaderCurrentNodecxx . . $ xmlTextReaderCurrentNode(ed6f36f6605b4589).(reader)); |
| 1380 | } |
| 1381 | |
| 1382 | return ret; |
| 1383 | } |
| 1384 | |
| 1385 | static struct xccdf_scorecxx . . $ xccdf_score# *xccdf_score_new_parsecxx . . $ xccdf_score_new_parse(f68d1fc2a3311064).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1386 | { |
| 1387 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_SCORE); |
| 1388 | |
| 1389 | struct xccdf_scorecxx . . $ xccdf_score# *score = xccdf_score_newcxx . . $ xccdf_score_new(cc37c8c82be3ddf2).(); |
| 1390 | score->systemcxx . . $ xccdf_score#system. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_SYSTEMcxx . . $ XCCDFA_SYSTEM.); |
| 1391 | if (xccdf_attribute_hascxx . . $ xccdf_attribute_has(5c4b5ba7d6a00a2).(reader, XCCDFA_MAXIMUMcxx . . $ XCCDFA_MAXIMUM.)) |
| 1392 | score->maximumcxx . . $ xccdf_score#maximum. = xccdf_attribute_get_floatcxx . . $ xccdf_attribute_get_float(ff0b6e2937c2a058).(reader, XCCDFA_MAXIMUMcxx . . $ XCCDFA_MAXIMUM.); |
| 1393 | else score->maximumcxx . . $ xccdf_score#maximum. = XCCDF_SCORE_MAX_DAFAULTcxx . . $ XCCDF_SCORE_MAX_DAFAULT.; |
| 1394 | score->scorecxx . . $ xccdf_score#score. = atofcxx . . $ atof(9a18bdb0e56c1bc2).(oscap_element_string_getcxx . . $ oscap_element_string_get(fcb9bb882cfd5f9d).(reader)); |
| 1395 | return score; |
| 1396 | } |
| 1397 | |
| 1398 | static struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *xccdf_rule_result_new_parsecxx . . $ xccdf_rule_result_new_parse(a65bf7c6548f7334).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1399 | { |
| 1400 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_RULE_RESULT); |
| 1401 | |
| 1402 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rr = xccdf_rule_result_newcxx . . $ xccdf_rule_result_new(8246cd908aadc7ea).(); |
| 1403 | |
| 1404 | rr->idrefcxx . . $ xccdf_rule_result#idref. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_IDREFcxx . . $ XCCDFA_IDREF.); |
| 1405 | rr->rolecxx . . $ xccdf_rule_result#role. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_ROLE_MAPcxx . . $ XCCDF_ROLE_MAP., xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_ROLEcxx . . $ XCCDFA_ROLE.)); |
| 1406 | rr->timecxx . . $ xccdf_rule_result#time. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_TIMEcxx . . $ XCCDFA_TIME.); |
| 1407 | rr->versioncxx . . $ xccdf_rule_result#version. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_VERSIONcxx . . $ XCCDFA_VERSION.); |
| 1408 | rr->weightcxx . . $ xccdf_rule_result#weight. = xccdf_attribute_get_floatcxx . . $ xccdf_attribute_get_float(ff0b6e2937c2a058).(reader, XCCDFA_WEIGHTcxx . . $ XCCDFA_WEIGHT.); |
| 1409 | rr->severitycxx . . $ xccdf_rule_result#severity. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_LEVEL_MAPcxx . . $ XCCDF_LEVEL_MAP., xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_SEVERITYcxx . . $ XCCDFA_SEVERITY.)); |
| 1410 | |
| 1411 | int depth = oscap_element_depthcxx . . $ oscap_element_depth(82a242a19623f75).(reader) + 1; |
| 1412 | |
| 1413 | while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, depth)) { |
| 1414 | switch (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader)) { |
| 1415 | case XCCDFE_RESULTcxx . . $ XCCDFE_RESULT.: |
| 1416 | rr->resultcxx . . $ xccdf_rule_result#result. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP., oscap_element_string_getcxx . . $ oscap_element_string_get(fcb9bb882cfd5f9d).(reader)); |
| 1417 | break; |
| 1418 | case XCCDFE_OVERRIDEcxx . . $ XCCDFE_OVERRIDE.: |
| 1419 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->overridescxx . . $ xccdf_rule_result#overrides., xccdf_override_new_parsecxx . . $ xccdf_override_new_parse(99d6e22bd6d32a2a).(reader)); |
| 1420 | break; |
| 1421 | case XCCDFE_IDENTcxx . . $ XCCDFE_IDENT.: |
| 1422 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->identscxx . . $ xccdf_rule_result#idents., xccdf_ident_parsecxx . . $ xccdf_ident_parse(57af45080b4e3c6f).(reader)); |
| 1423 | break; |
| 1424 | case XCCDFE_MESSAGEcxx . . $ XCCDFE_MESSAGE.: |
| 1425 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->messagescxx . . $ xccdf_rule_result#messages., xccdf_message_new_parsecxx . . $ xccdf_message_new_parse(f40fc962c3c1a423).(reader)); |
| 1426 | break; |
| 1427 | case XCCDFE_INSTANCEcxx . . $ XCCDFE_INSTANCE.: |
| 1428 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->instancescxx . . $ xccdf_rule_result#instances., xccdf_instance_new_parsecxx . . $ xccdf_instance_new_parse(237cad402f5d2d2c).(reader)); |
| 1429 | break; |
| 1430 | case XCCDFE_FIXcxx . . $ XCCDFE_FIX.: |
| 1431 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->fixescxx . . $ xccdf_rule_result#fixes., xccdf_fix_parsecxx . . $ xccdf_fix_parse(d0483b468e4b06a7).(reader)); |
| 1432 | break; |
| 1433 | case XCCDFE_CHECKcxx . . $ XCCDFE_CHECK.: |
| 1434 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(rr->checkscxx . . $ xccdf_rule_result#checks., xccdf_check_parsecxx . . $ xccdf_check_parse(91f7c6d5425e84bb).(reader)); |
| 1435 | break; |
| 1436 | default: break; |
| 1437 | } |
| 1438 | xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader); |
| 1439 | } |
| 1440 | |
| 1441 | return rr; |
| 1442 | } |
| 1443 | |
| 1444 | xmlNodecxx . . $ xmlNode# *xccdf_target_identifier_to_domcxx . . $ xccdf_target_identifier_to_dom(25b56f9178787f96).(const struct xccdf_target_identifiercxx . . $ xccdf_target_identifier# *ti, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info) |
| 1445 | { |
| 1446 | if (ti->any_elementcxx . . $ xccdf_target_identifier#any_element.) { |
| 1447 | // we have to copy since we are adding the node to an existing document |
| 1448 | // and that document will take ownership |
| 1449 | xmlNodePtrcxx . . $ xmlNodePtr# ret = xmlCopyNodecxx . . $ xmlCopyNode(659181c62eedb9c9).(ti->elementcxx . . $ xccdf_target_identifier#element., 1); |
| 1450 | xmlAddChildcxx . . $ xmlAddChild(93e65f4d4ebd68bd).(parent, ret); |
| 1451 | return ret; |
| 1452 | } |
| 1453 | else { |
| 1454 | xmlNscxx . . $ xmlNs# *ns_xccdf = lookup_xccdf_nscxx . . $ lookup_xccdf_ns(145fb009c13e3a1).(doc, parent, version_info); |
| 1455 | |
| 1456 | xmlNodecxx . . $ xmlNode# *target_idref_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "target-id-ref", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1457 | |
| 1458 | /* Handle attributes */ |
| 1459 | const char *psystem = xccdf_target_identifier_get_systemcxx . . $ xccdf_target_identifier_get_system(2a92a705ae10eb92).(ti); |
| 1460 | if (psystem) |
| 1461 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(target_idref_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "system", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! psystem); |
| 1462 | |
| 1463 | const char *href = xccdf_target_identifier_get_hrefcxx . . $ xccdf_target_identifier_get_href(2a92a705ae10eb92).(ti); |
| 1464 | if (href) |
| 1465 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(target_idref_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "href", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! href); |
| 1466 | |
| 1467 | const char *name = xccdf_target_identifier_get_namecxx . . $ xccdf_target_identifier_get_name(2a92a705ae10eb92).(ti); |
| 1468 | if (name) |
| 1469 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(target_idref_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "name", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! name); |
| 1470 | |
| 1471 | return target_idref_node; |
| 1472 | } |
| 1473 | } |
| 1474 | static void _xccdf_rule_result_to_dom_idrefcxx . . $ _xccdf_rule_result_to_dom_idref(3d27fcde9e96af93).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *result, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info, struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark, const char *idref); |
| 1475 | void xccdf_rule_result_to_domcxx . . $ xccdf_rule_result_to_dom(429f7d99c14d4a4e).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *result, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info, struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! use_stig_rule_id, struct oscap_htablecxx . . $ oscap_htable# *nodes_by_rule_id) |
| 1476 | { |
| 1477 | const char *idref = xccdf_rule_result_get_idrefcxx . . $ xccdf_rule_result_get_idref(d7da8a9a9f9bf6c8).(result); |
| 1478 | if (use_stig_rule_id) { |
| 1479 | // Don't output rules with no stig ids |
| 1480 | if (!idref || !benchmark) |
| 1481 | return; |
| 1482 | |
| 1483 | const struct xccdf_itemcxx . . $ xccdf_item# *item = xccdf_benchmark_get_membercxx . . $ xccdf_benchmark_get_member(51139a28f6959fd9).(benchmark, XCCDF_RULEcxx . . $ XCCDF_RULE., idref); |
| 1484 | if (!item) |
| 1485 | return; |
| 1486 | |
| 1487 | struct oscap_reference_iteratorcxx . . $ oscap_reference_iterator# *references = xccdf_item_get_referencescxx . . $ xccdf_item_get_references(58b511645be6226a).(item); |
| 1488 | while (oscap_reference_iterator_has_morecxx . . $ oscap_reference_iterator_has_more(3902913d46f91173).(references)) { |
| 1489 | struct oscap_referencecxx . . $ oscap_reference# *ref = oscap_reference_iterator_nextcxx . . $ oscap_reference_iterator_next(81bc9a067126085c).(references); |
| 1490 | const char *href = oscap_reference_get_hrefcxx . . $ oscap_reference_get_href(2a9eef276a992895).(ref); |
| 1491 | if (href && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[0]) == 0 || |
| 1492 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[1]) == 0 || |
| 1493 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(href, DISA_STIG_VIEWER_HREFcxx . . $ DISA_STIG_VIEWER_HREF.[2]) == 0)) { |
| 1494 | const char *stig_rule_id = oscap_reference_get_titlecxx . . $ oscap_reference_get_title(2a9eef276a992895).(ref); |
| 1495 | |
| 1496 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# expected_res = (xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t#)oscap_htable_getcxx . . $ oscap_htable_get(f5c7e8ff6c970cd3).(nodes_by_rule_id, stig_rule_id); |
| 1497 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# test_res = xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(result); |
| 1498 | if (expected_res == test_res) { |
| 1499 | oscap_htable_detachcxx . . $ oscap_htable_detach(f5c7e8ff6c970cd3).(nodes_by_rule_id, stig_rule_id); |
| 1500 | _xccdf_rule_result_to_dom_idrefcxx . . $ _xccdf_rule_result_to_dom_idref(3d27fcde9e96af93).(result, doc, parent, version_info, benchmark, stig_rule_id); |
| 1501 | } |
| 1502 | } |
| 1503 | } |
| 1504 | oscap_reference_iterator_freecxx . . $ oscap_reference_iterator_free(3e07142178288e0).(references); |
| 1505 | } else { |
| 1506 | _xccdf_rule_result_to_dom_idrefcxx . . $ _xccdf_rule_result_to_dom_idref(3d27fcde9e96af93).(result, doc, parent, version_info, benchmark, idref); |
| 1507 | } |
| 1508 | } |
| 1509 | static void _xccdf_rule_result_to_dom_idrefcxx . . $ _xccdf_rule_result_to_dom_idref(3d27fcde9e96af93).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *result, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info, struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *benchmark, const char *idref) { |
| 1510 | xmlNscxx . . $ xmlNs# *ns_xccdf = lookup_xccdf_nscxx . . $ lookup_xccdf_ns(145fb009c13e3a1).(doc, parent, version_info); |
| 1511 | |
| 1512 | xmlNodecxx . . $ xmlNode# *result_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "rule-result", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1513 | |
| 1514 | /* Handle attributes */ |
| 1515 | if (idref) |
| 1516 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "idref", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! idref); |
| 1517 | |
| 1518 | xccdf_role_tcxx . . $ xccdf_role_t# role = xccdf_rule_result_get_rolecxx . . $ xccdf_rule_result_get_role(2b60499d60781f21).(result); |
| 1519 | if (role != 0) |
| 1520 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "role", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_ROLE_MAPcxx . . $ XCCDF_ROLE_MAP.[role - 1].stringcxx . . $ oscap_string_map#string.); |
| 1521 | |
| 1522 | const char * tm = xccdf_rule_result_get_timecxx . . $ xccdf_rule_result_get_time(d7da8a9a9f9bf6c8).(result); |
| 1523 | if (tm) { |
| 1524 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "time", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! tm); |
| 1525 | } |
| 1526 | |
| 1527 | xccdf_level_tcxx . . $ xccdf_level_t# severity = xccdf_rule_result_get_severitycxx . . $ xccdf_rule_result_get_severity(142ab3aceb64f0dc).(result); |
| 1528 | if (severity != XCCDF_LEVEL_NOT_DEFINEDcxx . . $ XCCDF_LEVEL_NOT_DEFINED.) |
| 1529 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "severity", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_LEVEL_MAPcxx . . $ XCCDF_LEVEL_MAP.[severity - 1].stringcxx . . $ oscap_string_map#string.); |
| 1530 | |
| 1531 | const char *version = xccdf_rule_result_get_versioncxx . . $ xccdf_rule_result_get_version(d7da8a9a9f9bf6c8).(result); |
| 1532 | if (version) |
| 1533 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "version", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! version); |
| 1534 | |
| 1535 | float weight = xccdf_rule_result_get_weightcxx . . $ xccdf_rule_result_get_weight(9d0f9626079a9e77).(result); |
| 1536 | char *weight_str = oscap_sprintfcxx . . $ oscap_sprintf(a849077ff1b8d812).("%f", weight); |
| 1537 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(result_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "weight", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! weight_str); |
| 1538 | freecxx . . $ free(5d22bdacc48458e8).(weight_str); |
| 1539 | |
| 1540 | /* Handle children */ |
| 1541 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# test_res = xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(result); |
| 1542 | if (test_res != 0) |
| 1543 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "result", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP.[test_res - 1].stringcxx . . $ oscap_string_map#string.); |
| 1544 | |
| 1545 | struct xccdf_override_iteratorcxx . . $ xccdf_override_iterator# *overrides = xccdf_rule_result_get_overridescxx . . $ xccdf_rule_result_get_overrides(9fe40f3d1b09c96f).(result); |
| 1546 | while (xccdf_override_iterator_has_morecxx . . $ xccdf_override_iterator_has_more(50a9dfdc94e014bd).(overrides)) { |
| 1547 | struct xccdf_overridecxx . . $ xccdf_override# *override = xccdf_override_iterator_nextcxx . . $ xccdf_override_iterator_next(c0e1f15d7135f144).(overrides); |
| 1548 | xccdf_override_to_domcxx . . $ xccdf_override_to_dom(87a660e21d2c6be).(override, doc, result_node, version_info); |
| 1549 | } |
| 1550 | xccdf_override_iterator_freecxx . . $ xccdf_override_iterator_free(5e48db4e8385b028).(overrides); |
| 1551 | |
| 1552 | struct xccdf_ident_iteratorcxx . . $ xccdf_ident_iterator# *idents = xccdf_rule_result_get_identscxx . . $ xccdf_rule_result_get_idents(29652c7f2d45ec0b).(result); |
| 1553 | while (xccdf_ident_iterator_has_morecxx . . $ xccdf_ident_iterator_has_more(9cd00765e4887e1a).(idents)) { |
| 1554 | struct xccdf_identcxx . . $ xccdf_ident# *ident = xccdf_ident_iterator_nextcxx . . $ xccdf_ident_iterator_next(980350b3dadb3f34).(idents); |
| 1555 | xccdf_ident_to_domcxx . . $ xccdf_ident_to_dom(1b85a4fa2445e286).(ident, doc, result_node, version_info); |
| 1556 | } |
| 1557 | xccdf_ident_iterator_freecxx . . $ xccdf_ident_iterator_free(24490d322c8816ab).(idents); |
| 1558 | |
| 1559 | struct xccdf_message_iteratorcxx . . $ xccdf_message_iterator# *messages = xccdf_rule_result_get_messagescxx . . $ xccdf_rule_result_get_messages(3d7d0ca866bc1bab).(result); |
| 1560 | while (xccdf_message_iterator_has_morecxx . . $ xccdf_message_iterator_has_more(34b2bceddf5e90a4).(messages)) { |
| 1561 | struct xccdf_messagecxx . . $ xccdf_message# *message = xccdf_message_iterator_nextcxx . . $ xccdf_message_iterator_next(65d35934a38436f0).(messages); |
| 1562 | const char *content = xccdf_message_get_contentcxx . . $ xccdf_message_get_content(1f4448ce48e7fd1d).(message); |
| 1563 | xmlCharcxx . . $ xmlChar# *encoded_content = xmlEncodeEntitiesReentrantcxx . . $ xmlEncodeEntitiesReentrant(c515f14df44ff37e).(doc, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! content); |
| 1564 | xmlNodecxx . . $ xmlNode# *message_node = xmlNewChildcxx . . $ xmlNewChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "message", encoded_content); |
| 1565 | xmlFreecxx . . $ xmlFree.(encoded_content); |
| 1566 | |
| 1567 | xccdf_message_severity_tcxx . . $ xccdf_message_severity_t# message_severity = xccdf_message_get_severitycxx . . $ xccdf_message_get_severity(f4389e06554caf05).(message); |
| 1568 | if (message_severity != XCCDF_MSG_NOT_DEFINEDcxx . . $ XCCDF_MSG_NOT_DEFINED.) |
| 1569 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(message_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "severity", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_LEVEL_MAPcxx . . $ XCCDF_LEVEL_MAP.[message_severity - 1].stringcxx . . $ oscap_string_map#string.); |
| 1570 | } |
| 1571 | xccdf_message_iterator_freecxx . . $ xccdf_message_iterator_free(7483b5ecd3136ea).(messages); |
| 1572 | |
| 1573 | struct xccdf_instance_iteratorcxx . . $ xccdf_instance_iterator# *instances = xccdf_rule_result_get_instancescxx . . $ xccdf_rule_result_get_instances(f5a515bc55a2543d).(result); |
| 1574 | while (xccdf_instance_iterator_has_morecxx . . $ xccdf_instance_iterator_has_more(372a6fb4bd032f6f).(instances)) { |
| 1575 | struct xccdf_instancecxx . . $ xccdf_instance# *instance = xccdf_instance_iterator_nextcxx . . $ xccdf_instance_iterator_next(4821a53661e5cc19).(instances); |
| 1576 | const char *content = xccdf_instance_get_contentcxx . . $ xccdf_instance_get_content(875f5045a6eeee78).(instance); |
| 1577 | xmlNodecxx . . $ xmlNode# *instance_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(result_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "instance", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! content); |
| 1578 | |
| 1579 | const char *context = xccdf_instance_get_contextcxx . . $ xccdf_instance_get_context(875f5045a6eeee78).(instance); |
| 1580 | if (context) |
| 1581 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(instance_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "context", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! context); |
| 1582 | |
| 1583 | const char *parent_context = xccdf_instance_get_contextcxx . . $ xccdf_instance_get_context(875f5045a6eeee78).(instance); |
| 1584 | if (parent_context) |
| 1585 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(instance_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "parentContext", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! context); |
| 1586 | } |
| 1587 | xccdf_instance_iterator_freecxx . . $ xccdf_instance_iterator_free(fbce03e4b7bd5fec).(instances); |
| 1588 | |
| 1589 | struct xccdf_fix_iteratorcxx . . $ xccdf_fix_iterator# *fixes = xccdf_rule_result_get_fixescxx . . $ xccdf_rule_result_get_fixes(b6977162ac6456ea).(result); |
| 1590 | while (xccdf_fix_iterator_has_morecxx . . $ xccdf_fix_iterator_has_more(8344f4a32c58f139).(fixes)) { |
| 1591 | struct xccdf_fixcxx . . $ xccdf_fix# *fix = xccdf_fix_iterator_nextcxx . . $ xccdf_fix_iterator_next(9a95ad7b0146f43c).(fixes); |
| 1592 | xccdf_fix_to_domcxx . . $ xccdf_fix_to_dom(20dcfd4d69b8f8e8).(fix, doc, result_node, version_info); |
| 1593 | } |
| 1594 | xccdf_fix_iterator_freecxx . . $ xccdf_fix_iterator_free(a510a8e9c8cea220).(fixes); |
| 1595 | |
| 1596 | struct xccdf_check_iteratorcxx . . $ xccdf_check_iterator# *checks = xccdf_rule_result_get_checkscxx . . $ xccdf_rule_result_get_checks(c5eec5d58984417b).(result); |
| 1597 | while (xccdf_check_iterator_has_morecxx . . $ xccdf_check_iterator_has_more(644a620a92cf84a7).(checks)) { |
| 1598 | struct xccdf_checkcxx . . $ xccdf_check# *check = xccdf_check_iterator_nextcxx . . $ xccdf_check_iterator_next(a435bf31c65e745a).(checks); |
| 1599 | xccdf_check_to_domcxx . . $ xccdf_check_to_dom(9632601fe73cd180).(check, doc, result_node, version_info); |
| 1600 | } |
| 1601 | xccdf_check_iterator_freecxx . . $ xccdf_check_iterator_free(dcf67c9af31da2e3).(checks); |
| 1602 | } |
| 1603 | |
| 1604 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! xccdf_rule_result_overridecxx . . $ xccdf_rule_result_override(70a79462b35422e1).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rule_result, xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# new_result, const char *waiver_time, const char *authority, struct oscap_textcxx . . $ oscap_text# *remark) |
| 1605 | { |
| 1606 | struct xccdf_overridecxx . . $ xccdf_override# *o= xccdf_override_newcxx . . $ xccdf_override_new(9e8c2415cc10d7f7).(); |
| 1607 | xccdf_override_set_old_resultcxx . . $ xccdf_override_set_old_result(fc8a64461c5ea6ea).(o, xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result)); |
| 1608 | xccdf_override_set_new_resultcxx . . $ xccdf_override_set_new_result(fc8a64461c5ea6ea).(o, new_result); |
| 1609 | xccdf_override_set_timecxx . . $ xccdf_override_set_time(581149eef2862200).(o, waiver_time); |
| 1610 | xccdf_override_set_authoritycxx . . $ xccdf_override_set_authority(581149eef2862200).(o, authority); |
| 1611 | xccdf_override_set_remarkcxx . . $ xccdf_override_set_remark(51d7f0dad488c11a).(o, remark); |
| 1612 | if (!xccdf_rule_result_add_overridecxx . . $ xccdf_rule_result_add_override(5864e795877b8892).(rule_result, o)) { |
| 1613 | xccdf_override_freecxx . . $ xccdf_override_free(a9dcf5f2d9947221).(o); |
| 1614 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 1615 | } |
| 1616 | return xccdf_rule_result_set_resultcxx . . $ xccdf_rule_result_set_result(f5f20b6cb7f23401).(rule_result, new_result); |
| 1617 | } |
| 1618 | |
| 1619 | static struct xccdf_overridecxx . . $ xccdf_override# *xccdf_override_new_parsecxx . . $ xccdf_override_new_parse(99d6e22bd6d32a2a).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1620 | { |
| 1621 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_OVERRIDE); |
| 1622 | |
| 1623 | struct xccdf_overridecxx . . $ xccdf_override# *override = xccdf_override_newcxx . . $ xccdf_override_new(9e8c2415cc10d7f7).(); |
| 1624 | |
| 1625 | override->timecxx . . $ xccdf_override#time. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_TIMEcxx . . $ XCCDFA_TIME.); |
| 1626 | override->authoritycxx . . $ xccdf_override#authority. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_AUTHORITYcxx . . $ XCCDFA_AUTHORITY.); |
| 1627 | |
| 1628 | int depth = oscap_element_depthcxx . . $ oscap_element_depth(82a242a19623f75).(reader) + 1; |
| 1629 | |
| 1630 | while (oscap_to_start_elementcxx . . $ oscap_to_start_element(c0c45fd800596ca5).(reader, depth)) { |
| 1631 | switch (xccdf_element_getcxx . . $ xccdf_element_get(a5dd71d24d1f6f1).(reader)) { |
| 1632 | case XCCDFE_OLD_RESULTcxx . . $ XCCDFE_OLD_RESULT.: |
| 1633 | override->old_resultcxx . . $ xccdf_override#old_result. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP., oscap_element_string_getcxx . . $ oscap_element_string_get(fcb9bb882cfd5f9d).(reader)); |
| 1634 | break; |
| 1635 | case XCCDFE_NEW_RESULTcxx . . $ XCCDFE_NEW_RESULT.: |
| 1636 | override->new_resultcxx . . $ xccdf_override#new_result. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP., oscap_element_string_getcxx . . $ oscap_element_string_get(fcb9bb882cfd5f9d).(reader)); |
| 1637 | break; |
| 1638 | case XCCDFE_REMARKcxx . . $ XCCDFE_REMARK.: |
| 1639 | if (override->remarkcxx . . $ xccdf_override#remark. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1640 | override->remarkcxx . . $ xccdf_override#remark. = oscap_text_new_parsecxx . . $ oscap_text_new_parse(fc91cb6a8c9d272a).(XCCDF_TEXT_PLAINcxx . . $ XCCDF_TEXT_PLAIN., reader); |
| 1641 | break; |
| 1642 | default: break; |
| 1643 | } |
| 1644 | xmlTextReaderReadcxx . . $ xmlTextReaderRead(82a242a19623f75).(reader); |
| 1645 | } |
| 1646 | |
| 1647 | return override; |
| 1648 | } |
| 1649 | |
| 1650 | xmlNodecxx . . $ xmlNode# *xccdf_override_to_domcxx . . $ xccdf_override_to_dom(87a660e21d2c6be).(struct xccdf_overridecxx . . $ xccdf_override# *override, xmlDoccxx . . $ xmlDoc# *doc, xmlNodecxx . . $ xmlNode# *parent, const struct xccdf_version_infocxx . . $ xccdf_version_info#* version_info) |
| 1651 | { |
| 1652 | xmlNscxx . . $ xmlNs# *ns_xccdf = lookup_xccdf_nscxx . . $ lookup_xccdf_ns(145fb009c13e3a1).(doc, parent, version_info); |
| 1653 | |
| 1654 | xmlNodecxx . . $ xmlNode# *override_node = xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(parent, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "override", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1655 | |
| 1656 | /* Handle attributes */ |
| 1657 | const char *tm = xccdf_override_get_timecxx . . $ xccdf_override_get_time(35352e9c0c4ac899).(override); |
| 1658 | if(tm) { |
| 1659 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(override_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "date", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! tm); |
| 1660 | } |
| 1661 | |
| 1662 | const char *authority = xccdf_override_get_authoritycxx . . $ xccdf_override_get_authority(35352e9c0c4ac899).(override); |
| 1663 | if (authority) |
| 1664 | xmlNewPropcxx . . $ xmlNewProp(6ee5a6130c40eb8b).(override_node, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "authority", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! authority); |
| 1665 | |
| 1666 | /* Handle children */ |
| 1667 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# old = xccdf_override_get_old_resultcxx . . $ xccdf_override_get_old_result(ded7181f1c88520f).(override); |
| 1668 | if (old != 0) |
| 1669 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(override_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "old-result", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP.[old - 1].stringcxx . . $ oscap_string_map#string.); |
| 1670 | |
| 1671 | xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# new = xccdf_override_get_new_resultcxx . . $ xccdf_override_get_new_result(ded7181f1c88520f).(override); |
| 1672 | if (new != 0) |
| 1673 | xmlNewTextChildcxx . . $ xmlNewTextChild(4c74f4d7754e7bc8).(override_node, ns_xccdf, BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! "new-result", BAD_CASTcxx . . $ `<external>/11592416788776295748/xmlstring.h:34:9`! XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP.[new - 1].stringcxx . . $ oscap_string_map#string.); |
| 1674 | |
| 1675 | oscap_text_to_domcxx . . $ oscap_text_to_dom(884e3243567ea9a2).(xccdf_override_get_remarkcxx . . $ xccdf_override_get_remark(b4bddaa0b5aaf5a3).(override), override_node, "remark"); |
| 1676 | |
| 1677 | return override_node; |
| 1678 | } |
| 1679 | |
| 1680 | static struct xccdf_messagecxx . . $ xccdf_message# *xccdf_message_new_parsecxx . . $ xccdf_message_new_parse(f40fc962c3c1a423).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1681 | { |
| 1682 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_MESSAGE); |
| 1683 | |
| 1684 | struct xccdf_messagecxx . . $ xccdf_message# *msg = xccdf_message_newcxx . . $ xccdf_message_new(19dd3caa70854cb9).(); |
| 1685 | msg->severitycxx . . $ xccdf_message#severity. = oscap_string_to_enumcxx . . $ oscap_string_to_enum(851d6ce10579b7d8).(XCCDF_LEVEL_MAPcxx . . $ XCCDF_LEVEL_MAP., xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_SEVERITYcxx . . $ XCCDFA_SEVERITY.)); |
| 1686 | msg->contentcxx . . $ xccdf_message#content. = oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader); |
| 1687 | return msg; |
| 1688 | } |
| 1689 | |
| 1690 | static struct xccdf_instancecxx . . $ xccdf_instance# *xccdf_instance_new_parsecxx . . $ xccdf_instance_new_parse(237cad402f5d2d2c).(xmlTextReaderPtrcxx . . $ xmlTextReaderPtr# reader) |
| 1691 | { |
| 1692 | XCCDF_ASSERT_ELEMENTcxx . . $ `src/XCCDF/elements.h:141:9`!(reader, XCCDFE_INSTANCE); |
| 1693 | |
| 1694 | struct xccdf_instancecxx . . $ xccdf_instance# *inst = xccdf_instance_newcxx . . $ xccdf_instance_new(939dd1c087dd0274).(); |
| 1695 | if (xccdf_attribute_hascxx . . $ xccdf_attribute_has(5c4b5ba7d6a00a2).(reader, XCCDFA_CONTEXTcxx . . $ XCCDFA_CONTEXT.)) |
| 1696 | xccdf_instance_set_contextcxx . . $ xccdf_instance_set_context(48cf526edb9cb31d).(inst, xccdf_attribute_getcxx . . $ xccdf_attribute_get(9e9cd2f6cdd20132).(reader, XCCDFA_CONTEXTcxx . . $ XCCDFA_CONTEXT.)); |
| 1697 | inst->parent_contextcxx . . $ xccdf_instance#parent_context. = xccdf_attribute_copycxx . . $ xccdf_attribute_copy(861b5c6f59611beb).(reader, XCCDFA_PARENTCONTEXTcxx . . $ XCCDFA_PARENTCONTEXT.); |
| 1698 | inst->contentcxx . . $ xccdf_instance#content. = oscap_element_string_copycxx . . $ oscap_element_string_copy(93c99f8009311dd0).(reader); |
| 1699 | return inst; |
| 1700 | } |
| 1701 | |
| 1702 | const char * xccdf_test_result_type_get_textcxx . . $ xccdf_test_result_type_get_text(b7e1b929574c5650).(xccdf_test_result_type_tcxx . . $ xccdf_test_result_type_t# id) |
| 1703 | { |
| 1704 | if (id == 0) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1705 | |
| 1706 | return XCCDF_RESULT_MAPcxx . . $ XCCDF_RESULT_MAP.[id - 1].stringcxx . . $ oscap_string_map#string.; |
| 1707 | } |
| 1708 | |
| 1709 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# * xccdf_result_get_rule_result_by_idcxx . . $ xccdf_result_get_rule_result_by_id(1ed384c5e52f0df).(struct xccdf_resultcxx . . $ xccdf_result# * result, const char * id) |
| 1710 | { |
| 1711 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# * rule_result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1712 | |
| 1713 | struct xccdf_rule_result_iteratorcxx . . $ xccdf_rule_result_iterator# * rr_it = xccdf_result_get_rule_resultscxx . . $ xccdf_result_get_rule_results(6465447fe4419503).(result); |
| 1714 | while (xccdf_rule_result_iterator_has_morecxx . . $ xccdf_rule_result_iterator_has_more(4b8217bc6f572439).(rr_it)) { |
| 1715 | rule_result = xccdf_rule_result_iterator_nextcxx . . $ xccdf_rule_result_iterator_next(e8bc98eb60cdbb5a).(rr_it); |
| 1716 | if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).(xccdf_rule_result_get_idrefcxx . . $ xccdf_rule_result_get_idref(d7da8a9a9f9bf6c8).(rule_result), id)) |
| 1717 | break; |
| 1718 | else rule_result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1719 | } |
| 1720 | xccdf_rule_result_iterator_freecxx . . $ xccdf_rule_result_iterator_free(c5d87bde560339c3).(rr_it); |
| 1721 | |
| 1722 | return rule_result; |
| 1723 | } |
| 1724 | |
| 1725 | /* -------- DUMP ---------- */ |
| 1726 | |
| 1727 | static void xccdf_rule_result_dumpcxx . . $ xccdf_rule_result_dump(47b9a64983f1d195).(struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *res, int depth) |
| 1728 | { |
| 1729 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("Rule result: %s\n", xccdf_rule_result_get_idrefcxx . . $ xccdf_rule_result_get_idref(d7da8a9a9f9bf6c8).(res)); ++depth; |
| 1730 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("version: %s\n", xccdf_rule_result_get_versioncxx . . $ xccdf_rule_result_get_version(d7da8a9a9f9bf6c8).(res)); |
| 1731 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("weight: %f\n", xccdf_rule_result_get_weightcxx . . $ xccdf_rule_result_get_weight(9d0f9626079a9e77).(res)); |
| 1732 | } |
| 1733 | |
| 1734 | void xccdf_result_dumpcxx . . $ xccdf_result_dump(e76502234baee0b2).(struct xccdf_resultcxx . . $ xccdf_result# *res, int depth) |
| 1735 | { |
| 1736 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("TestResult : %s\n", (res ? xccdf_result_get_idcxx . . $ xccdf_result_get_id(9b243840ec21a788).(res) : "(NULL)")); |
| 1737 | if (res != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1738 | ++depth; xccdf_item_printcxx . . $ xccdf_item_print(399eb5318584c7ce).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res), depth); |
| 1739 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("test system: %s\n", xccdf_result_get_test_systemcxx . . $ xccdf_result_get_test_system(9b243840ec21a788).(res)); |
| 1740 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("benchmark URI: %s\n", xccdf_result_get_benchmark_uricxx . . $ xccdf_result_get_benchmark_uri(9b243840ec21a788).(res)); |
| 1741 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("profile ID: %s\n", xccdf_result_get_profilecxx . . $ xccdf_result_get_profile(9b243840ec21a788).(res)); |
| 1742 | // start time, end time... |
| 1743 | //xccdf_print_depth(depth); printf("identities"); |
| 1744 | //oscap_list_dump(XITEM(res)->result.identities, NULL, depth+1); |
| 1745 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("targets"); |
| 1746 | oscap_list_dumpcxx . . $ oscap_list_dump(df0831e7fcc09688).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..targetscxx . . $ xccdf_result_item#targets., xccdf_cstring_dumpcxx . . $ xccdf_cstring_dump(34d26762b42c433a)., depth+1); |
| 1747 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("organizations"); |
| 1748 | oscap_list_dumpcxx . . $ oscap_list_dump(df0831e7fcc09688).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..organizationscxx . . $ xccdf_result_item#organizations., xccdf_cstring_dumpcxx . . $ xccdf_cstring_dump(34d26762b42c433a)., depth+1); |
| 1749 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("remarks"); |
| 1750 | xccdf_print_textlistcxx . . $ xccdf_print_textlist(87adaa5870f6d825).(xccdf_result_get_remarkscxx . . $ xccdf_result_get_remarks(3a678574d2775360).(res), depth+1, 80, "..."); |
| 1751 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("target addresses"); |
| 1752 | oscap_list_dumpcxx . . $ oscap_list_dump(df0831e7fcc09688).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..target_addressescxx . . $ xccdf_result_item#target_addresses., xccdf_cstring_dumpcxx . . $ xccdf_cstring_dump(34d26762b42c433a)., depth+1); |
| 1753 | //xccdf_print_depth(depth); printf("target_facts"); |
| 1754 | //xccdf_print_depth(depth); printf("target_id_refs"); |
| 1755 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("setvalues"); |
| 1756 | oscap_list_dumpcxx . . $ oscap_list_dump(df0831e7fcc09688).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..setvaluescxx . . $ xccdf_result_item#setvalues., xccdf_setvalue_dumpcxx . . $ xccdf_setvalue_dump(b61cc615f91fce7b)., depth+1); |
| 1757 | xccdf_print_depthcxx . . $ xccdf_print_depth(d4f767463ce0a6b3).(depth); printfcxx . . $ printf(581fddd72a8db8fc).("rule results"); |
| 1758 | oscap_list_dumpcxx . . $ oscap_list_dump(df0831e7fcc09688).(XITEMcxx . . $ `src/XCCDF/helpers.h:35:9`!(res)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..rule_resultscxx . . $ xccdf_result_item#rule_results., (oscap_dump_funccxx . . $ oscap_dump_func#) xccdf_rule_result_dumpcxx . . $ xccdf_rule_result_dump(47b9a64983f1d195)., depth+1); |
| 1759 | //xccdf_print_depth(depth); printf("scores"); |
| 1760 | } |
| 1761 | } |
| 1762 | |
| 1763 | /* |
| 1764 | * @returns pointer to text representation of the current local time |
| 1765 | * and NULL on failure. The string is statically allocated and might |
| 1766 | * be overwritten on subsequent calls to this function |
| 1767 | */ |
| 1768 | static inline const char *_get_timestampcxx . . $ _get_timestamp(33a1f659e94feb42).(void) |
| 1769 | { |
| 1770 | static char timestamp[] = "yyyy-mm-ddThh:mm:ss+zz:zz"; |
| 1771 | time_tcxx . . $ time_t# tm; |
| 1772 | struct tmcxx . . $ tm# *lt; |
| 1773 | struct tmcxx . . $ tm# result; |
| 1774 | int tz_diff; |
| 1775 | char tz_sign; |
| 1776 | |
| 1777 | tm = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1778 | lt = localtime_rcxx . . $ localtime_r(92e3d173686db852).(&tm, &result); |
| 1779 | |
| 1780 | if (!lt) |
| 1781 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1782 | |
| 1783 | #if defined(OS_FREEBSD) |
| 1784 | tz_diff = lt->tm_gmtoff; |
| 1785 | |
| 1786 | if (tz_diff < 0) { |
| 1787 | tz_sign = '-'; |
| 1788 | tz_diff *= -1; |
| 1789 | } else { |
| 1790 | tz_sign = '+'; |
| 1791 | } |
| 1792 | |
| 1793 | /* glibc's timezone offset does not account for daylight savings time. |
| 1794 | * So we match that behavior here by adding 3600 seconds |
| 1795 | */ |
| 1796 | if (lt->tm_isdst) |
| 1797 | tz_diff += 3600; |
| 1798 | #else |
| 1799 | /* timezone is a global variable set by localtime(3) */ |
| 1800 | if (timezonecxx . . $ timezone. <= 0) { |
| 1801 | tz_sign = '+'; |
| 1802 | tz_diff = -timezonecxx . . $ timezone.; |
| 1803 | } else { |
| 1804 | tz_sign = '-'; |
| 1805 | tz_diff = timezonecxx . . $ timezone.; |
| 1806 | } |
| 1807 | #endif |
| 1808 | tz_diff /= 60; |
| 1809 | |
| 1810 | int ret = snprintfcxx . . $ snprintf(ea502d73e74c754c).(timestamp, sizeof(timestamp), "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d", |
| 1811 | 1900 + lt->tm_yearcxx . . $ tm#tm_year., 1 + lt->tm_moncxx . . $ tm#tm_mon., lt->tm_mdaycxx . . $ tm#tm_mday., |
| 1812 | lt->tm_hourcxx . . $ tm#tm_hour., lt->tm_mincxx . . $ tm#tm_min., lt->tm_seccxx . . $ tm#tm_sec., tz_sign, tz_diff / 60, tz_diff % 60); |
| 1813 | |
| 1814 | if (ret < 0) { |
| 1815 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1816 | } |
| 1817 | |
| 1818 | return timestamp; |
| 1819 | } |
| 1820 | |
| 1821 | #define XCCDF_CURRENT_TIME_SETTERcxx . . $ `src/XCCDF/result.c:1821:9`!(TYPE, BOUND) \ |
| 1822 | int xccdf_##TYPE##_set##BOUND##time_current(struct xccdf_##TYPE *r) \ |
| 1823 | { return xccdf_##TYPE##_set##BOUND##time(r, _get_timestamp()); } |
| 1824 | |
| 1825 | XCCDF_CURRENT_TIME_SETTERcxx . . $ `src/XCCDF/result.c:1821:9`!(rule_result,_) |
| 1826 | XCCDF_CURRENT_TIME_SETTERcxx . . $ `src/XCCDF/result.c:1821:9`!(result,_start_) |
| 1827 | XCCDF_CURRENT_TIME_SETTERcxx . . $ `src/XCCDF/result.c:1821:9`!(result,_end_) |