adamwill / rpms / openscap

Forked from rpms/openscap 3 years ago
Clone

Blame SOURCES/ds_session_without_remote_resources.patch

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