ac3a84
From 86bbeff62982404dc76e79d3dad8a8c59308d017 Mon Sep 17 00:00:00 2001
ac3a84
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ac3a84
Date: Thu, 9 Feb 2023 06:07:13 +0900
ac3a84
Subject: [PATCH] nss-myhostname: do not return empty result with
ac3a84
 NSS_STATUS_SUCCESS
ac3a84
ac3a84
Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45.
ac3a84
ac3a84
Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468).
ac3a84
ac3a84
(cherry picked from commit 1c3762937e9184c9abbc8d5541b4228841ccc24f)
ac3a84
ac3a84
Resolves: #2167468
ac3a84
---
ac3a84
 src/nss-myhostname/nss-myhostname.c | 5 +++--
ac3a84
 1 file changed, 3 insertions(+), 2 deletions(-)
ac3a84
ac3a84
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
ac3a84
index 93db9d16e7..d574e98a71 100644
ac3a84
--- a/src/nss-myhostname/nss-myhostname.c
ac3a84
+++ b/src/nss-myhostname/nss-myhostname.c
ac3a84
@@ -345,9 +345,10 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
ac3a84
                 return NSS_STATUS_UNAVAIL;
ac3a84
         }
ac3a84
 
ac3a84
+        if (af == AF_INET6 && !socket_ipv6_is_enabled())
ac3a84
+                goto not_found;
ac3a84
+
ac3a84
         if (is_localhost(name)) {
ac3a84
-                if (af == AF_INET6 && !socket_ipv6_is_enabled())
ac3a84
-                        goto not_found;
ac3a84
 
ac3a84
                 canonical = "localhost";
ac3a84
                 local_address_ipv4 = htobe32(INADDR_LOOPBACK);