adamwill / rpms / openscap

Forked from rpms/openscap 3 years ago
Clone

Blame SOURCES/openscap-1.2.15-use-checklist-id-to-get-html-guide-PR-745.patch

0dbe4c
From e8f6f67552b196b9d65fa40719e2ea00c87a9579 Mon Sep 17 00:00:00 2001
0dbe4c
From: Evgeni Golov <egolov@redhat.com>
0dbe4c
Date: Fri, 19 May 2017 17:34:59 +0200
0dbe4c
Subject: [PATCH] pass session->checklist_id to oscap_htable_get in
0dbe4c
 get_html_guide
0dbe4c
0dbe4c
In b8defed we moved to using s->checklist_id instead of hard coding
0dbe4c
xccdf.xml. However, this change was forgotten in
0dbe4c
ds_sds_session_get_html_guide which leads to the following error when
0dbe4c
trying to get the HTML guide:
0dbe4c
0dbe4c
    Internal error: Could not acquire handle to xccdf.xml source.
0dbe4c
0dbe4c
This change migrates ds_sds_session_get_html_guide to also use
0dbe4c
s->checklist_id and thus fixes the issue.
0dbe4c
0dbe4c
Fixes: #744
0dbe4c
---
0dbe4c
 src/DS/ds_sds_session.c | 4 ++--
0dbe4c
 1 file changed, 2 insertions(+), 2 deletions(-)
0dbe4c
0dbe4c
diff --git a/src/DS/ds_sds_session.c b/src/DS/ds_sds_session.c
0dbe4c
index db7692a65..f14588e09 100644
0dbe4c
--- a/src/DS/ds_sds_session.c
0dbe4c
+++ b/src/DS/ds_sds_session.c
0dbe4c
@@ -352,9 +352,9 @@ char *ds_sds_session_get_html_guide(struct ds_sds_session *session, const char *
0dbe4c
 		"profile_id", profile_id,
0dbe4c
 		NULL
0dbe4c
 	};
0dbe4c
-	struct oscap_source *xccdf = oscap_htable_get(session->component_sources, "xccdf.xml");
0dbe4c
+	struct oscap_source *xccdf = oscap_htable_get(session->component_sources, session->checklist_id);
0dbe4c
 	if (xccdf == NULL) {
0dbe4c
-		oscap_seterr(OSCAP_EFAMILY_OSCAP, "Internal error: Could not acquire handle to xccdf.xml source.");
0dbe4c
+		oscap_seterr(OSCAP_EFAMILY_OSCAP, "Internal error: Could not acquire handle to '%s' source.", session->checklist_id);
0dbe4c
 		return NULL;
0dbe4c
 	}
0dbe4c
 	return oscap_source_apply_xslt_path_mem(xccdf, "xccdf-guide.xsl", params, oscap_path_to_xslt());