diff options
author | Jeff Law <law@redhat.com> | 2012-03-28 10:09:29 -0600 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2012-03-28 10:09:29 -0600 |
commit | 86ae07a8c9e8e26806f7b8dedf57e7b14a308c69 (patch) | |
tree | 6db3d9b928db3a345d47c3e52ca49519d474ea81 /resolv | |
parent | d6270972f79fe89a96fa7a3909991dad2e317033 (diff) | |
download | glibc-86ae07a8c9e8e26806f7b8dedf57e7b14a308c69.zip glibc-86ae07a8c9e8e26806f7b8dedf57e7b14a308c69.tar.gz glibc-86ae07a8c9e8e26806f7b8dedf57e7b14a308c69.tar.bz2 |
[BZ #13760]
* resolv/nss_dns/dns-host.c (gaih_getanswer): Look for errno
in the right place. Discard and retry query if response is
larger than input buffer size.
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 01369f6..10aecb8 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -1219,7 +1219,13 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2, &first); if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND || (status == NSS_STATUS_TRYAGAIN - && (errno != ERANGE || *h_errnop != NO_RECOVERY))) + /* We want to look at the second answer in case of an + NSS_STATUS_TRYAGAIN only if the error is non-recoverable, i.e. + *h_errnop is NO_RECOVERY. If not, and if the failure was due to + an insufficient buffer (ERANGE), then we need to drop the results + and pass on the NSS_STATUS_TRYAGAIN to the caller so that it can + repeat the query with a larger buffer. */ + && (*errnop != ERANGE || *h_errnop == NO_RECOVERY))) && answer2 != NULL && anslen2 > 0) { enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname, |