diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-09-13 16:11:40 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2022-10-15 19:54:59 +0200 |
commit | 6c0f5cb201a98f9a6c150e10797819356821c4a7 (patch) | |
tree | 096141f88036adf0a7cd87b81da4d31f7aced5e2 | |
parent | nss: Implement --no-addrconfig option for getent (diff) | |
download | glibc-6c0f5cb201a98f9a6c150e10797819356821c4a7.tar.gz glibc-6c0f5cb201a98f9a6c150e10797819356821c4a7.tar.bz2 glibc-6c0f5cb201a98f9a6c150e10797819356821c4a7.zip |
nss: Fix tst-nss-files-hosts-long on single-stack hosts (bug 24816)
getent implicitly passes AI_ADDRCONFIG to getaddrinfo by default.
Use --no-addrconfig to suppress that, so that both IPv4 and IPv6
lookups succeed even if the address family is not supported by the
host.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit c75d20b5b27b0a60f0678236f51a4d3b0b058c00)
(cherry picked from commit 135c29bf9cda370a909bc3d17711c85564ba3913)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | nss/tst-nss-files-hosts-long.c | 9 |
2 files changed, 6 insertions, 4 deletions
@@ -22,6 +22,7 @@ Major new features: The following bugs are resolved with this release: [12154] Do not fail DNS resolution for CNAMEs which are not host names + [24816] Fix tst-nss-files-hosts-long on single-stack hosts [25812] Libio vtable protection is sometimes only partially enforced [28838] FAIL: elf/tst-p_align3 [28846] CMSG_NXTHDR may trigger -Wstrict-overflow warning diff --git a/nss/tst-nss-files-hosts-long.c b/nss/tst-nss-files-hosts-long.c index 3942cf5fca..a7697e3143 100644 --- a/nss/tst-nss-files-hosts-long.c +++ b/nss/tst-nss-files-hosts-long.c @@ -28,14 +28,15 @@ do_test (void) { int ret; - /* Run getent to fetch the IPv4 address for host test4. - This forces /etc/hosts to be parsed. */ - ret = system("getent ahostsv4 test4"); + /* Run getent to fetch the IPv4 address for host test4. This forces + /etc/hosts to be parsed. Use --no-addrconfig to return addresses + even in an IPv6-only environment. */ + ret = system("getent --no-addrconfig ahostsv4 test4"); if (ret != 0) FAIL_EXIT1("ahostsv4 failed"); /* Likewise for IPv6. */ - ret = system("getent ahostsv6 test6"); + ret = system("getent --no-addrconfig ahostsv6 test6"); if (ret != 0) FAIL_EXIT1("ahostsv6 failed"); |