Blame SOURCES/openscap-1.3.6-PR-1772-UBI9.patch

909fca
From 80543bc666d648d0251e4c7b675489b8011a548a Mon Sep 17 00:00:00 2001
909fca
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
909fca
Date: Fri, 25 Jun 2021 10:19:43 +0200
909fca
Subject: [PATCH] Fix UBI 9 scan
909fca
909fca
In offline mode when scanning a cointainer based on UBI 9 the
909fca
system_info probe failed because the function `_offline_get_hname` which
909fca
reads from `/etc/hostname` returns an empty string which causes
909fca
`__sysinfo_saneval(hname)` check to return zero which in turn causes the
909fca
probe returns an error. We can prevent this situation by replacing the
909fca
empty string by `"Unknown"`, which we already do when the `hname` is
909fca
`NULL`.
909fca
909fca
Addressing:
909fca
909fca
W: oscap: Can't receive message: 125, Operation canceled.
909fca
E: oscap: Recv: retry limit (0) reached.
909fca
OpenSCAP Error: Probe at sd=32 (system_info) reported an error: Invalid type, value or format [/home/jcerny/work/git/openscap/src/OVAL/oval_probe_ext.c:383]
909fca
Unable to receive a message from probe [/home/jcerny/work/git/openscap/src/OVAL/oval_probe_ext.c:572]
909fca
909fca
Resolves: rhbz#1953610
909fca
---
909fca
 src/OVAL/probes/independent/system_info_probe.c | 2 +-
909fca
 1 file changed, 1 insertion(+), 1 deletion(-)
909fca
909fca
diff --git a/src/OVAL/probes/independent/system_info_probe.c b/src/OVAL/probes/independent/system_info_probe.c
909fca
index 9bdd73556d..8251e655ed 100644
909fca
--- a/src/OVAL/probes/independent/system_info_probe.c
909fca
+++ b/src/OVAL/probes/independent/system_info_probe.c
909fca
@@ -732,7 +732,7 @@ int system_info_probe_main(probe_ctx *ctx, void *arg)
909fca
 	if (!architecture)
909fca
 		architecture = strdup(unknown);
909fca
 
909fca
-	if (!hname)
909fca
+	if (!hname || *hname == '\0')
909fca
 		hname = strdup(unknown);
909fca
 
909fca
 	if (__sysinfo_saneval(os_name) < 1 ||