From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 83F773858034; Thu, 13 Oct 2022 13:08:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83F773858034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665666505; bh=6tb1bNmZ0fuT4KOXRVF+S234vVUutX7I7Mk/1RqmEFs=; h=From:To:Subject:Date:From; b=IAB8+qvnraxiF+V4WRvJXU0PbIdyG+Vo0dbWjdo0iffJvRF0TapuyVxLzdqA95kCn G7cgG02QSfMx0KKvG3WCcvoxG0mk+Ns1P3oNoyYz7UmpYvvUm0W2KtQBazf4Vs0zQV nrI4VsGdWnam4oEmx70TAa73KP4UQB+3Xrkdj7Kk= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.36/master] nss: Fix tst-nss-files-hosts-long on single-stack hosts (bug 24816) X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/release/2.36/master X-Git-Oldrev: 700d3281f9e57b53c27bc991394b22d467432626 X-Git-Newrev: 2681d38cafaceafeb330bc0536fa710b75ed5947 Message-Id: <20221013130825.83F773858034@sourceware.org> Date: Thu, 13 Oct 2022 13:08:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2681d38cafaceafeb330bc0536fa710b75ed5947 commit 2681d38cafaceafeb330bc0536fa710b75ed5947 Author: Florian Weimer Date: Tue Sep 13 16:11:40 2022 +0200 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 (cherry picked from commit c75d20b5b27b0a60f0678236f51a4d3b0b058c00) Diff: --- NEWS | 1 + nss/tst-nss-files-hosts-long.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 462a12253d..de775ab116 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ Security related changes: 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 [28846] CMSG_NXTHDR may trigger -Wstrict-overflow warning [29305] Conserve NSS buffer space during DNS packet parsing [29415] nscd: Fix netlink cache invalidation if epoll is used 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");