1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

Merge pull request #26366 from yuwata/nss-myhostname

nss-myhostname: two fixlets
This commit is contained in:
Luca Boccassi 2023-02-09 10:04:14 +00:00 committed by GitHub
commit dad1305eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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);
@ -461,7 +462,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
} else {
assert(af == AF_INET6);
if (socket_ipv6_is_enabled())
if (!socket_ipv6_is_enabled())
goto not_found;
if (memcmp(addr, LOCALADDRESS_IPV6, 16) == 0) {