components/openscap/patches/result_scoring.c.patch
author pkidd <patrick.kidd@oracle.com>
Wed, 11 Jan 2017 11:03:56 -0800
branchs11u3-sru
changeset 7559 6e01bd7c2e39
parent 6246 251b7e39d489
permissions -rw-r--r--
Added tag 0.175.3.17.0.1.0, S11.3SRU17.1 for changeset ee5baab08bfd

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;
 		}