| 1 | /* |
| 2 | * Copyright 2009--2014 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 22 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 23 | #endif |
| 24 | |
| 25 | #include <stdlib.h> |
| 26 | #include <string.h> |
| 27 | |
| 28 | |
| 29 | #include "common/list.h"cxx . . $ `<file>/src/common/list.h`/ |
| 30 | #include "common/_error.h"cxx . . $ `<file>/src/common/_error.h`/ |
| 31 | #include "common/debug_priv.h"cxx . . $ `<file>/src/common/debug_priv.h`/ |
| 32 | #include "public/xccdf_benchmark.h"cxx . . $ `<file>/src/XCCDF/public/xccdf_benchmark.h`/ |
| 33 | #include "XCCDF/item.h"cxx . . $ `<file>/src/XCCDF/item.h`/ |
| 34 | #include "XCCDF/result_scoring_priv.h"cxx . . $ `<file>/src/XCCDF/result_scoring_priv.h`/ |
| 35 | |
| 36 | /** |
| 37 | * XCCDF Default score structure represents Default XCCDF Score model |
| 38 | * for each rule |
| 39 | */ |
| 40 | struct xccdf_default_scorecxx . . $ xccdf_default_score# { |
| 41 | float scorecxx . . $ xccdf_default_score#score.; |
| 42 | float accumulatorcxx . . $ xccdf_default_score#accumulator.; |
| 43 | float weight_scorecxx . . $ xccdf_default_score#weight_score.; |
| 44 | int countcxx . . $ xccdf_default_score#count.; |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * XCCDF Flat score structure represents Flat XCCDF Score model |
| 49 | * for each rule |
| 50 | */ |
| 51 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# { |
| 52 | float scorecxx . . $ xccdf_flat_score#score.; |
| 53 | float weightcxx . . $ xccdf_flat_score#weight.; |
| 54 | |
| 55 | }; |
| 56 | |
| 57 | static struct xccdf_default_scorecxx . . $ xccdf_default_score# * xccdf_item_get_default_scorecxx . . $ xccdf_item_get_default_score(a58a6a0122d4a28).(struct xccdf_itemcxx . . $ xccdf_item# * item, struct xccdf_resultcxx . . $ xccdf_result# * test_result) |
| 58 | { |
| 59 | // Implements algorithm as described in NISTIR-7275-r4 |
| 60 | // Table 40: Default Model Algorithm Sub-Steps |
| 61 | struct xccdf_default_scorecxx . . $ xccdf_default_score# *score; |
| 62 | struct xccdf_default_scorecxx . . $ xccdf_default_score# *ch_score; |
| 63 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rule_result; |
| 64 | struct xccdf_itemcxx . . $ xccdf_item# *child; |
| 65 | |
| 66 | xccdf_type_tcxx . . $ xccdf_type_t# itype = xccdf_item_get_typecxx . . $ xccdf_item_get_type(3d8d48c673cd637b).(item); |
| 67 | |
| 68 | switch (itype) { |
| 69 | case XCCDF_RULEcxx . . $ XCCDF_RULE.: { |
| 70 | /* Rule */ |
| 71 | const char *rule_id = xccdf_rule_get_idcxx . . $ xccdf_rule_get_id(f04cd2d7bd5fa08a).((const struct xccdf_rulecxx . . $ xccdf_rule# *) item); |
| 72 | rule_result = xccdf_result_get_rule_result_by_idcxx . . $ xccdf_result_get_rule_result_by_id(1ed384c5e52f0df).(test_result, rule_id); |
| 73 | if (rule_result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 74 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Rule result ID(%s) not fount", rule_id); |
| 75 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 76 | } |
| 77 | if (xccdf_rule_result_get_rolecxx . . $ xccdf_rule_result_get_role(2b60499d60781f21).(rule_result) == XCCDF_ROLE_UNSCOREDcxx . . $ XCCDF_ROLE_UNSCORED.) { |
| 78 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 79 | } |
| 80 | |
| 81 | /* Ignore these rules */ |
| 82 | if ((xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_SELECTEDcxx . . $ XCCDF_RESULT_NOT_SELECTED.) || |
| 83 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_APPLICABLEcxx . . $ XCCDF_RESULT_NOT_APPLICABLE.) || |
| 84 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_INFORMATIONALcxx . . $ XCCDF_RESULT_INFORMATIONAL.) || |
| 85 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_CHECKEDcxx . . $ XCCDF_RESULT_NOT_CHECKED.)) |
| 86 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 87 | |
| 88 | score = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct xccdf_default_scorecxx . . $ xccdf_default_score#)); |
| 89 | |
| 90 | /* Count with this rule */ |
| 91 | score->countcxx . . $ xccdf_default_score#count. = 1; |
| 92 | |
| 93 | /* If the test result is 'pass', assign the node a score of 100, otherwise assign a score of 0 */ |
| 94 | if ((xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_PASScxx . . $ XCCDF_RESULT_PASS.) || |
| 95 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_FIXEDcxx . . $ XCCDF_RESULT_FIXED.)) |
| 96 | score->scorecxx . . $ xccdf_default_score#score. = 100.0; |
| 97 | else |
| 98 | score->scorecxx . . $ xccdf_default_score#score. = 0.0; |
| 99 | |
| 100 | /* Default weight */ |
| 101 | score->weight_scorecxx . . $ xccdf_default_score#weight_score. = score->scorecxx . . $ xccdf_default_score#score. * xccdf_item_get_weightcxx . . $ xccdf_item_get_weight(b4608ad4327a77d1).(item); |
| 102 | } break; |
| 103 | |
| 104 | case XCCDF_BENCHMARKcxx . . $ XCCDF_BENCHMARK.: |
| 105 | case XCCDF_GROUPcxx . . $ XCCDF_GROUP.: { |
| 106 | /* Init */ |
| 107 | score = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct xccdf_default_scorecxx . . $ xccdf_default_score#)); |
| 108 | score->countcxx . . $ xccdf_default_score#count. = 0; |
| 109 | score->scorecxx . . $ xccdf_default_score#score. = 0.0; |
| 110 | score->accumulatorcxx . . $ xccdf_default_score#accumulator. = 0.0; |
| 111 | |
| 112 | /* Recurse */ |
| 113 | struct xccdf_item_iteratorcxx . . $ xccdf_item_iterator# * child_it; |
| 114 | if (itype == XCCDF_GROUPcxx . . $ XCCDF_GROUP.) |
| 115 | child_it = xccdf_group_get_contentcxx . . $ xccdf_group_get_content(cff1b1d0a9b9d63).((const struct xccdf_groupcxx . . $ xccdf_group# *)item); |
| 116 | else |
| 117 | child_it = xccdf_benchmark_get_contentcxx . . $ xccdf_benchmark_get_content(630a032521212bb1).((const struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *)item); |
| 118 | |
| 119 | while (xccdf_item_iterator_has_morecxx . . $ xccdf_item_iterator_has_more(c8a83ac60f16d388).(child_it)) { |
| 120 | child = xccdf_item_iterator_nextcxx . . $ xccdf_item_iterator_next(73e3c3f4fb48321d).(child_it); |
| 121 | ch_score = xccdf_item_get_default_scorecxx . . $ xccdf_item_get_default_score(a58a6a0122d4a28).(child, test_result); |
| 122 | |
| 123 | if (ch_score == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) /* we got item that can't be processed */ |
| 124 | continue; |
| 125 | |
| 126 | if (ch_score->countcxx . . $ xccdf_default_score#count. == 0) { /* we got item that has no selected items */ |
| 127 | freecxx . . $ free(5d22bdacc48458e8).(ch_score); |
| 128 | continue; |
| 129 | } |
| 130 | |
| 131 | /* If child's count value is not 0, then add the child's wighted score to this node's score */ |
| 132 | score->scorecxx . . $ xccdf_default_score#score. += ch_score->weight_scorecxx . . $ xccdf_default_score#weight_score.; |
| 133 | score->countcxx . . $ xccdf_default_score#count.++; |
| 134 | score->accumulatorcxx . . $ xccdf_default_score#accumulator. += xccdf_item_get_weightcxx . . $ xccdf_item_get_weight(b4608ad4327a77d1).(child); |
| 135 | |
| 136 | freecxx . . $ free(5d22bdacc48458e8).(ch_score); |
| 137 | } |
| 138 | |
| 139 | /* Normalize */ |
| 140 | if (score->countcxx . . $ xccdf_default_score#count. && score->accumulatorcxx . . $ xccdf_default_score#accumulator.) |
| 141 | score->scorecxx . . $ xccdf_default_score#score. = score->scorecxx . . $ xccdf_default_score#score. / score->accumulatorcxx . . $ xccdf_default_score#accumulator.; |
| 142 | /* Default weight */ |
| 143 | score->weight_scorecxx . . $ xccdf_default_score#weight_score. = score->scorecxx . . $ xccdf_default_score#score. * xccdf_item_get_weightcxx . . $ xccdf_item_get_weight(b4608ad4327a77d1).(item); |
| 144 | |
| 145 | xccdf_item_iterator_freecxx . . $ xccdf_item_iterator_free(5a27e088a1e93c63).(child_it); |
| 146 | } break; |
| 147 | |
| 148 | default: { |
| 149 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Unsupported item type: %d", itype); |
| 150 | score=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 151 | } break; |
| 152 | |
| 153 | } /* switch */ |
| 154 | return score; |
| 155 | } |
| 156 | |
| 157 | static struct xccdf_flat_scorecxx . . $ xccdf_flat_score# * xccdf_item_get_flat_scorecxx . . $ xccdf_item_get_flat_score(96c657fa1a3c5dd6).(struct xccdf_itemcxx . . $ xccdf_item# * item, struct xccdf_resultcxx . . $ xccdf_result# * test_result, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! unweighted) |
| 158 | { |
| 159 | // Implements algorithm as described in NISTIR-7275-r4 |
| 160 | // Table 41: Flat Model Algorithm Sub-Steps |
| 161 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# *score; |
| 162 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# *ch_score; |
| 163 | struct xccdf_rule_resultcxx . . $ xccdf_rule_result# *rule_result; |
| 164 | struct xccdf_itemcxx . . $ xccdf_item# *child; |
| 165 | |
| 166 | xccdf_type_tcxx . . $ xccdf_type_t# itype = xccdf_item_get_typecxx . . $ xccdf_item_get_type(3d8d48c673cd637b).(item); |
| 167 | |
| 168 | switch (itype) { |
| 169 | case XCCDF_RULEcxx . . $ XCCDF_RULE.:{ |
| 170 | /* Rule */ |
| 171 | const char *rule_id = xccdf_rule_get_idcxx . . $ xccdf_rule_get_id(f04cd2d7bd5fa08a).((const struct xccdf_rulecxx . . $ xccdf_rule# *) item); |
| 172 | rule_result = xccdf_result_get_rule_result_by_idcxx . . $ xccdf_result_get_rule_result_by_id(1ed384c5e52f0df).(test_result, rule_id); |
| 173 | if (rule_result == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 174 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Rule result ID(%s) not fount", rule_id); |
| 175 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 176 | } |
| 177 | if (xccdf_rule_result_get_rolecxx . . $ xccdf_rule_result_get_role(2b60499d60781f21).(rule_result) == XCCDF_ROLE_UNSCOREDcxx . . $ XCCDF_ROLE_UNSCORED.) { |
| 178 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 179 | } |
| 180 | |
| 181 | /* Ignore these rules */ |
| 182 | if ((xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_SELECTEDcxx . . $ XCCDF_RESULT_NOT_SELECTED.) || |
| 183 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_APPLICABLEcxx . . $ XCCDF_RESULT_NOT_APPLICABLE.) || |
| 184 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_INFORMATIONALcxx . . $ XCCDF_RESULT_INFORMATIONAL.) || |
| 185 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_NOT_CHECKEDcxx . . $ XCCDF_RESULT_NOT_CHECKED.)) |
| 186 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 187 | |
| 188 | score = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct xccdf_flat_scorecxx . . $ xccdf_flat_score#)); |
| 189 | |
| 190 | /* max possible score = sum of weights*/ |
| 191 | if (unweighted) |
| 192 | score->weightcxx . . $ xccdf_flat_score#weight. = 1.0; |
| 193 | else score->weightcxx . . $ xccdf_flat_score#weight. = |
| 194 | xccdf_item_get_weightcxx . . $ xccdf_item_get_weight(b4608ad4327a77d1).(item); |
| 195 | |
| 196 | /* score = sum of weights of rules that pass */ |
| 197 | if ((xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_PASScxx . . $ XCCDF_RESULT_PASS.) || |
| 198 | (xccdf_rule_result_get_resultcxx . . $ xccdf_rule_result_get_result(3f94a129bdb3771c).(rule_result) == XCCDF_RESULT_FIXEDcxx . . $ XCCDF_RESULT_FIXED.)) { |
| 199 | if (unweighted) |
| 200 | score->scorecxx . . $ xccdf_flat_score#score. = 1.0; |
| 201 | else |
| 202 | score->scorecxx . . $ xccdf_flat_score#score. = xccdf_item_get_weightcxx . . $ xccdf_item_get_weight(b4608ad4327a77d1).(item); |
| 203 | } else |
| 204 | score->scorecxx . . $ xccdf_flat_score#score. = 0.0; /* fail */ |
| 205 | } break; |
| 206 | case XCCDF_BENCHMARKcxx . . $ XCCDF_BENCHMARK.: |
| 207 | case XCCDF_GROUPcxx . . $ XCCDF_GROUP.:{ |
| 208 | /* Init */ |
| 209 | score = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct xccdf_flat_scorecxx . . $ xccdf_flat_score#)); |
| 210 | score->scorecxx . . $ xccdf_flat_score#score. = 0; |
| 211 | score->weightcxx . . $ xccdf_flat_score#weight. = 0.0; |
| 212 | |
| 213 | /* Recurse */ |
| 214 | struct xccdf_item_iteratorcxx . . $ xccdf_item_iterator# * child_it; |
| 215 | if (itype == XCCDF_GROUPcxx . . $ XCCDF_GROUP.) |
| 216 | child_it = xccdf_group_get_contentcxx . . $ xccdf_group_get_content(cff1b1d0a9b9d63).((const struct xccdf_groupcxx . . $ xccdf_group# *)item); |
| 217 | else |
| 218 | child_it = xccdf_benchmark_get_contentcxx . . $ xccdf_benchmark_get_content(630a032521212bb1).((const struct xccdf_benchmarkcxx . . $ xccdf_benchmark# *)item); |
| 219 | |
| 220 | while (xccdf_item_iterator_has_morecxx . . $ xccdf_item_iterator_has_more(c8a83ac60f16d388).(child_it)) { |
| 221 | child = xccdf_item_iterator_nextcxx . . $ xccdf_item_iterator_next(73e3c3f4fb48321d).(child_it); |
| 222 | ch_score = xccdf_item_get_flat_scorecxx . . $ xccdf_item_get_flat_score(96c657fa1a3c5dd6).(child, test_result, unweighted); |
| 223 | |
| 224 | if (ch_score == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) /* we got item that can't be processed */ |
| 225 | continue; |
| 226 | |
| 227 | if (ch_score->weightcxx . . $ xccdf_flat_score#weight. == 0) { /* we got item that has no selected items */ |
| 228 | freecxx . . $ free(5d22bdacc48458e8).(ch_score); |
| 229 | continue; |
| 230 | } |
| 231 | |
| 232 | /* If child's count value is not 0, then add the child's wighted score to this node's score */ |
| 233 | score->scorecxx . . $ xccdf_flat_score#score. += ch_score->scorecxx . . $ xccdf_flat_score#score.; |
| 234 | score->weightcxx . . $ xccdf_flat_score#weight. += ch_score->weightcxx . . $ xccdf_flat_score#weight.; |
| 235 | |
| 236 | freecxx . . $ free(5d22bdacc48458e8).(ch_score); |
| 237 | } |
| 238 | |
| 239 | xccdf_item_iterator_freecxx . . $ xccdf_item_iterator_free(5a27e088a1e93c63).(child_it); |
| 240 | } break; |
| 241 | |
| 242 | default: { |
| 243 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Unsupported item type: %d", itype); |
| 244 | score=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 245 | } break; |
| 246 | |
| 247 | } /* switch */ |
| 248 | return score; |
| 249 | } |
| 250 | |
| 251 | struct xccdf_scorecxx . . $ xccdf_score# *xccdf_result_calculate_scorecxx . . $ xccdf_result_calculate_score(8cf0e8d85d748892).(struct xccdf_resultcxx . . $ xccdf_result# *test_result, struct xccdf_itemcxx . . $ xccdf_item# *benchmark, const char *score_system) |
| 252 | { |
| 253 | struct xccdf_scorecxx . . $ xccdf_score# *score = xccdf_score_newcxx . . $ xccdf_score_new(cc37c8c82be3ddf2).(); |
| 254 | xccdf_score_set_systemcxx . . $ xccdf_score_set_system(57f6ef233f5050b1).(score, score_system); |
| 255 | if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).(score_system, "urn:xccdf:scoring:default")) { |
| 256 | struct xccdf_default_scorecxx . . $ xccdf_default_score# * item_score = xccdf_item_get_default_scorecxx . . $ xccdf_item_get_default_score(a58a6a0122d4a28).(benchmark, test_result); |
| 257 | xccdf_score_set_scorecxx . . $ xccdf_score_set_score(410e71638bf93e99).(score, item_score->scorecxx . . $ xccdf_default_score#score.); |
| 258 | freecxx . . $ free(5d22bdacc48458e8).(item_score); |
| 259 | } else if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).(score_system, "urn:xccdf:scoring:flat")) { |
| 260 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# * item_score = xccdf_item_get_flat_scorecxx . . $ xccdf_item_get_flat_score(96c657fa1a3c5dd6).(benchmark, test_result, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 261 | xccdf_score_set_maximumcxx . . $ xccdf_score_set_maximum(410e71638bf93e99).(score, item_score->weightcxx . . $ xccdf_flat_score#weight.); |
| 262 | xccdf_score_set_scorecxx . . $ xccdf_score_set_score(410e71638bf93e99).(score, item_score->scorecxx . . $ xccdf_flat_score#score.); |
| 263 | freecxx . . $ free(5d22bdacc48458e8).(item_score); |
| 264 | } else if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).(score_system, "urn:xccdf:scoring:flat-unweighted")) { |
| 265 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# * item_score = xccdf_item_get_flat_scorecxx . . $ xccdf_item_get_flat_score(96c657fa1a3c5dd6).(benchmark, test_result, truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!); |
| 266 | xccdf_score_set_maximumcxx . . $ xccdf_score_set_maximum(410e71638bf93e99).(score, item_score->weightcxx . . $ xccdf_flat_score#weight.); |
| 267 | xccdf_score_set_scorecxx . . $ xccdf_score_set_score(410e71638bf93e99).(score, item_score->scorecxx . . $ xccdf_flat_score#score.); |
| 268 | freecxx . . $ free(5d22bdacc48458e8).(item_score); |
| 269 | } else if (oscap_streqcxx . . $ oscap_streq(b7a7aa4a824b7595).(score_system, "urn:xccdf:scoring:absolute")) { |
| 270 | int absolute; |
| 271 | struct xccdf_flat_scorecxx . . $ xccdf_flat_score# * item_score = xccdf_item_get_flat_scorecxx . . $ xccdf_item_get_flat_score(96c657fa1a3c5dd6).(benchmark, test_result, falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); |
| 272 | xccdf_score_set_maximumcxx . . $ xccdf_score_set_maximum(410e71638bf93e99).(score, item_score->weightcxx . . $ xccdf_flat_score#weight.); |
| 273 | absolute = (item_score->scorecxx . . $ xccdf_flat_score#score. == item_score->weightcxx . . $ xccdf_flat_score#weight.); |
| 274 | xccdf_score_set_scorecxx . . $ xccdf_score_set_score(410e71638bf93e99).(score, absolute); |
| 275 | freecxx . . $ free(5d22bdacc48458e8).(item_score); |
| 276 | } else { |
| 277 | xccdf_score_freecxx . . $ xccdf_score_free(3879543088f5564c).(score); |
| 278 | dEcxx . . $ `src/common/debug_priv.h:63:9`!("Scoring system \"%s\" is not supported.", score_system); |
| 279 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 280 | } |
| 281 | return score; |
| 282 | } |
| 283 | |
| 284 | int xccdf_result_recalculate_scorescxx . . $ xccdf_result_recalculate_scores(496dadfa59822415).(struct xccdf_resultcxx . . $ xccdf_result# *result, struct xccdf_itemcxx . . $ xccdf_item# *benchmark) |
| 285 | { |
| 286 | struct oscap_listcxx . . $ oscap_list# *new_scores = oscap_list_newcxx . . $ oscap_list_new(ea215f73c8361bff).(); |
| 287 | struct xccdf_score_iteratorcxx . . $ xccdf_score_iterator# *score_it = xccdf_result_get_scorescxx . . $ xccdf_result_get_scores(a3b292ed40c82681).(result); |
| 288 | while (xccdf_score_iterator_has_morecxx . . $ xccdf_score_iterator_has_more(4e460e487b6b1826).(score_it)) { |
| 289 | struct xccdf_scorecxx . . $ xccdf_score# *old = xccdf_score_iterator_nextcxx . . $ xccdf_score_iterator_next(fc7ac81b6182e27f).(score_it); |
| 290 | struct xccdf_scorecxx . . $ xccdf_score# *new = xccdf_result_calculate_scorecxx . . $ xccdf_result_calculate_score(8cf0e8d85d748892).(result, benchmark, |
| 291 | xccdf_score_get_systemcxx . . $ xccdf_score_get_system(f75571dd70fd8ead).(old)); |
| 292 | if (new == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 293 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(new_scores, (oscap_destruct_funccxx . . $ oscap_destruct_func#) xccdf_score_freecxx . . $ xccdf_score_free(3879543088f5564c).); |
| 294 | xccdf_score_iterator_freecxx . . $ xccdf_score_iterator_free(cb6faecc50174f86).(score_it); |
| 295 | return 1; |
| 296 | } |
| 297 | oscap_list_addcxx . . $ oscap_list_add(97f28760a5cf7823).(new_scores, new); |
| 298 | } |
| 299 | xccdf_score_iterator_freecxx . . $ xccdf_score_iterator_free(cb6faecc50174f86).(score_it); |
| 300 | oscap_list_freecxx . . $ oscap_list_free(e68e105c3900fcc1).(((struct xccdf_itemcxx . . $ xccdf_item# *)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).); |
| 301 | ((struct xccdf_itemcxx . . $ xccdf_item# *)result)->subcxx . . $ xccdf_item#sub..resultcxx . . $ xccdf_item#$anonymous_type_1#result..scorescxx . . $ xccdf_result_item#scores. = new_scores; |
| 302 | return 0; |
| 303 | } |