From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104455 invoked by alias); 4 Sep 2017 17:35:55 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 103926 invoked by uid 89); 4 Sep 2017 17:35:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Sep 2017 17:35:50 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65BCFC00F5C3 for ; Mon, 4 Sep 2017 17:35:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 65BCFC00F5C3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer@redhat.com Received: from oldenburg.str.redhat.com (ovpn-116-109.ams2.redhat.com [10.36.116.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3328481543 for ; Mon, 4 Sep 2017 17:35:49 +0000 (UTC) Received: by oldenburg.str.redhat.com (Postfix, from userid 1000) id 6F315439942E3; Mon, 4 Sep 2017 19:35:48 +0200 (CEST) Date: Sun, 01 Jan 2017 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.26 COMMITTED] getaddrinfo: In gaih_inet, use h_errno for certain status values only User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20170904173548.6F315439942E3@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 04 Sep 2017 17:35:49 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00008.txt.bz2 h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be accurate at this point. (cherry picked from commit a2881ef01450295782b065f2f850f340d5c12c14) 2017-09-01 Florian Weimer * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if status indicates it is set. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index eaf8bafcf4..9d9e7e2bf2 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -949,7 +949,10 @@ gaih_inet (const char *name, const struct gaih_service *service, __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); __resolv_context_put (res_ctx); - if (h_errno == NETDB_INTERNAL) + /* If we have a failure which sets errno, report it using + EAI_SYSTEM. */ + if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL) + && h_errno == NETDB_INTERNAL) { result = -EAI_SYSTEM; goto free_and_return;