Blame SOURCES/openscap-1.3.2-show_check_identifiers_at_multi-check_rules-PR_1426.patch

8b65ee
From f90f02bfa2d31f56b25238d750c4746d964aea42 Mon Sep 17 00:00:00 2001
8b65ee
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
8b65ee
Date: Tue, 26 Nov 2019 13:52:36 +0100
8b65ee
Subject: [PATCH 1/2] Show check identifiers at multi-check rules
8b65ee
8b65ee
Shows OVAL Definition ID and Title when an XCCDF rule uses
8b65ee
multi-check='true'. The multi-check is used in rule
8b65ee
security_patches_up_to_date in SCAP 1.3 datastreams. It wasn't possible
8b65ee
to see which vulnerabilities have been found because all the checks have
8b65ee
the same XCCDF rule ID.
8b65ee
8b65ee
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1771438
8b65ee
8b65ee
Fixes: #1320
8b65ee
---
8b65ee
 src/OVAL/oval_agent.c                         | 35 ++++++++++----
8b65ee
 src/XCCDF_POLICY/public/xccdf_policy.h        | 18 ++++++-
8b65ee
 src/XCCDF_POLICY/xccdf_policy.c               | 48 +++++++++++--------
8b65ee
 src/XCCDF_POLICY/xccdf_policy_engine.c        |  4 +-
8b65ee
 src/XCCDF_POLICY/xccdf_policy_engine_priv.h   |  2 +-
8b65ee
 src/XCCDF_POLICY/xccdf_policy_model_priv.h    |  1 +
8b65ee
 ...eck_content_ref_without_name_attr.oval.xml |  4 +-
8b65ee
 .../test_xccdf_check_multi_check2.sh          |  6 +++
8b65ee
 .../test_xccdf_check_multi_check2.xccdf.xml   |  1 +
8b65ee
 utils/oscap-xccdf.c                           |  8 ++++
8b65ee
 10 files changed, 92 insertions(+), 35 deletions(-)
