components/openscap/patches/result_scoring.c.patch
author pkidd <patrick.kidd@oracle.com>
Thu, 01 Dec 2016 09:15:00 -0800
branchs11u3-sru
changeset 7423 a17eef087a5e
parent 6246 251b7e39d489
permissions -rw-r--r--
Added tag 0.175.3.15.0.4.0, S11.3SRU15.4 for changeset f2e0a2f2bfc0

This patch is from the community and resolves the issue when XCCDF rule
role=unscored is set, the rule is not counted against the score of the
benchmark. This patch will no longer be needed once we pull in the
latest version of openscap from the cummunity.  

--- openscap-1.2.6/src/XCCDF/result_scoring.c.~1~	2015-10-02 08:22:02.497343616 -0700
+++ openscap-1.2.6/src/XCCDF/result_scoring.c	2016-01-07 08:57:38.143524150 -0800
@@ -71,7 +71,10 @@
 		const char *rule_id = xccdf_rule_get_id((const struct xccdf_rule *) item);
 		rule_result = xccdf_result_get_rule_result_by_id(test_result, rule_id);
 		if (rule_result == NULL) {
-			dE("Rule result ID(%s) not fount", rule_id);
+			dE("Rule result ID(%s) not found", rule_id);
+			return NULL;
+		}
+		if (xccdf_rule_result_get_role(rule_result) == XCCDF_ROLE_UNSCORED) {
 			return NULL;
 		}
 
@@ -168,7 +171,10 @@
 		const char *rule_id = xccdf_rule_get_id((const struct xccdf_rule *) item);
 		rule_result = xccdf_result_get_rule_result_by_id(test_result, rule_id);
 		if (rule_result == NULL) {
-			dE("Rule result ID(%s) not fount", rule_id);
+			dE("Rule result ID(%s) not found", rule_id);
+			return NULL;
+		}
+		if (xccdf_rule_result_get_role(rule_result) == XCCDF_ROLE_UNSCORED) {
 			return NULL;
 		}