diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2012-06-20 02:28:31 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2012-06-20 02:28:31 +0200 |
commit | 0138137f1ccea480fe31cea3b63a81f96daeeaa7 (patch) | |
tree | ffd88f1e805cd98152828c1598fc3255b3d22a9e /resolv | |
parent | 27fbc2008d4df23885d10f0877caf62ae2c22bb4 (diff) | |
parent | dc665715841aea049480d9f75ace426419db1f8e (diff) |
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts:
configure
configure.in
hurd/Makefile
nptl/sysdeps/pthread/bits/libc-lock.h
sysdeps/i386/configure
sysdeps/powerpc/powerpc32/configure
sysdeps/powerpc/powerpc64/configure
sysdeps/unix/sysv/linux/configure
sysdeps/unix/sysv/linux/configure.in
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/Makefile | 6 | ||||
-rw-r--r-- | resolv/gai_misc.c | 4 | ||||
-rw-r--r-- | resolv/nss_dns/dns-host.c | 8 | ||||
-rw-r--r-- | resolv/res_query.c | 10 |
4 files changed, 19 insertions, 9 deletions
diff --git a/resolv/Makefile b/resolv/Makefile index 1c7b491cf4..4777317b17 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -25,8 +25,6 @@ headers := resolv.h \ netdb.h bits/netdb.h \ arpa/nameser.h arpa/nameser_compat.h \ sys/bitypes.h -distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \ - Banner res_hconf.h res_debug.h README gai_misc.h ga_test.c routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \ res_hconf res_libc res-state @@ -57,8 +55,10 @@ subdir-dirs = nss_dns vpath %.c nss_dns libnss_dns-routines := dns-host dns-network dns-canon -ifneq ($(build-static-nss),yes) libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes)) +ifeq ($(build-static-nss),yes) +routines += $(libnss_dns-routines) $(libresolv-routines) +static-only-routines += $(libnss_dns-routines) $(libresolv-routines) endif ifeq (yesyes,$(build-shared)$(have-thread-library)) diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c index 33ebd54255..35f1133e69 100644 --- a/resolv/gai_misc.c +++ b/resolv/gai_misc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2001. @@ -364,7 +364,7 @@ handle_requests (void *arg) gettimeofday (&now, NULL); wakeup_time.tv_sec = now.tv_sec + optim.gai_idle_time; wakeup_time.tv_nsec = now.tv_usec * 1000; - if (wakeup_time.tv_nsec > 1000000000) + if (wakeup_time.tv_nsec >= 1000000000) { wakeup_time.tv_nsec -= 1000000000; ++wakeup_time.tv_sec; diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 01369f6076..10aecb8604 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, diff --git a/resolv/res_query.c b/resolv/res_query.c index 947c6513a2..abccd4a921 100644 --- a/resolv/res_query.c +++ b/resolv/res_query.c @@ -556,12 +556,16 @@ __libc_res_nquerydomain(res_state statp, * copy without '.' if present. */ n = strlen(name); - if (n >= MAXDNAME) { + + /* Decrement N prior to checking it against MAXDNAME + so that we detect a wrap to SIZE_MAX and return + a reasonable error. */ + n--; + if (n >= MAXDNAME - 1) { RES_SET_H_ERRNO(statp, NO_RECOVERY); return (-1); } - n--; - if (n >= 0 && name[n] == '.') { + if (name[n] == '.') { strncpy(nbuf, name, n); nbuf[n] = '\0'; } else |