adamwill / rpms / openscap

Forked from rpms/openscap 3 years ago
Clone

Blame SOURCES/ds_session_without_remote_resources.patch

fa2dd6
From bbcbffcf6f901cb67ca5645307d170a32504a491 Mon Sep 17 00:00:00 2001
fa2dd6
From: Watson Sato <wsato@redhat.com>
fa2dd6
Date: Tue, 30 Apr 2019 18:30:53 +0200
fa2dd6
Subject: [PATCH] Allow DS session to continue without remote resources
fa2dd6
fa2dd6
---
fa2dd6
 src/DS/sds.c | 9 +++++++--
fa2dd6
 1 file changed, 7 insertions(+), 2 deletions(-)
fa2dd6
fa2dd6
diff --git a/src/DS/sds.c b/src/DS/sds.c
fa2dd6
index 2511e89d9..b7c33a2e5 100644
fa2dd6
--- a/src/DS/sds.c
fa2dd6
+++ b/src/DS/sds.c
fa2dd6
@@ -412,6 +412,7 @@ static int ds_sds_dump_component_by_href(struct ds_sds_session *session, char* x
fa2dd6
 			}
fa2dd6
 
fa2dd6
 			ds_sds_session_remote_resources_progress(session)(true, "WARNING: Skipping '%s' file which is referenced from datastream\n", url);
fa2dd6
+			// -2 means that remote resources were not downloaded
fa2dd6
 			return -2;
fa2dd6
 		}
fa2dd6
 
fa2dd6
@@ -444,8 +445,12 @@ int ds_sds_dump_component_ref_as(const xmlNodePtr component_ref, struct ds_sds_s
fa2dd6
 	xmlFree(xlink_href);
fa2dd6
 	xmlFree(cref_id);
fa2dd6
 
fa2dd6
-	if (ret != 0) {
fa2dd6
-
fa2dd6
+	if (ret == -2) {
fa2dd6
+		// A remote component was not dumped
fa2dd6
+		// It should be ok to continue without it
fa2dd6
+		free(target_filename_dirname);
fa2dd6
+		return 0;
fa2dd6
+	} else if (ret != 0) {
fa2dd6
 		free(target_filename_dirname);
fa2dd6
 		return -1;
fa2dd6
 	}