diff --git a/openscap-1.3.6-warning-local-files-pr-1826.patch b/openscap-1.3.6-warning-local-files-pr-1826.patch new file mode 100644 index 0000000..c97dcd6 --- /dev/null +++ b/openscap-1.3.6-warning-local-files-pr-1826.patch @@ -0,0 +1,41 @@ +From ce74fde37771fa2cf6d947e5aaeebd9a197db50b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= +Date: Tue, 9 Nov 2021 09:15:20 +0100 +Subject: [PATCH] Print warning for local files + +This will explicitely display users that they're using local +files instead of the remote resource. + +See https://bugzilla.redhat.com/show_bug.cgi?id=1970529#c6 +--- + src/DS/sds.c | 4 +++- + tests/DS/test_ds_use_local_remote_resources.sh | 1 + + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/DS/sds.c b/src/DS/sds.c +index a26fdbb09..243b62968 100644 +--- a/src/DS/sds.c ++++ b/src/DS/sds.c +@@ -407,7 +407,9 @@ static int _handle_disabled_downloads(struct ds_sds_session *session, const char + char *local_filepath = oscap_path_join(local_files, relative_filepath); + struct stat sb; + if (stat(local_filepath, &sb) == 0) { +- dI("Using local file '%s' instead of '%s'", local_filepath, xlink_href); ++ ds_sds_session_remote_resources_progress(session)(true, ++ "WARNING: Using local file '%s' instead of '%s'", ++ local_filepath, xlink_href); + struct oscap_source *source_file = oscap_source_new_from_file(local_filepath); + xmlDoc *doc = oscap_source_get_xmlDoc(source_file); + if (doc == NULL) { +diff --git a/tests/DS/test_ds_use_local_remote_resources.sh b/tests/DS/test_ds_use_local_remote_resources.sh +index 789dc8326..2feb47da1 100755 +--- a/tests/DS/test_ds_use_local_remote_resources.sh ++++ b/tests/DS/test_ds_use_local_remote_resources.sh +@@ -24,6 +24,7 @@ $OSCAP xccdf eval --local-files "$tmpdir3" --profile "$PROFILE" --results "$resu + + grep -q "WARNING: Datastream component 'scap_org.open-scap_cref_remote.oval.xml' points out to the remote 'https://www.example.com/security/data/oval/remote.oval.xml'. Use '--fetch-remote-resources' option to download it." "$stderr" && false + grep -q "WARNING: Skipping 'https://www.example.com/security/data/oval/remote.oval.xml' file which is referenced from datastream" "$stderr" && false ++grep -q "WARNING: Using local file '$tmpdir3/remote.oval.xml' instead of 'https://www.example.com/security/data/oval/remote.oval.xml'" "$stderr" + + assert_exists 1 '//rule-result[@idref="xccdf_com.example.www_rule_test-pass"]/result[text()="pass"]' + # the remote_res rule is a multicheck with 2 oval definitions so it's twice here diff --git a/openscap.spec b/openscap.spec index 13e9cd2..c90b2ed 100644 --- a/openscap.spec +++ b/openscap.spec @@ -1,6 +1,6 @@ Name: openscap Version: 1.3.5 -Release: 12%{?dist} +Release: 13%{?dist} Epoch: 1 Summary: Set of open source libraries enabling integration of the SCAP line of standards License: LGPLv2+ @@ -26,6 +26,7 @@ Patch17: openscap-1.3.6-local-files-pr-1769.patch Patch18: openscap-1.3.6-oscap-ssh-local-files-pr-1786.patch Patch19: openscap-1.3.6-alternative-hostname-pr-1806.patch Patch20: openscap-1.3.6-memory-limit-pr-1827.patch +Patch21: openscap-1.3.6-warning-local-files-pr-1826.patch BuildRequires: make BuildRequires: cmake >= 2.6 BuildRequires: gcc @@ -216,6 +217,9 @@ pathfix.py -i %{__python3} -p -n $RPM_BUILD_ROOT%{_bindir}/scap-as-rpm %{_bindir}/oscap-run-sce-script %changelog +* Fri Nov 19 2021 Jan Černý - 1:1.3.5-13 +- Print warning for local files + * Tue Nov 09 2021 Jan Černý - 1:1.3.5-12 - Allow using local files instead of remote resources (rhbz#2015518) - Add an alternative source of hostname (rhbz#2021509)