components/openscap/patches/result_scoring.c.patch
changeset 5985 6b195cad32d4
equal deleted inserted replaced
5984:a0d520e4038e 5985:6b195cad32d4
       
     1 This patch is from the community and resolves the issue when XCCDF rule
       
     2 role=unscored is set, the rule is not counted against the score of the
       
     3 benchmark. This patch will no longer be needed once we pull in the
       
     4 latest version of openscap from the cummunity.  
       
     5 
       
     6 --- openscap-1.2.6/src/XCCDF/result_scoring.c.~1~	2015-10-02 08:22:02.497343616 -0700
       
     7 +++ openscap-1.2.6/src/XCCDF/result_scoring.c	2016-01-07 08:57:38.143524150 -0800
       
     8 @@ -71,7 +71,10 @@
       
     9  		const char *rule_id = xccdf_rule_get_id((const struct xccdf_rule *) item);
       
    10  		rule_result = xccdf_result_get_rule_result_by_id(test_result, rule_id);
       
    11  		if (rule_result == NULL) {
       
    12 -			dE("Rule result ID(%s) not fount", rule_id);
       
    13 +			dE("Rule result ID(%s) not found", rule_id);
       
    14 +			return NULL;
       
    15 +		}
       
    16 +		if (xccdf_rule_result_get_role(rule_result) == XCCDF_ROLE_UNSCORED) {
       
    17  			return NULL;
       
    18  		}
       
    19  
       
    20 @@ -168,7 +171,10 @@
       
    21  		const char *rule_id = xccdf_rule_get_id((const struct xccdf_rule *) item);
       
    22  		rule_result = xccdf_result_get_rule_result_by_id(test_result, rule_id);
       
    23  		if (rule_result == NULL) {
       
    24 -			dE("Rule result ID(%s) not fount", rule_id);
       
    25 +			dE("Rule result ID(%s) not found", rule_id);
       
    26 +			return NULL;
       
    27 +		}
       
    28 +		if (xccdf_rule_result_get_role(rule_result) == XCCDF_ROLE_UNSCORED) {
       
    29  			return NULL;
       
    30  		}
       
    31