8b65ee
8b65ee
diff --git a/src/OVAL/oval_agent.c b/src/OVAL/oval_agent.c
8b65ee
index a962fe379..986295bf6 100644
8b65ee
--- a/src/OVAL/oval_agent.c
8b65ee
+++ b/src/OVAL/oval_agent.c
8b65ee
@@ -593,19 +593,34 @@ _oval_agent_list_definitions(void *usr, xccdf_policy_engine_query_t query_type,
8b65ee
 {
8b65ee
 	__attribute__nonnull__(usr);
8b65ee
 	struct oval_agent_session *sess = (struct oval_agent_session *) usr;
8b65ee
-	if (query_type != POLICY_ENGINE_QUERY_NAMES_FOR_HREF || (query_data != NULL && strcmp(sess->filename, (const char *) query_data)))
8b65ee
+	if (query_data != NULL && strcmp(sess->filename, (const char *) query_data)) {
8b65ee
 		return NULL;
8b65ee
-	struct oval_definition_iterator *iterator = oval_definition_model_get_definitions(sess->def_model);
8b65ee
-	struct oscap_stringlist *result = oscap_stringlist_new();
8b65ee
-	struct oval_definition *oval_def;
8b65ee
-
8b65ee
-	while (oval_definition_iterator_has_more(iterator)) {
8b65ee
-		oval_def = oval_definition_iterator_next(iterator);
8b65ee
-		oscap_stringlist_add_string(result, oval_definition_get_id(oval_def));
8b65ee
 	}
8b65ee
+	if (query_type == POLICY_ENGINE_QUERY_NAMES_FOR_HREF) {
8b65ee
+		struct oval_definition_iterator *iterator = oval_definition_model_get_definitions(sess->def_model);
8b65ee
+		struct oscap_stringlist *result = oscap_stringlist_new();
8b65ee
+
8b65ee
+		while (oval_definition_iterator_has_more(iterator)) {
8b65ee
+			struct oval_definition *oval_def = oval_definition_iterator_next(iterator);
8b65ee
+			oscap_stringlist_add_string(result, oval_definition_get_id(oval_def));
8b65ee
+		}
8b65ee
+
8b65ee
+		oval_definition_iterator_free(iterator);
8b65ee
+		return result;
8b65ee
+	} else if (query_type == POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF) {
8b65ee
+		struct oval_definition_iterator *iterator = oval_definition_model_get_definitions(sess->def_model);
8b65ee
+		struct oscap_list *result = oscap_list_new();
8b65ee
 
8b65ee
-	oval_definition_iterator_free(iterator);
8b65ee
-	return result;
8b65ee
+		while (oval_definition_iterator_has_more(iterator)) {
8b65ee
+			struct oval_definition *oval_def = oval_definition_iterator_next(iterator);
8b65ee
+			oscap_list_add(result, oval_def);
8b65ee
+		}
8b65ee
+
8b65ee
+		oval_definition_iterator_free(iterator);
8b65ee
+		return result;
8b65ee
+	} else {
8b65ee
+		return NULL;
8b65ee
+	}
8b65ee
 }
8b65ee
 
8b65ee
 bool xccdf_policy_model_register_engine_oval(struct xccdf_policy_model * model, struct oval_agent_session * usr)
8b65ee
diff --git a/src/SCE/Makefile.am b/src/SCE/Makefile.am
8b65ee
index 0c90c6da0..5849cf1a0 100644
8b65ee
--- a/src/SCE/Makefile.am
8b65ee
+++ b/src/SCE/Makefile.am
8b65ee
@@ -12,7 +12,8 @@ AM_CPPFLAGS =	@xml2_CFLAGS@ \
8b65ee
 		-I$(top_srcdir)/src/source/public \
8b65ee
 		-I$(top_srcdir)/src/XCCDF_POLICY/public \
8b65ee
 		-I$(top_srcdir)/src/XCCDF/public \
8b65ee
-		-I$(top_srcdir)/src/CPE/public
8b65ee
+		-I$(top_srcdir)/src/CPE/public \
8b65ee
+		-I$(top_srcdir)/src/OVAL/public
8b65ee
 
8b65ee
 AM_LDFLAGS = @xml2_LIBS@
8b65ee
 
8b65ee
diff --git a/src/XCCDF_POLICY/public/xccdf_policy.h b/src/XCCDF_POLICY/public/xccdf_policy.h
8b65ee
index aa2525e2b..5e85c476c 100644
8b65ee
--- a/src/XCCDF_POLICY/public/xccdf_policy.h
8b65ee
+++ b/src/XCCDF_POLICY/public/xccdf_policy.h
8b65ee
@@ -35,6 +35,7 @@
8b65ee
 #include <stdbool.h>
8b65ee
 #include <time.h>
8b65ee
 #include <oscap.h>
8b65ee
+#include "oval_definitions.h"
8b65ee
 
8b65ee
 /**
8b65ee
  * @struct xccdf_policy_model
8b65ee
@@ -69,6 +70,7 @@ struct xccdf_policy_iterator;
8b65ee
  */
8b65ee
 typedef enum {
8b65ee
 	POLICY_ENGINE_QUERY_NAMES_FOR_HREF = 1,		/// Considering xccdf:check-content-ref, what are possible @name attributes for given href?
8b65ee
+	POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF = 2,	/// Considering xccdf:check-content-ref, what are OVAL definitions for given href?
8b65ee
 } xccdf_policy_engine_query_t;
8b65ee
 
8b65ee
 /**
8b65ee
@@ -80,9 +82,11 @@ typedef enum {
8b65ee
  * is always user data as registered. Second argument defines the query. Third argument is
8b65ee
  * dependent on query and defined as follows:
8b65ee
  *  - (const char *)href -- for POLICY_ENGINE_QUERY_NAMES_FOR_HREF
8b65ee
+ *  - (const char *)href -- for POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF
8b65ee
  *
8b65ee
  * Expected return type depends also on query as follows:
8b65ee
- *  - (struct oscap_stringlists *) -- for POLICY_ENGINE_QUERY_NAMES_FOR_HREF
8b65ee
+ *  - (struct oscap_stringlist *) -- for POLICY_ENGINE_QUERY_NAMES_FOR_HREF
8b65ee
+ *  - (struct oscap_list *) -- for POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF
8b65ee
  *  - NULL shall be returned if the function doesn't understand the query.
8b65ee
  */
8b65ee
 typedef void *(*xccdf_policy_engine_query_fn) (void *, xccdf_policy_engine_query_t, void *);
8b65ee
@@ -289,6 +293,19 @@ typedef int (*policy_reporter_start)(struct xccdf_rule *, void *);
8b65ee
  */
8b65ee
 bool xccdf_policy_model_register_start_callback(struct xccdf_policy_model * model, policy_reporter_start func, void * usr);
8b65ee
 
8b65ee
+typedef int (*policy_reporter_multicheck)(struct oval_definition*, void *);
8b65ee
+/**
8b65ee
+ * Function to register callback for checking system that will be called
8b65ee
+ * DURING each rule evaluation if rule sets multi-check="true".
8b65ee
+ * @param model XCCDF Policy Model
8b65ee
+ * @param func Callback - pointer to function called by XCCDF Policy system when rule parsed
8b65ee
+ * @param usr optional parameter for passing user data to callback
8b65ee
+ * @memberof xccdf_policy_model
8b65ee
+ * @return true if callback registered successfully, false otherwise
8b65ee
+ */
8b65ee
+bool xccdf_policy_model_register_multicheck_callback(struct xccdf_policy_model *model, policy_reporter_multicheck func, void *usr);
8b65ee
+
8b65ee
+
8b65ee
 /************************************************************/
8b65ee
 /**
8b65ee
  * @name Getters
8b65ee
diff --git a/src/XCCDF_POLICY/xccdf_policy.c b/src/XCCDF_POLICY/xccdf_policy.c
8b65ee
index b406d7f59..079395c85 100644
8b65ee
--- a/src/XCCDF_POLICY/xccdf_policy.c
8b65ee
+++ b/src/XCCDF_POLICY/xccdf_policy.c
8b65ee
@@ -378,20 +378,19 @@ xccdf_policy_evaluate_cb(struct xccdf_policy * policy, const char * sysname, con
8b65ee
 }
8b65ee
 
8b65ee
 /**
8b65ee
- * Find all posible names for given check-content-ref/@href, considering also the check/@system.
8b65ee
- * This is usefull for multi-check="true" feature.
8b65ee
- * @return list of names (even empty) if the given href found, NULL otherwise.
8b65ee
+ * Find all possible names for given check-content-ref/@href, considering also the check/@system.
8b65ee
+ * This is useful for multi-check="true" feature.
8b65ee
+ * @return list of OVAL definitions if the given href found, NULL otherwise.
8b65ee
  */
8b65ee
-static struct oscap_stringlist *
8b65ee
-_xccdf_policy_get_namesfor_href(struct xccdf_policy *policy, const char *sysname, const char *href)
8b65ee
+static struct oscap_list *_xccdf_policy_get_oval_definitions_for_href(struct xccdf_policy *policy, const char *sysname, const char *href)
8b65ee
 {
8b65ee
 	struct oscap_iterator *cb_it = _xccdf_policy_get_engines_by_sysname(policy, sysname);
8b65ee
-	struct oscap_stringlist *result = NULL;
8b65ee
+	struct oscap_list *result = NULL;
8b65ee
 	while (oscap_iterator_has_more(cb_it) && result == NULL) {
8b65ee
 		struct xccdf_policy_engine *engine = (struct xccdf_policy_engine *) oscap_iterator_next(cb_it);
8b65ee
 		if (engine == NULL)
8b65ee
 			break;
8b65ee
-		result = xccdf_policy_engine_query(engine, POLICY_ENGINE_QUERY_NAMES_FOR_HREF, (void *) href);
8b65ee
+		result = xccdf_policy_engine_query(engine, POLICY_ENGINE_QUERY_OVAL_DEFS_FOR_HREF, (void *) href);
8b65ee
 	}
8b65ee
 	oscap_iterator_free(cb_it);
8b65ee
 	return result;
8b65ee
@@ -1047,24 +1046,27 @@ _xccdf_policy_rule_evaluate(struct xccdf_policy * policy, const struct xccdf_rul
8b65ee
 
8b65ee
 		if (content_name == NULL && xccdf_check_get_multicheck(check)) {
8b65ee
 			// parent element is Rule, @multi-check is required
8b65ee
-			struct oscap_stringlist *names = _xccdf_policy_get_namesfor_href(policy, system_name, href);
8b65ee
-			if (names != NULL) {
8b65ee
+			struct oscap_list *oval_definition_list = _xccdf_policy_get_oval_definitions_for_href(policy, system_name, href);
8b65ee
+			if (oval_definition_list != NULL) {
8b65ee
 				// multi-check is supported by checking-engine
8b65ee
-				struct oscap_string_iterator *name_it = oscap_stringlist_get_strings(names);
8b65ee
-				if (!oscap_string_iterator_has_more(name_it)) {
8b65ee
+				struct oscap_iterator *oval_definition_iterator = oscap_iterator_new(oval_definition_list);
8b65ee
+				if (!oscap_iterator_has_more(oval_definition_iterator)) {
8b65ee
 					// Super special case when oval file contains no definitions
8b65ee
 					// thus multi-check shall yield zero rule-results.
8b65ee
 					report = _xccdf_policy_report_rule_result(policy, result, rule, check, XCCDF_RESULT_UNKNOWN, "No definitions found for @multi-check.");
8b65ee
-					oscap_string_iterator_free(name_it);
8b65ee
-					oscap_stringlist_free(names);
8b65ee
+					oscap_iterator_free(oval_definition_iterator);
8b65ee
+					oscap_list_free(oval_definition_list, NULL);
8b65ee
 					xccdf_check_content_ref_iterator_free(content_it);
8b65ee
 					oscap_list_free(bindings, (oscap_destruct_func) xccdf_value_binding_free);
8b65ee
 					return report;
8b65ee
 				}
8b65ee
-				while (oscap_string_iterator_has_more(name_it)) {
8b65ee
-					const char *name = oscap_string_iterator_next(name_it);
8b65ee
+				while (oscap_iterator_has_more(oval_definition_iterator)) {
8b65ee
+					struct oval_definition *oval_definition = oscap_iterator_next(oval_definition_iterator);
8b65ee
+					if ((report = xccdf_policy_report_cb(policy, XCCDF_POLICY_OUTCB_MULTICHECK, (void *) oval_definition)) != 0) {
8b65ee
+						break;
8b65ee
+					}
8b65ee
 					struct xccdf_check *cloned_check = xccdf_check_clone(check);
8b65ee
-					xccdf_check_inject_content_ref(cloned_check, content, name);
8b65ee
+					xccdf_check_inject_content_ref(cloned_check, content, oval_definition_get_id(oval_definition));
8b65ee
 					int inner_ret = xccdf_policy_check_evaluate(policy, cloned_check);
8b65ee
 					if (inner_ret == -1) {
8b65ee
 						xccdf_check_free(cloned_check);
8b65ee
@@ -1073,12 +1075,13 @@ _xccdf_policy_rule_evaluate(struct xccdf_policy * policy, const struct xccdf_rul
8b65ee
 					}
8b65ee
 					if ((report = _xccdf_policy_report_rule_result(policy, result, rule, cloned_check, inner_ret, NULL)) != 0)
8b65ee
 						break;
8b65ee
-					if (oscap_string_iterator_has_more(name_it))
8b65ee
+					if (oscap_iterator_has_more(oval_definition_iterator)) {
8b65ee
 						if ((report = xccdf_policy_report_cb(policy, XCCDF_POLICY_OUTCB_START, (void *) rule)) != 0)
8b65ee
 							break;
8b65ee
+					}
8b65ee
 				}
8b65ee
-				oscap_string_iterator_free(name_it);
8b65ee
-				oscap_stringlist_free(names);
8b65ee
+				oscap_iterator_free(oval_definition_iterator);
8b65ee
+				oscap_list_free(oval_definition_list, NULL);
8b65ee
 				xccdf_check_content_ref_iterator_free(content_it);
8b65ee
 				oscap_list_free(bindings, (oscap_destruct_func) xccdf_value_binding_free);
8b65ee
 				xccdf_check_free(check);
8b65ee
@@ -1629,6 +1632,13 @@ bool xccdf_policy_model_register_output_callback(struct xccdf_policy_model * mod
8b65ee
         return oscap_list_add(model->callbacks, reporter);
8b65ee
 }
8b65ee
 
8b65ee
+bool xccdf_policy_model_register_multicheck_callback(struct xccdf_policy_model *model, policy_reporter_multicheck func, void *usr)
8b65ee
+{
8b65ee
+	__attribute__nonnull__(model);
8b65ee
+	struct reporter *reporter = reporter_new(XCCDF_POLICY_OUTCB_MULTICHECK, func, usr);
8b65ee
+	return oscap_list_add(model->callbacks, reporter);
8b65ee
+}
8b65ee
+
8b65ee
 struct xccdf_result * xccdf_policy_get_result_by_id(struct xccdf_policy * policy, const char * id) {
8b65ee
 
8b65ee
     struct xccdf_result_iterator    * result_it;
8b65ee
diff --git a/src/XCCDF_POLICY/xccdf_policy_engine.c b/src/XCCDF_POLICY/xccdf_policy_engine.c
8b65ee
index 5e0a2b6b0..3529dd1b6 100644
8b65ee
--- a/src/XCCDF_POLICY/xccdf_policy_engine.c
8b65ee
+++ b/src/XCCDF_POLICY/xccdf_policy_engine.c
8b65ee
@@ -69,9 +69,9 @@ xccdf_test_result_type_t xccdf_policy_engine_eval(struct xccdf_policy_engine *en
8b65ee
 	return ret;
8b65ee
 }
8b65ee
 
8b65ee
-struct oscap_stringlist *xccdf_policy_engine_query(struct xccdf_policy_engine *engine, xccdf_policy_engine_query_t query_type, void *query_data)
8b65ee
+struct oscap_list *xccdf_policy_engine_query(struct xccdf_policy_engine *engine, xccdf_policy_engine_query_t query_type, void *query_data)
8b65ee
 {
8b65ee
 	if (engine->query_fn == NULL)
8b65ee
 		return NULL;
8b65ee
-	return (struct oscap_stringlist *) engine->query_fn(engine->usr, query_type, query_data);
8b65ee
+	return (struct oscap_list *) engine->query_fn(engine->usr, query_type, query_data);
8b65ee
 }
8b65ee
diff --git a/src/XCCDF_POLICY/xccdf_policy_engine_priv.h b/src/XCCDF_POLICY/xccdf_policy_engine_priv.h
8b65ee
index cdcb49613..bcf758b2e 100644
8b65ee
--- a/src/XCCDF_POLICY/xccdf_policy_engine_priv.h
8b65ee
+++ b/src/XCCDF_POLICY/xccdf_policy_engine_priv.h
8b65ee
@@ -75,7 +75,7 @@ xccdf_test_result_type_t xccdf_policy_engine_eval(struct xccdf_policy_engine *en
8b65ee
  * @param query_data Additional data for the checking engine query.
8b65ee
  * @returns list of query results
8b65ee
  */
8b65ee
-struct oscap_stringlist *xccdf_policy_engine_query(struct xccdf_policy_engine *engine, xccdf_policy_engine_query_t query_type, void *query_data);
8b65ee
+struct oscap_list *xccdf_policy_engine_query(struct xccdf_policy_engine *engine, xccdf_policy_engine_query_t query_type, void *query_data);
8b65ee
 
8b65ee
 OSCAP_HIDDEN_END;
8b65ee
 
8b65ee
diff --git a/src/XCCDF_POLICY/xccdf_policy_model_priv.h b/src/XCCDF_POLICY/xccdf_policy_model_priv.h
8b65ee
index c5223a7b8..8f503ef46 100644
8b65ee
--- a/src/XCCDF_POLICY/xccdf_policy_model_priv.h
8b65ee
+++ b/src/XCCDF_POLICY/xccdf_policy_model_priv.h
8b65ee
@@ -33,6 +33,7 @@ OSCAP_HIDDEN_START;
8b65ee
 
8b65ee
 #define XCCDF_POLICY_OUTCB_START "urn:xccdf:system:callback:start"
8b65ee
 #define XCCDF_POLICY_OUTCB_END "urn:xccdf:system:callback:output"
8b65ee
+#define XCCDF_POLICY_OUTCB_MULTICHECK "urn:xccdf:system:callback:multicheck"
8b65ee
 
8b65ee
 /**
8b65ee
  * Remove checking engines with given system from xccdf_policy_model
8b65ee
diff --git a/tests/API/XCCDF/unittests/test_xccdf_check_content_ref_without_name_attr.oval.xml b/tests/API/XCCDF/unittests/test_xccdf_check_content_ref_without_name_attr.oval.xml
8b65ee
index 6d4868686..6efdb2f1c 100644
8b65ee
--- a/tests/API/XCCDF/unittests/test_xccdf_check_content_ref_without_name_attr.oval.xml
8b65ee
+++ b/tests/API/XCCDF/unittests/test_xccdf_check_content_ref_without_name_attr.oval.xml
8b65ee
@@ -17,11 +17,11 @@
8b65ee
 	</generator>
8b65ee
 	<definitions>
8b65ee
 		<definition class="compliance" id="oval:moc.elpmaxe.www:def:1" version="1">
8b65ee
-			<metadata><title>PASS</title><description>Bla.</description></metadata>
8b65ee
+			<metadata><title>DEFINITION_1_TITLE_EXPECTED_PASS</title><description>Bla.</description></metadata>
8b65ee
 			<criteria><criterion test_ref="oval:moc.elpmaxe.www:tst:1" comment="Is executable"/></criteria>
8b65ee
 		</definition>
8b65ee
 		<definition class="compliance" id="oval:moc.elpmaxe.www:def:2" version="1">
8b65ee
-			<metadata><title>FAIL</title><description>Bla.</description></metadata>
8b65ee
+			<metadata><title>DEFINITION_2_TITLE_EXPECTED_FAIL</title><description>Bla.</description></metadata>
8b65ee
 			<criteria><criterion test_ref="oval:moc.elpmaxe.www:tst:2" comment="Is not executable"/></criteria>
8b65ee
 		</definition>
8b65ee
 	</definitions>
8b65ee
diff --git a/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.sh b/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.sh
8b65ee
index d5991aa0f..2c45ad0a3 100755
8b65ee
--- a/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.sh
8b65ee
+++ b/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.sh
8b65ee
@@ -17,6 +17,12 @@ echo "Result file = $result"
8b65ee
 [ -f $stderr ]; [ ! -s $stderr ]; rm $stderr
8b65ee
 grep '^Result.*pass$' $stdout
8b65ee
 grep '^Result.*fail$' $stdout
8b65ee
+[ $(grep -c '^Rule.*xccdf_moc.elpmaxe.www_rule_1' $stdout) == 2 ]
8b65ee
+[ $(grep -c '^Title.*The only rule in this benchmark' $stdout) == 2 ]
8b65ee
+grep '^OVAL Definition ID.*oval:moc.elpmaxe.www:def:1$' $stdout
8b65ee
+grep '^OVAL Definition Title.*DEFINITION_1_TITLE_EXPECTED_PASS$' $stdout
8b65ee
+grep '^OVAL Definition ID.*oval:moc.elpmaxe.www:def:2$' $stdout
8b65ee
+grep '^OVAL Definition Title.*DEFINITION_2_TITLE_EXPECTED_FAIL$' $stdout
8b65ee
 rm $stdout
8b65ee
 
8b65ee
 $OSCAP xccdf validate-xml $result
8b65ee
diff --git a/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.xccdf.xml b/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.xccdf.xml
8b65ee
index 44dc4de49..1c87b9d51 100644
8b65ee
--- a/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.xccdf.xml
8b65ee
+++ b/tests/API/XCCDF/unittests/test_xccdf_check_multi_check2.xccdf.xml
8b65ee
@@ -3,6 +3,7 @@
8b65ee
   <status>incomplete</status>
8b65ee
   <version>1.0</version>
8b65ee
   <Rule selected="true" id="xccdf_moc.elpmaxe.www_rule_1">
8b65ee
+    <title>The only rule in this benchmark</title>
8b65ee
     <check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" multi-check="true">
8b65ee
       <check-content-ref href="test_xccdf_check_content_ref_without_name_attr.oval.xml"/>
8b65ee
     </check>
8b65ee
diff --git a/utils/oscap-xccdf.c b/utils/oscap-xccdf.c
8b65ee
index 19ffc0859..59cd7bcf2 100644
8b65ee
--- a/utils/oscap-xccdf.c
8b65ee
+++ b/utils/oscap-xccdf.c
8b65ee
@@ -392,6 +392,13 @@ static int callback_scr_result_progress(struct xccdf_rule_result *rule_result, v
8b65ee
 	return 0;
8b65ee
 }
8b65ee
 
8b65ee
+static int callback_scr_multicheck(struct oval_definition *definition, void *arg)
8b65ee
+{
8b65ee
+	printf("OVAL Definition ID\t%s\n", oval_definition_get_id(definition));
8b65ee
+	printf("OVAL Definition Title\t%s\n", oval_definition_get_title(definition));
8b65ee
+	return 0;
8b65ee
+}
8b65ee
+
8b65ee
 /*
8b65ee
  * Send XCCDF Rule Results info message to syslog
8b65ee
  *
8b65ee
@@ -434,6 +441,7 @@ static void _register_progress_callback(struct xccdf_session *session, bool prog
8b65ee
 		xccdf_policy_model_register_start_callback(policy_model, callback_scr_rule,
8b65ee
 				(void *) xccdf_session_get_xccdf_policy(session));
8b65ee
 		xccdf_policy_model_register_output_callback(policy_model, callback_scr_result, NULL);
8b65ee
+		xccdf_policy_model_register_multicheck_callback(policy_model, callback_scr_multicheck, NULL);
8b65ee
 	}
8b65ee
 	/* xccdf_policy_model_register_output_callback(policy_model, callback_syslog_result, NULL); */
8b65ee
 }
8b65ee
diff --git a/xsl/xccdf-report-impl.xsl b/xsl/xccdf-report-impl.xsl
8b65ee
index cc76a56cc..ba07b0a90 100644
8b65ee
--- a/xsl/xccdf-report-impl.xsl
8b65ee
+++ b/xsl/xccdf-report-impl.xsl
8b65ee
@@ -346,19 +346,14 @@ Authors:
8b65ee
     <xsl:text>}</xsl:text>
8b65ee
 </xsl:template>
8b65ee
 
8b65ee
-<xsl:key name="testresult_ruleresults" match="//cdf:rule-result" use="concat(ancestor::cdf:TestResult/@id, '|', @idref)"/>
8b65ee
-
8b65ee
-<xsl:template name="rule-overview-leaf">
8b65ee
-    <xsl:param name="testresult"/>
8b65ee
-    <xsl:param name="item"/>
8b65ee
-    <xsl:param name="profile"/>
8b65ee
-    <xsl:param name="indent"/>
8b65ee
-
8b65ee
-    <xsl:variable name="ruleresult" select="key('testresult_ruleresults', concat($testresult/@id, '|', $item/@id))"/>
8b65ee
-    <xsl:variable name="result" select="$ruleresult/cdf:result/text()"/>
8b65ee
-
8b65ee
-    <xsl:if test="$result != 'notselected'">
8b65ee
-    
8b65ee
+<xsl:template name="rule-overview-leaf-table-row">
8b65ee
+    <xsl:param name="result" />
8b65ee
+    <xsl:param name="item" />
8b65ee
+    <xsl:param name="indent" />
8b65ee
+    <xsl:param name="testresult" />
8b65ee
+    <xsl:param name="profile" />
8b65ee
+
8b65ee
+    
8b65ee
         <xsl:attribute name="data-tt-parent-id">
8b65ee
             <xsl:value-of select="$item/parent::cdf:*/@id"/>
8b65ee
         </xsl:attribute>
8b65ee
@@ -371,18 +366,26 @@ Authors:
8b65ee
             <xsl:attribute name="class">rule-overview-leaf rule-overview-leaf-<xsl:value-of select="$result"/> rule-overview-needs-attention</xsl:attribute>
8b65ee
         </xsl:if>
8b65ee
 
8b65ee
-        
8b65ee
-            <xsl:call-template name="item-title">
8b65ee
-                <xsl:with-param name="item" select="$item"/>
8b65ee
-                <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
-                <xsl:with-param name="profile" select="$profile"/>
8b65ee
-            </xsl:call-template>
8b65ee
+        
8b65ee
+            
8b65ee
+                <xsl:call-template name="item-title">
8b65ee
+                    <xsl:with-param name="item" select="$item"/>
8b65ee
+                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                    <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                </xsl:call-template>
8b65ee
             
8b65ee
-            <xsl:if test="$ruleresult/cdf:override">
8b65ee
+            <xsl:if test="cdf:check[@multi-check='true']">
8b65ee
+                (<xsl:value-of select="cdf:check/cdf:check-content-ref/@name" />)
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="cdf:override">
8b65ee
                  waived
8b65ee
             </xsl:if>
8b65ee
         
8b65ee
-        <xsl:call-template name="item-severity"><xsl:with-param name="item" select="$ruleresult" /></xsl:call-template>
8b65ee
+        
8b65ee
+            <xsl:call-template name="item-severity">
8b65ee
+                <xsl:with-param name="item" select="." />
8b65ee
+            </xsl:call-template>
8b65ee
+        
8b65ee
         
8b65ee
             <xsl:variable name="result_tooltip">
8b65ee
                 <xsl:call-template name="rule-result-tooltip">
8b65ee
@@ -394,7 +397,31 @@ Authors:
8b65ee
             
8b65ee
         
8b65ee
     
8b65ee
-    </xsl:if>
8b65ee
+</xsl:template>
8b65ee
+
8b65ee
+<xsl:key name="testresult_ruleresults" match="//cdf:rule-result" use="concat(ancestor::cdf:TestResult/@id, '|', @idref)"/>
8b65ee
+
8b65ee
+<xsl:template name="rule-overview-leaf">
8b65ee
+    <xsl:param name="testresult"/>
8b65ee
+    <xsl:param name="item"/>
8b65ee
+    <xsl:param name="profile"/>
8b65ee
+    <xsl:param name="indent"/>
8b65ee
+
8b65ee
+    <xsl:variable name="ruleresult" select="key('testresult_ruleresults', concat($testresult/@id, '|', $item/@id))"/>
8b65ee
+
8b65ee
+    
8b65ee
+    <xsl:for-each select="$ruleresult">
8b65ee
+        <xsl:variable name="result" select="cdf:result/text()"/>
8b65ee
+        <xsl:if test="$result != 'notselected'">
8b65ee
+            <xsl:call-template name="rule-overview-leaf-table-row">
8b65ee
+                <xsl:with-param name="item" select="$item"/>
8b65ee
+                <xsl:with-param name="result" select="$result"/>
8b65ee
+                <xsl:with-param name="indent" select="$indent"/>
8b65ee
+                <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                <xsl:with-param name="profile" select="$profile"/>
8b65ee
+            </xsl:call-template>
8b65ee
+        </xsl:if>
8b65ee
+    </xsl:for-each>
8b65ee
 </xsl:template>
8b65ee
 
8b65ee
 <xsl:template name="rule-overview-inner-node">
8b65ee
@@ -718,179 +745,212 @@ Authors:
8b65ee
 
8b65ee
 </xsl:template>
8b65ee
 
8b65ee
-<xsl:template name="result-details-leaf">
8b65ee
-    <xsl:param name="testresult"/>
8b65ee
+
8b65ee
+<xsl:template name="result-details-leaf-table">
8b65ee
     <xsl:param name="item"/>
8b65ee
+    <xsl:param name="testresult"/>
8b65ee
     <xsl:param name="profile"/>
8b65ee
+    <xsl:param name="result"/>
8b65ee
 
8b65ee
-    <xsl:variable name="ruleresult" select="key('testresult_ruleresults', concat($testresult/@id, '|', $item/@id))"/>
8b65ee
-    <xsl:variable name="result" select="$ruleresult/cdf:result/text()"/>
8b65ee
-
8b65ee
-    <xsl:if test="$result != 'notselected'">
8b65ee
-    
8b65ee
-        
8b65ee
-            <xsl:comment>This allows OpenSCAP JS to search the report rules</xsl:comment>
8b65ee
-            <xsl:call-template name="item-title">
8b65ee
-                <xsl:with-param name="item" select="$item"/>
8b65ee
-                <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
-                <xsl:with-param name="profile" select="$profile"/>
8b65ee
-            </xsl:call-template>
8b65ee
-            <xsl:value-of select="concat($item/@id, ' ')"/>
8b65ee
-            <xsl:value-of select="$ruleresult/@severity"/>
8b65ee
-            <xsl:for-each select="$ruleresult/cdf:ident">
8b65ee
-                <xsl:value-of select="concat(text(), ' ')"/>
8b65ee
-            </xsl:for-each>
8b65ee
-            <xsl:for-each select="$ruleresult/cdf:reference">
8b65ee
-                <xsl:value-of select="concat(text(), ' ')"/>
8b65ee
-            </xsl:for-each>
8b65ee
-        
8b65ee
-        
8b65ee
-            

8b65ee
-                <xsl:call-template name="item-title">
8b65ee
+    
8b65ee
+        
8b65ee
+            Rule ID<xsl:value-of select="$item/@id"/>
8b65ee
+            Result
8b65ee
+            
8b65ee
+                <xsl:variable name="result_tooltip">
8b65ee
+                    <xsl:call-template name="rule-result-tooltip">
8b65ee
+                        <xsl:with-param name="ruleresult" select="$result"/>
8b65ee
+                    </xsl:call-template>
8b65ee
+                </xsl:variable>
8b65ee
+                
8b65ee
+                    <xsl:value-of select="$result"/>
8b65ee
+                
8b65ee
+            
8b65ee
+            
8b65ee
+                Multi-check rule
8b65ee
+                
8b65ee
+                    <xsl:choose>
8b65ee
+                        <xsl:when test="cdf:check[@multi-check='true']">yes</xsl:when>
8b65ee
+                        <xsl:otherwise>no</xsl:otherwise>
8b65ee
+                    </xsl:choose>
8b65ee
+                
8b65ee
+            
8b65ee
+            <xsl:if test="cdf:check[@system='http://oval.mitre.org/XMLSchema/oval-definitions-5']">
8b65ee
+                
8b65ee
+                    OVAL Definition ID
8b65ee
+                    
8b65ee
+                        <xsl:value-of select="cdf:check/cdf:check-content-ref/@name" />
8b65ee
+                    
8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            Time<xsl:value-of select="@time"/>
8b65ee
+            Severity<xsl:call-template name="item-severity"><xsl:with-param name="item" select="." /></xsl:call-template>
8b65ee
+            Identifiers and References
8b65ee
+                
8b65ee
+                    the Rule itself. That means that we can just use the same code as guide
8b65ee
+                    and just use idents from Rule. -->
8b65ee
+                <xsl:call-template name="item-idents-refs">
8b65ee
                     <xsl:with-param name="item" select="$item"/>
8b65ee
-                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
-                    <xsl:with-param name="profile" select="$profile"/>
8b65ee
                 </xsl:call-template>
8b65ee
-            
8b65ee
-        
8b65ee
-        
8b65ee
-            
8b65ee
-                
8b65ee
-                    Rule ID<xsl:value-of select="$item/@id"/>
8b65ee
-                    Result
8b65ee
-                    
8b65ee
-                        <xsl:variable name="result_tooltip">
8b65ee
-                            <xsl:call-template name="rule-result-tooltip">
8b65ee
-                                <xsl:with-param name="ruleresult" select="$result"/>
8b65ee
-                            </xsl:call-template>
8b65ee
-                        </xsl:variable>
8b65ee
-                        
8b65ee
-                            <xsl:value-of select="$result"/>
8b65ee
+            
8b65ee
+            <xsl:if test="cdf:override">
8b65ee
+                
8b65ee
+                    <xsl:for-each select="cdf:override">
8b65ee
+                        <xsl:variable name="old-result" select="cdf:old-result/text()"/>
8b65ee
+
8b65ee
+                        
8b65ee
+                            This rule has been waived by <xsl:value-of select="@authority"/> at <xsl:value-of select="@date"/>.
8b65ee
+                            
8b65ee
+                                <xsl:value-of select="cdf:remark/text()"/>
8b65ee
+                            
8b65ee
+                            <small>
8b65ee
+                                The previous result was  <xsl:value-of select="$old-result"/> .
8b65ee
+                            </small>
8b65ee
                         
8b65ee
-                    
8b65ee
-                    Time<xsl:value-of select="$ruleresult/@time"/>
8b65ee
-                    Severity<xsl:call-template name="item-severity"><xsl:with-param name="item" select="$ruleresult" /></xsl:call-template>
8b65ee
-                    Identifiers and References
8b65ee
-                        
8b65ee
-                             the Rule itself. That means that we can just use the same code as guide
8b65ee
-                             and just use idents from Rule. -->
8b65ee
-                        <xsl:call-template name="item-idents-refs">
8b65ee
-                            <xsl:with-param name="item" select="$item"/>
8b65ee
-                        </xsl:call-template>
8b65ee
-                    
8b65ee
-                    <xsl:if test="$ruleresult/cdf:override">
8b65ee
-                        
8b65ee
-                            <xsl:for-each select="$ruleresult/cdf:override">
8b65ee
-                                <xsl:variable name="old-result" select="cdf:old-result/text()"/>
8b65ee
-
8b65ee
-                                
8b65ee
-                                    This rule has been waived by <xsl:value-of select="@authority"/> at <xsl:value-of select="@date"/>.
8b65ee
-                                    
8b65ee
-                                        <xsl:value-of select="cdf:remark/text()"/>
8b65ee
-                                    
8b65ee
-                                    <small>
8b65ee
-                                        The previous result was  <xsl:value-of select="$old-result"/> .
8b65ee
-                                    </small>
8b65ee
-                                
8b65ee
-                            </xsl:for-each>
8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:if test="$item/cdf:description">
8b65ee
-                        Description
8b65ee
-                            

8b65ee
-                                <xsl:apply-templates mode="sub-testresult" select="$item/cdf:description">
8b65ee
-                                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                    </xsl:for-each>
8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="$item/cdf:description">
8b65ee
+                Description
8b65ee
+                    

8b65ee
+                        <xsl:apply-templates mode="sub-testresult" select="$item/cdf:description">
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                        </xsl:apply-templates>
8b65ee
+                    

8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="$item/cdf:rationale">
8b65ee
+                Rationale
8b65ee
+                    

8b65ee
+                        <xsl:apply-templates mode="sub-testresult" select="$item/cdf:rationale">
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                        </xsl:apply-templates>
8b65ee
+                    

8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="$item/cdf:warning">
8b65ee
+                Warnings
8b65ee
+                    <xsl:for-each select="$item/cdf:warning">
8b65ee
+                        
8b65ee
+                            
8b65ee
+                                warning 
8b65ee
+                                <xsl:apply-templates mode="sub-testresult" select=".">
8b65ee
                                     <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
                                     <xsl:with-param name="profile" select="$profile"/>
8b65ee
                                 </xsl:apply-templates>
8b65ee
-                            

8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:if test="$item/cdf:rationale">
8b65ee
-                        Rationale
8b65ee
-                            

8b65ee
-                                <xsl:apply-templates mode="sub-testresult" select="$item/cdf:rationale">
8b65ee
-                                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            
8b65ee
+                        
8b65ee
+                    </xsl:for-each>
8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:variable name="check_system_details_ret">
8b65ee
+                <xsl:call-template name="check-system-details">
8b65ee
+                    <xsl:with-param name="check" select="cdf:check"/>
8b65ee
+                    <xsl:with-param name="oval-tmpl" select="$oval-tmpl"/>
8b65ee
+                    <xsl:with-param name="sce-tmpl" select="$sce-tmpl"/>
8b65ee
+                    <xsl:with-param name="result" select="$result"/>
8b65ee
+                </xsl:call-template>
8b65ee
+            </xsl:variable>
8b65ee
+
8b65ee
+            <xsl:if test="normalize-space($check_system_details_ret)">
8b65ee
+                
8b65ee
+                    <xsl:copy-of select="$check_system_details_ret"/>
8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="cdf:message">
8b65ee
+                
8b65ee
+                    Evaluation messages
8b65ee
+                    
8b65ee
+                        
8b65ee
+                            <xsl:for-each select="cdf:message">
8b65ee
+                                <xsl:if test="./@severity">
8b65ee
+                                    <xsl:value-of select="./@severity"/> 
8b65ee
+                                </xsl:if>
8b65ee
+                                
<xsl:apply-templates mode="sub-testresult" select=".">
8b65ee
                                     <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
                                     <xsl:with-param name="profile" select="$profile"/>
8b65ee
-                                </xsl:apply-templates>
8b65ee
-                            

8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:if test="$item/cdf:warning">
8b65ee
-                        Warnings
8b65ee
-                            <xsl:for-each select="$item/cdf:warning">
8b65ee
-                                
8b65ee
-                                    
8b65ee
-                                        warning 
8b65ee
-                                        <xsl:apply-templates mode="sub-testresult" select=".">
8b65ee
-                                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
-                                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
-                                        </xsl:apply-templates>
8b65ee
-                                    
8b65ee
-                                
8b65ee
+                                </xsl:apply-templates>
8b65ee
                             </xsl:for-each>
8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:variable name="check_system_details_ret">
8b65ee
-                        <xsl:call-template name="check-system-details">
8b65ee
-                            <xsl:with-param name="check" select="$ruleresult/cdf:check"/>
8b65ee
-                            <xsl:with-param name="oval-tmpl" select="$oval-tmpl"/>
8b65ee
-                            <xsl:with-param name="sce-tmpl" select="$sce-tmpl"/>
8b65ee
-                            <xsl:with-param name="result" select="$result"/>
8b65ee
+                        
8b65ee
+                    
8b65ee
+                
8b65ee
+            </xsl:if>
8b65ee
+            <xsl:if test="$result = 'fail' or $result = 'error' or $result = 'unknown'">
8b65ee
+                <xsl:for-each select="$item/cdf:fixtext">
8b65ee
+                    
8b65ee
+                        <xsl:call-template name="show-fixtext">
8b65ee
+                            <xsl:with-param name="fixtext" select="."/>
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                        </xsl:call-template>
8b65ee
+                    
8b65ee
+                </xsl:for-each>
8b65ee
+                <xsl:for-each select="$item/cdf:fix">
8b65ee
+                    
8b65ee
+                        <xsl:call-template name="show-fix">
8b65ee
+                            <xsl:with-param name="fix" select="."/>
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
                         </xsl:call-template>
8b65ee
-                    </xsl:variable>
8b65ee
+                    
8b65ee
+                </xsl:for-each>
8b65ee
+            </xsl:if>
8b65ee
+        
8b65ee
+    
8b65ee
+</xsl:template>
8b65ee
 
8b65ee
-                    <xsl:if test="normalize-space($check_system_details_ret)">
8b65ee
-                        
8b65ee
-                            <xsl:copy-of select="$check_system_details_ret"/>
8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:if test="$ruleresult/cdf:message">
8b65ee
-                        
8b65ee
-                            Evaluation messages
8b65ee
-                            
8b65ee
-                                
8b65ee
-                                    <xsl:for-each select="$ruleresult/cdf:message">
8b65ee
-                                        <xsl:if test="./@severity">
8b65ee
-                                            <xsl:value-of select="./@severity"/> 
8b65ee
-                                        </xsl:if>
8b65ee
-                                        
<xsl:apply-templates mode="sub-testresult" select=".">
8b65ee
-                                            <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
-                                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
-                                        </xsl:apply-templates>
8b65ee
-                                    </xsl:for-each>
8b65ee
-                                
8b65ee
-                            
8b65ee
-                        
8b65ee
-                    </xsl:if>
8b65ee
-                    <xsl:if test="$result = 'fail' or $result = 'error' or $result = 'unknown'">
8b65ee
-                        <xsl:for-each select="$item/cdf:fixtext">
8b65ee
-                            
8b65ee
-                                <xsl:call-template name="show-fixtext">
8b65ee
-                                    <xsl:with-param name="fixtext" select="."/>
8b65ee
-                                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
-                                    <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
-                                    <xsl:with-param name="profile" select="$profile"/>
8b65ee
-                                </xsl:call-template>
8b65ee
-                            
8b65ee
-                        </xsl:for-each>
8b65ee
-                        <xsl:for-each select="$item/cdf:fix">
8b65ee
-                            
8b65ee
-                                <xsl:call-template name="show-fix">
8b65ee
-                                    <xsl:with-param name="fix" select="."/>
8b65ee
-                                    <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
-                                    <xsl:with-param name="benchmark" select="$item/ancestor::cdf:Benchmark"/>
8b65ee
-                                    <xsl:with-param name="profile" select="$profile"/>
8b65ee
-                                </xsl:call-template>
8b65ee
-                            
8b65ee
-                        </xsl:for-each>
8b65ee
-                    </xsl:if>
8b65ee
-                
8b65ee
-            
8b65ee
-        
8b65ee
-    
8b65ee
-    </xsl:if>
8b65ee
+<xsl:template name="result-details-leaf">
8b65ee
+    <xsl:param name="testresult"/>
8b65ee
+    <xsl:param name="item"/>
8b65ee
+    <xsl:param name="profile"/>
8b65ee
+
8b65ee
+    <xsl:variable name="ruleresult" select="key('testresult_ruleresults', concat($testresult/@id, '|', $item/@id))"/>
8b65ee
+    <xsl:for-each select="$ruleresult">
8b65ee
+        <xsl:variable name="result" select="cdf:result/text()"/>
8b65ee
+        <xsl:if test="$result != 'notselected'">
8b65ee
+            
8b65ee
+                
8b65ee
+                    <xsl:comment>This allows OpenSCAP JS to search the report rules</xsl:comment>
8b65ee
+                    <xsl:call-template name="item-title">
8b65ee
+                        <xsl:with-param name="item" select="$item"/>
8b65ee
+                        <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                        <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                    </xsl:call-template>
8b65ee
+                    <xsl:value-of select="concat($item/@id, ' ')"/>
8b65ee
+                    <xsl:value-of select="@severity"/>
8b65ee
+                    <xsl:for-each select="cdf:ident">
8b65ee
+                        <xsl:value-of select="concat(text(), ' ')"/>
8b65ee
+                    </xsl:for-each>
8b65ee
+                    <xsl:for-each select="cdf:reference">
8b65ee
+                        <xsl:value-of select="concat(text(), ' ')"/>
8b65ee
+                    </xsl:for-each>
8b65ee
+                
8b65ee
+                
8b65ee
+                    

8b65ee
+                        <xsl:call-template name="item-title">
8b65ee
+                            <xsl:with-param name="item" select="$item"/>
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                        </xsl:call-template>
8b65ee
+                    
8b65ee
+                
8b65ee
+                
8b65ee
+                    <xsl:call-template name="result-details-leaf-table">
8b65ee
+                            <xsl:with-param name="item" select="$item"/>
8b65ee
+                            <xsl:with-param name="testresult" select="$testresult"/>
8b65ee
+                            <xsl:with-param name="profile" select="$profile"/>
8b65ee
+                            <xsl:with-param name="result" select="$result"/>
8b65ee
+                    </xsl:call-template>
8b65ee
+                
8b65ee
+            
8b65ee
+        </xsl:if>
8b65ee
+    </xsl:for-each>
8b65ee
 </xsl:template>
8b65ee
 
8b65ee
 <xsl:template name="result-details-inner-node">