]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nss-myhostname: do not return empty result with NSS_STATUS_SUCCESS 26366/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Feb 2023 21:07:13 +0000 (06:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Feb 2023 21:07:16 +0000 (06:07 +0900)
Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45.

Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468).

src/nss-myhostname/nss-myhostname.c

index 1b340e11d467ddd813a4847d1377828445002465..ed417306f020ab43bb4806b4190e280ed5bbc243 100644 (file)
@@ -346,9 +346,10 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
                 return NSS_STATUS_UNAVAIL;
         }
 
+        if (af == AF_INET6 && !socket_ipv6_is_enabled())
+                goto not_found;
+
         if (is_localhost(name)) {
-                if (af == AF_INET6 && !socket_ipv6_is_enabled())
-                        goto not_found;
 
                 canonical = "localhost";
                 local_address_ipv4 = htobe32(INADDR_LOOPBACK);