Blame SOURCES/openscap-1.3.6-ubi9-pr-1772.patch

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