From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32301 invoked by alias); 25 Feb 2008 15:40:41 -0000 Received: (qmail 32074 invoked by uid 48); 25 Feb 2008 15:39:56 -0000 Date: Mon, 25 Feb 2008 15:40:00 -0000 Message-ID: <20080225153956.32073.qmail@sourceware.org> From: "jakub at redhat dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20080225141520.5790.leolistas@solutti.com.br> References: <20080225141520.5790.leolistas@solutti.com.br> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/5790] strange behavior of getnameinfo on multiple PTR records X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00109.txt.bz2 ------- Additional Comments From jakub at redhat dot com 2008-02-25 15:39 ------- The problem seems to be in resolv/nss_dns/dns-host.c. The initial buffer is too small (1024 bytes), and getanswer_r will do: /* The buffer is too small. */ too_small: *errnop = ERANGE; *h_errnop = NETDB_INTERNAL; return NSS_STATUS_TRYAGAIN; Which is the right thing that getnameinfo eventually expects: while (__gethostbyaddr_r ((const char *) &in_addr, sizeof (struct in_addr), AF_INET, &th, tmpbuf, tmpbuflen, &h, &herror)) { if (herror == NETDB_INTERNAL && errno == ERANGE) tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); else break; } But, unlike _nss_dns_gethostbyname*_r, _nss_dns_gethostbyaddr*_r will overwrite all the values: status = getanswer_r (host_buffer.buf, n, qbuf, T_PTR, result, buffer, buflen, errnop, h_errnop, 0 /* XXX */, ttlp, NULL); if (host_buffer.buf != orig_host_buffer) free (host_buffer.buf); if (status != NSS_STATUS_SUCCESS) { *h_errnop = h_errno; *errnop = errno; return status; } I guess nuking the *h_errnop = h_errno; *errnop = errno; could fix this. -- http://sourceware.org/bugzilla/show_bug.cgi?id=5790 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.