From: Yu Watanabe Date: Wed, 8 Feb 2023 21:07:13 +0000 (+0900) Subject: nss-myhostname: do not return empty result with NSS_STATUS_SUCCESS X-Git-Tag: v253-rc3~15^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F26366%2Fhead;p=thirdparty%2Fsystemd.git nss-myhostname: do not return empty result with NSS_STATUS_SUCCESS Fixes a bug introduced by db50d326a46beca3cc24b6354b6e1b3591902d45. Fixes RHBZ#2167468 (https://bugzilla.redhat.com/show_bug.cgi?id=2167468). --- diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c index 1b340e11d46..ed417306f02 100644 --- a/src/nss-myhostname/nss-myhostname.c +++ b/src/nss-myhostname/nss-myhostname.c @@ -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);