From 6c8226d7d6bb16d3d0bc2ab68a30b0700011c64f Mon Sep 17 00:00:00 2001 From: dougb Date: Tue, 23 Dec 2008 18:35:21 +0000 Subject: Vendor import of BIND 9.4.3 --- lib/bind/api | 6 +- lib/bind/bsd/Makefile.in | 8 +- lib/bind/bsd/strerror.c | 6 +- lib/bind/bsd/strtoul.c | 10 +- lib/bind/configure.in | 217 ++++++++++++++++++++++++++++++++++--- lib/bind/dst/Makefile.in | 8 +- lib/bind/dst/dst_api.c | 2 +- lib/bind/dst/hmac_link.c | 2 +- lib/bind/dst/support.c | 2 +- lib/bind/include/Makefile.in | 8 +- lib/bind/include/arpa/nameser.h | 5 +- lib/bind/include/isc/assertions.h | 7 +- lib/bind/include/isc/eventlib.h | 4 +- lib/bind/include/isc/misc.h | 3 +- lib/bind/include/isc/platform.h.in | 36 ++++++ lib/bind/include/netdb.h | 4 +- lib/bind/include/resolv.h | 6 +- lib/bind/inet/Makefile.in | 8 +- lib/bind/inet/inet_net_pton.c | 6 +- lib/bind/inet/inet_network.c | 4 +- lib/bind/irs/Makefile.in | 8 +- lib/bind/irs/dns_ho.c | 11 +- lib/bind/irs/getnetgrent.c | 6 +- lib/bind/irs/getnetgrent_r.c | 81 ++++++++++---- lib/bind/irs/irp.c | 5 +- lib/bind/isc/Makefile.in | 8 +- lib/bind/isc/assertions.c | 3 +- lib/bind/isc/bitncmp.c | 4 +- lib/bind/isc/ctl_clnt.c | 5 +- lib/bind/isc/ctl_srvr.c | 5 +- lib/bind/isc/logging.c | 12 +- lib/bind/nameser/Makefile.in | 8 +- lib/bind/port_after.h.in | 114 +++++++++++++++++-- lib/bind/port_before.h.in | 13 ++- lib/bind/resolv/Makefile.in | 8 +- lib/bind/resolv/res_debug.c | 55 +++++++++- lib/bind/resolv/res_mkquery.c | 66 +++++++++-- lib/bind/resolv/res_query.c | 14 ++- lib/bind/resolv/res_send.c | 28 +++-- 39 files changed, 653 insertions(+), 153 deletions(-) create mode 100644 lib/bind/include/isc/platform.h.in (limited to 'lib/bind') diff --git a/lib/bind/api b/lib/bind/api index a87852a..7ffeba8 100644 --- a/lib/bind/api +++ b/lib/bind/api @@ -1,3 +1,3 @@ -LIBINTERFACE = 4 -LIBREVISION = 10 -LIBAGE = 0 +LIBINTERFACE = 5 +LIBREVISION = 2 +LIBAGE = 1 diff --git a/lib/bind/bsd/Makefile.in b/lib/bind/bsd/Makefile.in index cf70c10..72a52f6 100644 --- a/lib/bind/bsd/Makefile.in +++ b/lib/bind/bsd/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.7 2004/03/05 05:05:07 marka Exp $ +# $Id: Makefile.in,v 1.7.18.2 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -34,6 +34,6 @@ SRCS= daemon.c ftruncate.c gettimeofday.c mktemp.c putenv.c \ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include @BIND9_MAKE_RULES@ diff --git a/lib/bind/bsd/strerror.c b/lib/bind/bsd/strerror.c index 5743398..325cd52 100644 --- a/lib/bind/bsd/strerror.c +++ b/lib/bind/bsd/strerror.c @@ -1,6 +1,6 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: strerror.c,v 1.4.332.1 2005/04/27 05:00:46 sra Exp $"; +static const char rcsid[] = "$Id: strerror.c,v 1.4.332.2 2008/02/18 04:04:06 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -60,12 +60,14 @@ isc_strerror(int num) { static char ebuf[40] = UPREFIX; /*%< 64-bit number + slop */ u_int errnum; char *p, *t; +#ifndef USE_SYSERROR_LIST const char *ret; +#endif char tmp[40]; errnum = num; /*%< convert to unsigned */ #ifdef USE_SYSERROR_LIST - if (errnum < sys_nerr) + if (errnum < (u_int)sys_nerr) return (sys_errlist[errnum]); #else #undef strerror diff --git a/lib/bind/bsd/strtoul.c b/lib/bind/bsd/strtoul.c index f419227..c2efeda 100644 --- a/lib/bind/bsd/strtoul.c +++ b/lib/bind/bsd/strtoul.c @@ -1,6 +1,6 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: strtoul.c,v 1.2.164.1 2005/04/27 05:00:47 sra Exp $"; +static const char rcsid[] = "$Id: strtoul.c,v 1.2.164.2 2008/02/18 04:04:06 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -70,7 +70,7 @@ strtoul(const char *nptr, char **endptr, int base) { * See strtol for comments as to the logic used. */ do { - c = *(unsigned char *)s++; + c = *(const unsigned char *)s++; } while (isspace(c)); if (c == '-') { neg = 1; @@ -87,7 +87,7 @@ strtoul(const char *nptr, char **endptr, int base) { base = c == '0' ? 8 : 10; cutoff = (u_long)ULONG_MAX / (u_long)base; cutlim = (u_long)ULONG_MAX % (u_long)base; - for (acc = 0, any = 0;; c = *(unsigned char*)s++) { + for (acc = 0, any = 0;; c = *(const unsigned char*)s++) { if (isdigit(c)) c -= '0'; else if (isalpha(c)) @@ -96,7 +96,7 @@ strtoul(const char *nptr, char **endptr, int base) { break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -110,7 +110,7 @@ strtoul(const char *nptr, char **endptr, int base) { } else if (neg) acc = -acc; if (endptr != 0) - *endptr = (char *)(any ? s - 1 : nptr); + DE_CONST((any ? s - 1 : nptr), *endptr); return (acc); } diff --git a/lib/bind/configure.in b/lib/bind/configure.in index 6e98c5c..9b9b53b 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -AC_REVISION($Revision: 1.90.18.34.10.2 $) +AC_REVISION($Revision: 1.90.18.43 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -169,7 +169,7 @@ AC_PROG_CC AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/timers.h stropts.h) +AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/timers.h stropts.h memory.h) AC_C_CONST AC_C_INLINE @@ -461,6 +461,7 @@ AC_SUBST(WANT_THREADS_OBJS) AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT)) AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE)) AC_CHECK_FUNC(memchr, AC_DEFINE(HAVE_MEMCHR)) +AC_CHECK_FUNC(strtoul, , AC_DEFINE(NEED_STRTOUL)) AC_CHECK_FUNC(if_nametoindex, [USE_IFNAMELINKID="#define USE_IFNAMELINKID 1"], @@ -490,6 +491,16 @@ AC_CHECK_FUNC(strerror, [NEED_STRERROR="#undef NEED_STRERROR"], [NEED_STRERROR="#define NEED_STRERROR 1"]) AC_SUBST(NEED_STRERROR) +if test -n "$NEED_STRERROR" +then + AC_MSG_CHECKING([for extern char * sys_errlist[]]) + AC_TRY_LINK([ extern int sys_nerr; extern char *sys_errlist[]; ], + [ const char *p = sys_errlist[0]; ], + AC_MSG_RESULT(yes) + AC_DEFINE(USE_SYSERROR_LIST), + AC_MSG_RESULT(no)) +fi + # # flockfile is usually provided by pthreads, but we may want to use it # even if compiled with --disable-threads. @@ -666,6 +677,14 @@ AC_SUBST(PURIFY) # # GNU libtool support # +case $host in +sunos*) + # Just set the maximum command line length for sunos as it otherwise + # takes a exceptionally long time to work it out. Required for libtool. + lt_cv_sys_max_cmd_len=4096; + ;; +esac + AC_ARG_WITH(libtool, [ --with-libtool use GNU libtool (following indented options supported)], use_libtool="$withval", use_libtool="no") @@ -976,6 +995,8 @@ AC_SUBST(ISC_PLATFORM_NEEDATON) # case "$host" in *-dec-osf*) + # Tru64 broke send() by defining it to send_OBSOLETE + AC_DEFINE(REENABLE_SEND) # Turn on 4.4BSD style sa_len support. AC_DEFINE(_SOCKADDR_LEN) ;; @@ -1050,6 +1071,7 @@ case "$host" in *-qnx*) PORT_DIR="port/qnx";; *-rhapsody*) PORT_DIR="port/rhapsody";; *-sunos4*) + AC_DEFINE(NEED_SUN4PROTOS) PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY" PORT_DIR="port/sunos";; *-solaris2.[[01234]]) @@ -1246,6 +1268,38 @@ found_rt_iflist AC_CHECK_FUNC(strsep, [ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"], [ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"]) + + +AC_MSG_CHECKING(for char *sprintf) +AC_TRY_COMPILE([ +#include +], +[ char buf[2]; return(*sprintf(buf,"x"));], +AC_DEFINE(SPRINTF_CHAR) +AC_MSG_RESULT(yes) +, +AC_MSG_RESULT(no) +) + +AC_MSG_CHECKING(for char *vsprintf) +case $host in +*sunos4*) # not decared in any header file. +AC_DEFINE(VSPRINTF_CHAR) +AC_MSG_RESULT(yes) +;; +*) +AC_TRY_COMPILE([ +#include +], +[ char buf[2]; return(*vsprintf(buf,"x"));], +AC_DEFINE(VSPRINTF_CHAR) +AC_MSG_RESULT(yes) +, +AC_MSG_RESULT(no) +) +;; +esac + AC_CHECK_FUNC(vsnprintf, [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"], [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O" @@ -1256,12 +1310,7 @@ AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF) AC_SUBST(ISC_EXTRA_OBJS) AC_SUBST(ISC_EXTRA_SRCS) -AC_CHECK_FUNC(strerror, - [USE_SYSERROR_LIST="#undef USE_SYSERROR_LIST"], - [USE_SYSERROR_LIST="#define USE_SYSERROR_LIST 1"]) -AC_SUBST(USE_SYSERROR_LIST) -# # Determine the printf format characters to use when printing # values of type isc_int64_t. We make the assumption that platforms # where a "long long" is the same size as a "long" (e.g., Alpha/OSF1) @@ -1865,19 +1914,37 @@ AC_SUBST(SETGRENT_VOID) case $host in ia64-hp-hpux11.*) +NGR_R_CONST="#define NGR_R_CONST" ;; +*-hp-hpux11.*) +# +# HPUX doesn't have a prototype for getnetgrent_r(). +# +NGR_R_CONST="#define NGR_R_CONST" +NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen" +NGR_R_BAD="#define NGR_R_BAD (0)" +NGR_R_COPY="#define NGR_R_COPY buf, buflen" +NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS" +NGR_R_OK="#define NGR_R_OK 1" +NGR_R_RETURN="#define NGR_R_RETURN int" +;; + *) AC_CHECK_FUNC(getnetgrent_r, AC_TRY_COMPILE( [ #undef __USE_MISC #define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT #include +#include int getnetgrent_r(char **m, char **u, char **d, char *b, int l) {} ] , [return (0);], [ +NGR_R_CONST="#define NGR_R_CONST" NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen" NGR_R_BAD="#define NGR_R_BAD (0)" NGR_R_COPY="#define NGR_R_COPY buf, buflen" @@ -1890,12 +1957,16 @@ AC_TRY_COMPILE( [ #undef __USE_MISC #define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT #include +#include int getnetgrent_r(char **m, char **u, char **d, char *b, size_t l) {} ] , [return (0);], [ +NGR_R_CONST="#define NGR_R_CONST" NGR_R_ARGS="#define NGR_R_ARGS char *buf, size_t buflen" NGR_R_BAD="#define NGR_R_BAD (0)" NGR_R_COPY="#define NGR_R_COPY buf, buflen" @@ -1908,12 +1979,16 @@ AC_TRY_COMPILE( [ #undef __USE_MISC #define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT #include -extern int getnetgrent_r( char **, char **, char **, void **); +#include +extern int getnetgrent_r(char **, char **, char **, void **); ] , [return (0);], [ +NGR_R_CONST="#define NGR_R_CONST" NGR_R_ARGS="#define NGR_R_ARGS void **buf" NGR_R_BAD="#define NGR_R_BAD (0)" NGR_R_COPY="#define NGR_R_COPY buf" @@ -1923,10 +1998,35 @@ NGR_R_RETURN="#define NGR_R_RETURN int" NGR_R_PRIVATE="#define NGR_R_PRIVATE 1" ] , +AC_TRY_COMPILE( +[ +#undef __USE_MISC +#define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT +#include +#include +extern int getnetgrent_r(const char **, const char **, const char **, void *); +] +, +[return (0);], +[ +NGR_R_CONST="#define NGR_R_CONST const" +NGR_R_ARGS="#define NGR_R_ARGS void *buf" +NGR_R_BAD="#define NGR_R_BAD (0)" +NGR_R_COPY="#define NGR_R_COPY buf" +NGR_R_COPY_ARGS="#define NGR_R_COPY_ARGS NGR_R_ARGS" +NGR_R_OK="#define NGR_R_OK 1" +NGR_R_RETURN="#define NGR_R_RETURN int" +NGR_R_PRIVATE="#define NGR_R_PRIVATE 2" +] +, +) ) ) ) , +NGR_R_CONST="#define NGR_R_CONST" NGR_R_ARGS="#define NGR_R_ARGS char *buf, int buflen" NGR_R_BAD="#define NGR_R_BAD (0)" NGR_R_COPY="#define NGR_R_COPY buf, buflen" @@ -1935,6 +2035,7 @@ NGR_R_OK="#define NGR_R_OK 1" NGR_R_RETURN="#define NGR_R_RETURN int" ) esac +AC_SUBST(NGR_R_CONST) AC_SUBST(NGR_R_ARGS) AC_SUBST(NGR_R_BAD) AC_SUBST(NGR_R_COPY) @@ -1948,7 +2049,10 @@ AC_TRY_COMPILE( [ #undef __USE_MISC #define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT #include +#include void endnetgrent_r(void **ptr); ] , @@ -1957,44 +2061,128 @@ void endnetgrent_r(void **ptr); [ NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) /* empty */" NGR_R_END_RETURN="#define NGR_R_END_RETURN void" -NGR_R_ENT_ARGS="#define NGR_R_ENT_ARGS NGR_R_ARGS" +NGR_R_END_ARGS="#define NGR_R_END_ARGS NGR_R_ARGS" +] +, +AC_TRY_COMPILE( +[ +#undef __USE_MISC +#define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT +#include +#include +void endnetgrent_r(void *ptr); +] +, +[return (0);] +, +[ +NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) /* empty */" +NGR_R_END_RETURN="#define NGR_R_END_RETURN void" +NGR_R_END_ARGS="#define NGR_R_END_ARGS void *buf" ] , [ NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) return (x)" NGR_R_END_RETURN="#define NGR_R_END_RETURN int" -NGR_R_ENT_ARGS="#define NGR_R_ENT_ARGS NGR_R_ARGS" +NGR_R_END_ARGS="#define NGR_R_END_ARGS NGR_R_ARGS" ] ) +) , NGR_R_END_RESULT="#define NGR_R_END_RESULT(x) /*empty*/" NGR_R_END_RETURN="#define NGR_R_END_RETURN void" -NGR_R_ENT_ARGS="#undef NGR_R_ENT_ARGS /*empty*/" +NGR_R_END_ARGS="#undef NGR_R_END_ARGS /*empty*/" AC_DEFINE(NEED_ENDNETGRENT_R) ) AC_SUBST(NGR_R_END_RESULT) AC_SUBST(NGR_R_END_RETURN) -AC_SUBST(NGR_R_ENT_ARGS) +AC_SUBST(NGR_R_END_ARGS) AC_CHECK_FUNC(setnetgrent_r, [ case "$host" in *bsdi*) + # + # No prototype + # NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/" NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void" + NGR_R_SET_ARGS="#define NGR_R_SET_ARGS NGR_R_ARGS" + NGR_R_SET_CONST="#define NGR_R_SET_CONST" ;; -*) +*hpux*) + # + # No prototype + # NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK" NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int" + NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS /* empty */" + NGR_R_SET_CONST="#define NGR_R_SET_CONST" ;; +*) +AC_TRY_COMPILE( +[ +#undef __USE_MISC +#define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT +#include +#include +void setnetgrent_r(void **ptr); +] +, +[return (0);] +, +[ +NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /* empty */" +NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void" +NGR_R_SET_ARGS="#define NGR_R_SET_ARGS void **buf" +NGR_R_SET_CONST="#define NGR_R_SET_CONST" +] +, +AC_TRY_COMPILE( +[ +#undef __USE_MISC +#define __USE_MISC +#undef _REEENTRANT +#define _REEENTRANT +#include +#include +extern int setnetgrent_r(char *, void **); +] +, +[return (0);] +, +[ +NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK" +NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int" +NGR_R_SET_ARGS="#define NGR_R_SET_ARGS void **buf" +NGR_R_SET_CONST="#define NGR_R_SET_CONST" +] +, +[ +NGR_R_SET_RESULT="#define NGR_R_SET_RESULT NGR_R_OK" +NGR_R_SET_RETURN="#define NGR_R_SET_RETURN int" +NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS" +NGR_R_SET_CONST="#define NGR_R_SET_CONST const" +] +)) +;; esac ] , NGR_R_SET_RESULT="#undef NGR_R_SET_RESULT /*empty*/" NGR_R_SET_RETURN="#define NGR_R_SET_RETURN void" +NGR_R_SET_ARGS="#undef NGR_R_SET_ARGS" +NGR_R_SET_CONST="#define NGR_R_SET_CONST const" ) + AC_SUBST(NGR_R_SET_RESULT) AC_SUBST(NGR_R_SET_RETURN) +AC_SUBST(NGR_R_SET_ARGS) +AC_SUBST(NGR_R_SET_CONST) AC_CHECK_FUNC(innetgr_r,,AC_DEFINE(NEED_INNETGR_R)) @@ -2590,7 +2778,7 @@ case "$host" in *-solaris2.9) hack_shutup_in6addr_init_macros=yes ;; - *-solaris2.1[0-9]) + *-solaris2.1[[0-9]]) hack_shutup_in6addr_init_macros=yes ;; esac @@ -2675,6 +2863,7 @@ AC_OUTPUT( port/Makefile ${PORT_DIR}/Makefile ${PORT_INCLUDE}/Makefile + include/isc/platform.h ) # Tell Emacs to edit this file in shell mode. diff --git a/lib/bind/dst/Makefile.in b/lib/bind/dst/Makefile.in index c802840..a841d49 100644 --- a/lib/bind/dst/Makefile.in +++ b/lib/bind/dst/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.6 2004/03/05 05:05:09 marka Exp $ +# $Id: Makefile.in,v 1.6.18.2 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -26,7 +26,7 @@ TARGETS= ${OBJS} CRYPTFLAGS= -DCYLINK_DSS -DHMAC_MD5 -DUSE_MD5 -DDNSSAFE -CINCLUDES= -I.. -I${srcdir}/../include ${CRYPTINCL} +CINCLUDES= -I.. -I../include -I${srcdir}/../include ${CRYPTINCL} CDEFINES= ${CRYPTFLAGS} @BIND9_MAKE_RULES@ diff --git a/lib/bind/dst/dst_api.c b/lib/bind/dst/dst_api.c index a622ae3..5bcd80a 100644 --- a/lib/bind/dst/dst_api.c +++ b/lib/bind/dst/dst_api.c @@ -1,5 +1,5 @@ #ifndef LINT -static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/dst_api.c,v 1.10.332.7 2007/09/26 04:41:47 each Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/Attic/dst_api.c,v 1.10.332.7 2007/09/26 04:41:47 each Exp $"; #endif /* diff --git a/lib/bind/dst/hmac_link.c b/lib/bind/dst/hmac_link.c index b97a996..cbd68f4 100644 --- a/lib/bind/dst/hmac_link.c +++ b/lib/bind/dst/hmac_link.c @@ -1,6 +1,6 @@ #ifdef HMAC_MD5 #ifndef LINT -static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/hmac_link.c,v 1.3.164.5 2007/09/26 04:41:47 each Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.3.164.5 2007/09/26 04:41:47 each Exp $"; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/lib/bind/dst/support.c b/lib/bind/dst/support.c index ec228d0..263f957 100644 --- a/lib/bind/dst/support.c +++ b/lib/bind/dst/support.c @@ -1,4 +1,4 @@ -static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/support.c,v 1.3.332.3 2005/10/11 00:25:09 marka Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/prod/bind9/lib/bind/dst/Attic/support.c,v 1.3.332.3 2005/10/11 00:25:09 marka Exp $"; /* diff --git a/lib/bind/include/Makefile.in b/lib/bind/include/Makefile.in index d07ea7a..17a69bf 100644 --- a/lib/bind/include/Makefile.in +++ b/lib/bind/include/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.4 2004/03/05 05:05:11 marka Exp $ +# $Id: Makefile.in,v 1.4.18.2 2008/01/23 02:15:02 tbox Exp $ srcdir = @srcdir@ VPATH = @srcdir@ @@ -24,7 +24,7 @@ HEADERS=fd_setsize.h hesiod.h irp.h irs.h netdb.h netgroup.h res_update.h \ AHEADERS= arpa/inet.h arpa/nameser.h arpa/nameser_compat.h IHEADERS= isc/assertions.h isc/ctl.h isc/dst.h isc/eventlib.h isc/heap.h \ isc/irpmarshall.h isc/list.h isc/logging.h isc/memcluster.h \ - isc/misc.h isc/tree.h + isc/misc.h isc/tree.h isc/platform.h.in all: diff --git a/lib/bind/include/arpa/nameser.h b/lib/bind/include/arpa/nameser.h index b3a7849..8f8d8a7 100644 --- a/lib/bind/include/arpa/nameser.h +++ b/lib/bind/include/arpa/nameser.h @@ -49,7 +49,7 @@ */ /* - * $Id: nameser.h,v 1.7.18.1 2005/04/27 05:00:50 sra Exp $ + * $Id: nameser.h,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $ */ #ifndef _ARPA_NAMESER_H_ @@ -427,9 +427,10 @@ typedef enum __ns_cert_types { #define NS_NXT_MAX 127 /*% - * EDNS0 extended flags, host order. + * EDNS0 extended flags and option codes, host order. */ #define NS_OPT_DNSSEC_OK 0x8000U +#define NS_OPT_NSID 3 /*% * Inline versions of get/put short/long. Pointer is advanced. diff --git a/lib/bind/include/isc/assertions.h b/lib/bind/include/isc/assertions.h index 2ed768d..100e586 100644 --- a/lib/bind/include/isc/assertions.h +++ b/lib/bind/include/isc/assertions.h @@ -16,7 +16,7 @@ */ /* - * $Id: assertions.h,v 1.2.18.1 2005/04/27 05:00:50 sra Exp $ + * $Id: assertions.h,v 1.2.18.2 2008/10/15 03:57:21 marka Exp $ */ #ifndef ASSERTIONS_H @@ -29,18 +29,19 @@ typedef enum { typedef void (*assertion_failure_callback)(const char *, int, assertion_type, const char *, int); +/* coverity[+kill] */ extern assertion_failure_callback __assertion_failed; void set_assertion_failure_callback(assertion_failure_callback f); const char *assertion_type_to_text(assertion_type type); -#ifdef CHECK_ALL +#if defined(CHECK_ALL) || defined(__COVERITY__) #define CHECK_REQUIRE 1 #define CHECK_ENSURE 1 #define CHECK_INSIST 1 #define CHECK_INVARIANT 1 #endif -#ifdef CHECK_NONE +#if defined(CHECK_NONE) && !defined(__COVERITY__) #define CHECK_REQUIRE 0 #define CHECK_ENSURE 0 #define CHECK_INSIST 0 diff --git a/lib/bind/include/isc/eventlib.h b/lib/bind/include/isc/eventlib.h index 598c71c..5003823 100644 --- a/lib/bind/include/isc/eventlib.h +++ b/lib/bind/include/isc/eventlib.h @@ -18,7 +18,7 @@ /* eventlib.h - exported interfaces for eventlib * vix 09sep95 [initial] * - * $Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $ + * $Id: eventlib.h,v 1.3.18.3 2008/01/23 02:12:01 marka Exp $ */ #ifndef _EVENTLIB_H @@ -29,6 +29,8 @@ #include #include +#include + #ifndef __P # define __EVENTLIB_P_DEFINED # ifdef __STDC__ diff --git a/lib/bind/include/isc/misc.h b/lib/bind/include/isc/misc.h index d2e98ac..0cd1487 100644 --- a/lib/bind/include/isc/misc.h +++ b/lib/bind/include/isc/misc.h @@ -16,7 +16,7 @@ */ /* - * $Id: misc.h,v 1.4.18.1 2005/04/27 05:00:52 sra Exp $ + * $Id: misc.h,v 1.4.18.2 2008/02/18 04:04:06 marka Exp $ */ #ifndef _ISC_MISC_H @@ -25,6 +25,7 @@ /*! \file */ #include +#include #define bitncmp __bitncmp /*#define isc_movefile __isc_movefile */ diff --git a/lib/bind/include/isc/platform.h.in b/lib/bind/include/isc/platform.h.in new file mode 100644 index 0000000..40ab5d7 --- /dev/null +++ b/lib/bind/include/isc/platform.h.in @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: platform.h.in,v 1.2.6.2 2008/01/23 02:15:02 tbox Exp $ */ + +/*! \file */ + +#ifndef ISC_PLATFORM_H +#define ISC_PLATFORM_H + +/* + * Define if the OS does not define struct timespec. + */ +@ISC_PLATFORM_NEEDTIMESPEC@ +#ifdef ISC_PLATFORM_NEEDTIMESPEC +#include /* For time_t */ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif + +#endif diff --git a/lib/bind/include/netdb.h b/lib/bind/include/netdb.h index 66dd13d..b74c646 100644 --- a/lib/bind/include/netdb.h +++ b/lib/bind/include/netdb.h @@ -86,7 +86,7 @@ /* * @(#)netdb.h 8.1 (Berkeley) 6/2/93 - * $Id: netdb.h,v 1.15.18.6 2006/10/02 01:23:09 marka Exp $ + * $Id: netdb.h,v 1.15.18.7 2008/02/28 05:49:37 marka Exp $ */ #ifndef _NETDB_H_ @@ -481,7 +481,7 @@ int endservent_r __P((struct servent_data *)); void endservent_r __P((struct servent_data *)); #endif #ifdef _AIX -int setnetgrent_r __P((const char *, void **)); +int setnetgrent_r __P((char *, void **)); void endnetgrent_r __P((void **)); /* * Note: AIX's netdb.h declares innetgr_r() as: diff --git a/lib/bind/include/resolv.h b/lib/bind/include/resolv.h index 66d84fc..eebc62e 100644 --- a/lib/bind/include/resolv.h +++ b/lib/bind/include/resolv.h @@ -50,7 +50,7 @@ /*% * @(#)resolv.h 8.1 (Berkeley) 6/2/93 - * $Id: resolv.h,v 1.19.18.3 2005/08/25 04:43:51 marka Exp $ + * $Id: resolv.h,v 1.19.18.4 2008/04/03 23:15:15 marka Exp $ */ #ifndef _RESOLV_H_ @@ -250,6 +250,7 @@ union res_sockaddr_union { #define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */ #define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */ #define RES_BLAST 0x00020000 /*%< blast all recursive servers */ +#define RES_NSID 0x00040000 /*%< request name server ID */ #define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */ #define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */ /* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */ @@ -396,6 +397,7 @@ extern const struct res_sym __p_rcode_syms[]; #define sym_ntos __sym_ntos #define sym_ston __sym_ston #define res_nopt __res_nopt +#define res_nopt_rdata __res_nopt_rdata #define res_ndestroy __res_ndestroy #define res_nametoclass __res_nametoclass #define res_nametotype __res_nametotype @@ -482,6 +484,8 @@ int res_findzonecut2 __P((res_state, const char *, ns_class, int, union res_sockaddr_union *, int)); void res_nclose __P((res_state)); int res_nopt __P((res_state, int, u_char *, int, int)); +int res_nopt_rdata __P((res_state, int, u_char *, int, u_char *, + u_short, u_short, u_char *)); void res_send_setqhook __P((res_send_qhook)); void res_send_setrhook __P((res_send_rhook)); int __res_vinit __P((res_state, int)); diff --git a/lib/bind/inet/Makefile.in b/lib/bind/inet/Makefile.in index 7eb297c..7b84896 100644 --- a/lib/bind/inet/Makefile.in +++ b/lib/bind/inet/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.5 2004/03/05 05:05:13 marka Exp $ +# $Id: Makefile.in,v 1.5.18.2 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -30,6 +30,6 @@ SRCS= inet_addr.c inet_cidr_ntop.c inet_cidr_pton.c inet_data.c \ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include @BIND9_MAKE_RULES@ diff --git a/lib/bind/inet/inet_net_pton.c b/lib/bind/inet/inet_net_pton.c index d3de33b..71a8715 100644 --- a/lib/bind/inet/inet_net_pton.c +++ b/lib/bind/inet/inet_net_pton.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $"; +static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $"; #endif #include "port_before.h" @@ -133,11 +133,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) { INSIST(n >= 0 && n <= 9); bits *= 10; bits += n; + if (bits > 32) + goto enoent; } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); if (ch != '\0') goto enoent; - if (bits > 32) - goto emsgsize; } /* Firey death and destruction unless we prefetched EOS. */ diff --git a/lib/bind/inet/inet_network.c b/lib/bind/inet/inet_network.c index 4758a00..47976cf 100644 --- a/lib/bind/inet/inet_network.c +++ b/lib/bind/inet/inet_network.c @@ -84,9 +84,9 @@ again: } if (!digit) return (INADDR_NONE); + if (pp >= parts + 4 || val > 0xffU) + return (INADDR_NONE); if (*cp == '.') { - if (pp >= parts + 4 || val > 0xffU) - return (INADDR_NONE); *pp++ = val, cp++; goto again; } diff --git a/lib/bind/irs/Makefile.in b/lib/bind/irs/Makefile.in index ce6f5f2..e4f38f7 100644 --- a/lib/bind/irs/Makefile.in +++ b/lib/bind/irs/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.8.18.2 2004/12/07 00:53:48 marka Exp $ +# $Id: Makefile.in,v 1.8.18.4 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -65,6 +65,6 @@ WANT_IRS_THREADSGR_OBJS=getgrent_r.@O@ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include @BIND9_MAKE_RULES@ diff --git a/lib/bind/irs/dns_ho.c b/lib/bind/irs/dns_ho.c index d1d6f5a..db7ff02 100644 --- a/lib/bind/irs/dns_ho.c +++ b/lib/bind/irs/dns_ho.c @@ -52,7 +52,7 @@ /* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: dns_ho.c,v 1.14.18.7 2006/12/07 03:54:24 marka Exp $"; +static const char rcsid[] = "$Id: dns_ho.c,v 1.14.18.8 2008/09/24 05:59:50 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports. */ @@ -958,7 +958,7 @@ gethostans(struct irs_ho *this, } if (m == 0) continue; - if (hap < &pvt->h_addr_ptrs[MAXADDRS-1]) + if (hap < &pvt->h_addr_ptrs[MAXADDRS]) hap++; *hap = NULL; bp += m; @@ -980,9 +980,10 @@ gethostans(struct irs_ho *this, *ap = NULL; *hap = NULL; - if (pvt->res->nsort && haveanswer > 1 && qtype == T_A) + if (pvt->res->nsort && hap != pvt->h_addr_ptrs && + qtype == T_A) addrsort(pvt->res, pvt->h_addr_ptrs, - haveanswer); + hap - pvt->h_addr_ptrs); if (pvt->host.h_name == NULL) { n = strlen(qname) + 1; /*%< for the \\0 */ if (n > (ep - bp) || n >= MAXHOSTNAMELEN) @@ -1049,7 +1050,7 @@ add_hostent(struct pvt *pvt, char *bp, char **hap, struct addrinfo *ai) /* Avoid overflows. */ if (bp + addrlen > &pvt->hostbuf[sizeof(pvt->hostbuf) - 1]) return(-1); - if (hap >= &pvt->h_addr_ptrs[MAXADDRS-1]) + if (hap >= &pvt->h_addr_ptrs[MAXADDRS]) return(0); /*%< fail, but not treat it as an error. */ /* Suppress duplicates. */ for (tap = (const char **)pvt->h_addr_ptrs; diff --git a/lib/bind/irs/getnetgrent.c b/lib/bind/irs/getnetgrent.c index a11fa08..1e6ff9b 100644 --- a/lib/bind/irs/getnetgrent.c +++ b/lib/bind/irs/getnetgrent.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getnetgrent.c,v 1.3.18.1 2005/04/27 05:00:58 sra Exp $"; +static const char rcsid[] = "$Id: getnetgrent.c,v 1.3.18.2 2008/02/27 00:08:30 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports */ @@ -76,7 +76,9 @@ innetgr(INNETGR_ARGS) { } int -getnetgrent(char **host, char **user, char **domain) { +getnetgrent(NGR_R_CONST char **host, NGR_R_CONST char **user, + NGR_R_CONST char **domain) +{ struct net_data *net_data = init(); const char *ch, *cu, *cd; int ret; diff --git a/lib/bind/irs/getnetgrent_r.c b/lib/bind/irs/getnetgrent_r.c index 261d9b7..3ff5542 100644 --- a/lib/bind/irs/getnetgrent_r.c +++ b/lib/bind/irs/getnetgrent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.7.18.4 2005/09/03 12:45:15 marka Exp $"; +static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.7.18.6 2008/02/28 05:49:37 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -33,10 +33,13 @@ static const char rcsid[] = "$Id: getnetgrent_r.c,v 1.7.18.4 2005/09/03 12:45:15 #include #ifdef NGR_R_RETURN +#ifndef NGR_R_PRIVATE +#define NGR_R_PRIVATE 0 +#endif static NGR_R_RETURN -copy_protoent(char **, char **, char **, const char *, const char *, - const char *, NGR_R_COPY_ARGS); +copy_protoent(NGR_R_CONST char **, NGR_R_CONST char **, NGR_R_CONST char **, + const char *, const char *, const char *, NGR_R_COPY_ARGS); NGR_R_RETURN innetgr_r(const char *netgroup, const char *host, const char *user, @@ -58,8 +61,10 @@ innetgr_r(const char *netgroup, const char *host, const char *user, */ NGR_R_RETURN -getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS) { - char *mp, *up, *dp; +getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, + NGR_R_CONST char **domainp, NGR_R_ARGS) +{ + NGR_R_CONST char *mp, *up, *dp; int res = getnetgrent(&mp, &up, &dp); if (res != 1) @@ -69,15 +74,24 @@ getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS) { mp, up, dp, NGR_R_COPY)); } +#if NGR_R_PRIVATE == 2 +struct private { + char *buf; +}; + +#endif NGR_R_SET_RETURN -#ifdef NGR_R_ENT_ARGS -setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS) +#ifdef NGR_R_SET_ARGS +setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS) #else -setnetgrent_r(const char *netgroup) +setnetgrent_r(NGR_R_SET_CONST char *netgroup) #endif { +#if NGR_R_PRIVATE == 2 + struct private *p; +#endif char *tmp; -#if defined(NGR_R_ENT_ARGS) && !defined(NGR_R_PRIVATE) +#if defined(NGR_R_SET_ARGS) && NGR_R_PRIVATE == 0 UNUSED(buf); UNUSED(buflen); #endif @@ -85,8 +99,17 @@ setnetgrent_r(const char *netgroup) DE_CONST(netgroup, tmp); setnetgrent(tmp); -#ifdef NGR_R_PRIVATE +#if NGR_R_PRIVATE == 1 *buf = NULL; +#elif NGR_R_PRIVATE == 2 + *buf = p = malloc(sizeof(struct private)); + if (p == NULL) +#ifdef NGR_R_SET_RESULT + return (NGR_R_BAD); +#else + return; +#endif + p->buf = NULL; #endif #ifdef NGR_R_SET_RESULT return (NGR_R_SET_RESULT); @@ -94,22 +117,29 @@ setnetgrent_r(const char *netgroup) } NGR_R_END_RETURN -#ifdef NGR_R_ENT_ARGS -endnetgrent_r(NGR_R_ENT_ARGS) +#ifdef NGR_R_END_ARGS +endnetgrent_r(NGR_R_END_ARGS) #else endnetgrent_r(void) #endif { -#if defined(NGR_R_ENT_ARGS) && !defined(NGR_R_PRIVATE) +#if NGR_R_PRIVATE == 2 + struct private *p = buf; +#endif +#if defined(NGR_R_SET_ARGS) && NGR_R_PRIVATE == 0 UNUSED(buf); UNUSED(buflen); #endif endnetgrent(); -#ifdef NGR_R_PRIVATE +#if NGR_R_PRIVATE == 1 if (*buf != NULL) free(*buf); *buf = NULL; +#elif NGR_R_PRIVATE == 2 + if (p->buf != NULL) + free(p->buf); + free(p); #endif NGR_R_END_RESULT(NGR_R_OK); } @@ -117,9 +147,13 @@ endnetgrent_r(void) /* Private */ static int -copy_protoent(char **machinep, char **userp, char **domainp, - const char *mp, const char *up, const char *dp, - NGR_R_COPY_ARGS) { +copy_protoent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, + NGR_R_CONST char **domainp, const char *mp, const char *up, + const char *dp, NGR_R_COPY_ARGS) +{ +#if NGR_R_PRIVATE == 2 + struct private *p = buf; +#endif char *cp; int n; int len; @@ -130,12 +164,20 @@ copy_protoent(char **machinep, char **userp, char **domainp, if (up != NULL) len += strlen(up) + 1; if (dp != NULL) len += strlen(dp) + 1; -#ifdef NGR_R_PRIVATE - free(*buf); +#if NGR_R_PRIVATE == 1 + if (*buf != NULL) + free(*buf); *buf = malloc(len); if (*buf == NULL) return(NGR_R_BAD); cp = *buf; +#elif NGR_R_PRIVATE == 2 + if (p->buf) + free(p->buf); + p->buf = malloc(len); + if (p->buf == NULL) + return(NGR_R_BAD); + cp = p->buf; #else if (len > (int)buflen) { errno = ERANGE; @@ -144,7 +186,6 @@ copy_protoent(char **machinep, char **userp, char **domainp, cp = buf; #endif - if (mp != NULL) { n = strlen(mp) + 1; strcpy(cp, mp); diff --git a/lib/bind/irs/irp.c b/lib/bind/irs/irp.c index 85a053d..aae4e7b 100644 --- a/lib/bind/irs/irp.c +++ b/lib/bind/irs/irp.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irp.c,v 1.6.18.3 2006/03/10 00:20:08 marka Exp $"; +static const char rcsid[] = "$Id: irp.c,v 1.6.18.5 2008/02/28 05:49:37 marka Exp $"; #endif /* Imports */ @@ -528,7 +528,8 @@ irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...) { } va_start(ap, fmt); - todo = vsprintf(buffer, fmt, ap); + (void) vsprintf(buffer, fmt, ap); + todo = strlen(buffer); va_end(ap); if (todo > (int)sizeof(buffer) - 3) { syslog(LOG_CRIT, "memory overrun in irs_irp_send_command()"); diff --git a/lib/bind/isc/Makefile.in b/lib/bind/isc/Makefile.in index 3cbb640..70b0548 100644 --- a/lib/bind/isc/Makefile.in +++ b/lib/bind/isc/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.7 2004/03/05 05:05:38 marka Exp $ +# $Id: Makefile.in,v 1.7.18.2 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -30,6 +30,6 @@ SRCS= assertions.c base64.c bitncmp.c ctl_clnt.c ctl_p.c \ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include @BIND9_MAKE_RULES@ diff --git a/lib/bind/isc/assertions.c b/lib/bind/isc/assertions.c index c03464d..e4bd42a 100644 --- a/lib/bind/isc/assertions.c +++ b/lib/bind/isc/assertions.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: assertions.c,v 1.2.18.1 2005/04/27 05:01:05 sra Exp $"; +static const char rcsid[] = "$Id: assertions.c,v 1.2.18.2 2008/10/15 03:57:21 marka Exp $"; #endif #include "port_before.h" @@ -78,6 +78,7 @@ assertion_type_to_text(assertion_type type) { * Private. */ +/* coverity[+kill] */ static void default_assertion_failed(const char *file, int line, assertion_type type, const char *cond, int print_errno) diff --git a/lib/bind/isc/bitncmp.c b/lib/bind/isc/bitncmp.c index 8764db1..9bbbd24 100644 --- a/lib/bind/isc/bitncmp.c +++ b/lib/bind/isc/bitncmp.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: bitncmp.c,v 1.2.18.1 2005/04/27 05:01:05 sra Exp $"; +static const char rcsid[] = "$Id: bitncmp.c,v 1.2.18.2 2008/05/12 00:21:22 marka Exp $"; #endif #include "port_before.h" @@ -48,7 +48,7 @@ bitncmp(const void *l, const void *r, int n) { b = n / 8; x = memcmp(l, r, b); - if (x) + if (x || (n % 8) == 0) return (x); lb = ((const u_char *)l)[b]; diff --git a/lib/bind/isc/ctl_clnt.c b/lib/bind/isc/ctl_clnt.c index eca8e7f..7627200 100644 --- a/lib/bind/isc/ctl_clnt.c +++ b/lib/bind/isc/ctl_clnt.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ctl_clnt.c,v 1.7.18.2 2007/05/18 06:24:39 marka Exp $"; +static const char rcsid[] = "$Id: ctl_clnt.c,v 1.7.18.3 2008/02/18 04:04:06 marka Exp $"; #endif /* not lint */ /* @@ -38,6 +38,9 @@ static const char rcsid[] = "$Id: ctl_clnt.c,v 1.7.18.2 2007/05/18 06:24:39 mark #include #include #include +#ifdef HAVE_MEMORY_H +#include +#endif #include #include diff --git a/lib/bind/isc/ctl_srvr.c b/lib/bind/isc/ctl_srvr.c index 52137c0..1ab3f8a 100644 --- a/lib/bind/isc/ctl_srvr.c +++ b/lib/bind/isc/ctl_srvr.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ctl_srvr.c,v 1.6.18.2 2006/12/07 04:53:02 marka Exp $"; +static const char rcsid[] = "$Id: ctl_srvr.c,v 1.6.18.3 2008/02/18 04:04:06 marka Exp $"; #endif /* not lint */ /* @@ -40,6 +40,9 @@ static const char rcsid[] = "$Id: ctl_srvr.c,v 1.6.18.2 2006/12/07 04:53:02 mark #include #include #include +#ifdef HAVE_MEMORY_H +#include +#endif #include #include diff --git a/lib/bind/isc/logging.c b/lib/bind/isc/logging.c index ca7049c..0cabc4d 100644 --- a/lib/bind/isc/logging.c +++ b/lib/bind/isc/logging.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: logging.c,v 1.6.18.1 2005/04/27 05:01:07 sra Exp $"; +static const char rcsid[] = "$Id: logging.c,v 1.6.18.2 2008/02/28 05:49:37 marka Exp $"; #endif /* not lint */ #include "port_before.h" @@ -43,12 +43,6 @@ static const char rcsid[] = "$Id: logging.c,v 1.6.18.1 2005/04/27 05:01:07 sra E #include "port_after.h" -#ifdef VSPRINTF_CHAR -# define VSPRINTF(x) strlen(vsprintf/**/x) -#else -# define VSPRINTF(x) ((size_t)vsprintf x) -#endif - #include "logging_p.h" static const int syslog_priority[] = { LOG_DEBUG, LOG_INFO, LOG_NOTICE, @@ -363,8 +357,8 @@ log_vwrite(log_context lc, int category, int level, const char *format, continue; if (!did_vsprintf) { - if (VSPRINTF((lc->buffer, format, args)) > - (size_t)LOG_BUFFER_SIZE) { + (void)vsprintf(lc->buffer, format, args); + if (strlen(lc->buffer) > (size_t)LOG_BUFFER_SIZE) { syslog(LOG_CRIT, "memory overrun in log_vwrite()"); exit(1); diff --git a/lib/bind/nameser/Makefile.in b/lib/bind/nameser/Makefile.in index d033eee..fcb7ed7 100644 --- a/lib/bind/nameser/Makefile.in +++ b/lib/bind/nameser/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.5 2004/03/16 05:22:19 marka Exp $ +# $Id: Makefile.in,v 1.5.18.2 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -26,6 +26,6 @@ SRCS= ns_date.c ns_name.c ns_netint.c ns_parse.c ns_print.c \ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include @BIND9_MAKE_RULES@ diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index f248d23..daddae6 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -16,12 +16,20 @@ #include #endif /* HAVE_SYS_SELECT_H */ +#ifdef REENABLE_SEND +#undef send +#endif + @NEED_PSELECT@ @HAVE_SA_LEN@ @HAVE_MINIMUM_IFREQ@ @NEED_DAEMON@ @NEED_STRSEP@ @NEED_STRERROR@ +#ifdef NEED_STRERROR +const char *isc_strerror(int); +#define strerror isc_strerror +#endif @HAS_INET6_STRUCTS@ @HAVE_SIN6_SCOPE_ID@ @NEED_IN6ADDR_ANY@ @@ -30,12 +38,18 @@ @NEED_GETTIMEOFDAY@ @HAVE_STRNDUP@ @USE_FIONBIO_IOCTL@ -@USE_SYSERROR_LIST@ @INNETGR_ARGS@ @SETNETGRENT_ARGS@ @USE_IFNAMELINKID@ @PORT_NONBLOCK@ +#ifndef _POSIX_PATH_MAX +#define _POSIX_PATH_MAX 255 +#endif +#ifndef PATH_MAX +#define PATH_MAX _POSIX_PATH_MAX +#endif + /* * We need to know the IPv6 address family number even on IPv4-only systems. * Note that this is NOT a protocol constant, and that if the system has its @@ -309,16 +323,16 @@ innetgr_r(const char *, const char *, const char *, const char *); #endif #ifdef NEED_SETNETGRENT_R -#ifdef NGR_R_ENT_ARGS -NGR_R_SET_RETURN setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS); +#ifdef NGR_R_SET_ARGS +NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS); #else -NGR_R_SET_RETURN setnetgrent_r(const char *netgroup); +NGR_R_SET_RETURN setnetgrent_r(NGR_R_SET_CONST char *netgroup); #endif #endif #ifdef NEED_ENDNETGRENT_R -#ifdef NGR_R_ENT_ARGS -NGR_R_END_RETURN endnetgrent_r(NGR_R_ENT_ARGS); +#ifdef NGR_R_END_ARGS +NGR_R_END_RETURN endnetgrent_r(NGR_R_END_ARGS); #else NGR_R_END_RETURN endnetgrent_r(void); #endif @@ -384,10 +398,12 @@ int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp); int isc__gettimeofday(struct timeval *tp, struct timezone *tzp); #endif -int getnetgrent(char **machinep, char **userp, char **domainp); +int getnetgrent(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, + NGR_R_CONST char **domainp); #ifdef NGR_R_ARGS -int getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS); +int getnetgrent_r(NGR_R_CONST char **machinep, NGR_R_CONST char **userp, + NGR_R_CONST char **domainp, NGR_R_ARGS); #endif #ifdef SETNETGRENT_ARGS @@ -405,11 +421,87 @@ int innetgr(const char *netgroup, const char *machine, const char *user, const char *domain); #endif -#ifdef NGR_R_ENT_ARGS +#ifdef NGR_R_SET_ARGS NGR_R_SET_RETURN -setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS); +setnetgrent_r(NGR_R_SET_CONST char *netgroup, NGR_R_SET_ARGS); #else NGR_R_SET_RETURN -setnetgrent_r(const char *netgroup); +setnetgrent_r(NGR_R_SET_CONST char *netgroup); +#endif + +#ifdef NEED_STRTOUL +unsigned long strtoul(const char *, char **, int); +#endif + +#ifdef NEED_SUN4PROTOS +#include +#ifndef __SIZE_TYPE__ +#define __SIZE_TYPE__ int +#endif +struct sockaddr; +struct iovec; +struct timeval; +struct timezone; +int fprintf(FILE *, const char *, ...); +int getsockname(int, struct sockaddr *, int *); +int getpeername(int, struct sockaddr *, int *); +int socket(int, int, int); +int connect(int, const struct sockaddr *, int); +int writev(int, struct iovec *, int); +int readv(int, struct iovec *, int); +int send(int, const char *, int, int); +void bzero(char *, int); +int recvfrom(int, char *, int, int, struct sockaddr *, int *); +int syslog(int, const char *, ... ); +int printf(const char *, ...); +__SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *); +__SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *); +int fclose(FILE *); +int ungetc(int, FILE *); +int scanf(const char *, ...); +int sscanf(const char *, const char *, ... ); +int tolower(int); +int toupper(int); +int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, int); +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#ifdef gettimeofday +#undef gettimeofday +int gettimeofday(struct timeval *, struct timezone *); +#define gettimeofday isc__gettimeofday +#else +int gettimeofday(struct timeval *, struct timezone *); +#endif +long strtol(const char*, char **, int); +int fseek(FILE *, long, int); +int setsockopt(int, int, int, const char *, int); +int bind(int, const struct sockaddr *, int); +void bcopy(char *, char *, int); +int fputc(char, FILE *); +int listen(int, int); +int accept(int, struct sockaddr *, int *); +int getsockopt(int, int, int, char *, int *); +int vfprintf(FILE *, const char *, va_list); +int fflush(FILE *); +int fgetc(FILE *); +int fputs(const char *, FILE *); +int fchown(int, int, int); +void setbuf(FILE *, char *); +int gethostname(char *, int); +int rename(const char *, const char *); +time_t time(time_t *); +int fscanf(FILE *, const char *, ...); +int sscanf(const char *, const char *, ...); +int ioctl(int, int, caddr_t); +void perror(const char *); + +#if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__) +/* + * 'gcc -ansi' changes the prototype for vsprintf(). + * Use this prototype when 'gcc -ansi' is not in effect. + */ +char *vsprintf(char *, const char *, va_list); #endif +#endif + #endif diff --git a/lib/bind/port_before.h.in b/lib/bind/port_before.h.in index 1f6ff1a..eb0c3fc 100644 --- a/lib/bind/port_before.h.in +++ b/lib/bind/port_before.h.in @@ -2,6 +2,10 @@ #define port_before_h #include +#ifdef NEED_SUN4PROTOS +#define _PARAMS(x) x +#endif + struct group; /* silence warning */ struct passwd; /* silence warning */ struct timeval; /* silence warning */ @@ -81,15 +85,22 @@ struct timespec { @NGR_R_BAD@ @NGR_R_COPY@ @NGR_R_COPY_ARGS@ +@NGR_R_CONST@ @NGR_R_END_RESULT@ @NGR_R_END_RETURN@ -@NGR_R_ENT_ARGS@ +@NGR_R_END_ARGS@ @NGR_R_OK@ @NGR_R_RETURN@ +@NGR_R_SET_CONST@ @NGR_R_SET_RESULT@ @NGR_R_SET_RETURN@ +@NGR_R_SET_ARGS@ @NGR_R_PRIVATE@ +#if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS) +#define NGR_R_SET_ARGS NGR_R_END_ARGS +#endif + @PROTO_R_ARGS@ @PROTO_R_BAD@ @PROTO_R_COPY@ diff --git a/lib/bind/resolv/Makefile.in b/lib/bind/resolv/Makefile.in index cc661b6..557f020 100644 --- a/lib/bind/resolv/Makefile.in +++ b/lib/bind/resolv/Makefile.in @@ -1,7 +1,7 @@ -# Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2008 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # -# Permission to use, copy, modify, and distribute this software for any +# Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.4.18.2 2005/07/29 00:12:55 marka Exp $ +# $Id: Makefile.in,v 1.4.18.4 2008/03/20 23:46:01 tbox Exp $ srcdir= @srcdir@ VPATH = @srcdir@ @@ -28,7 +28,7 @@ SRCS= herror.c mtctxres.c res_comp.c res_data.c res_debug.c \ TARGETS= ${OBJS} -CINCLUDES= -I.. -I${srcdir}/../include +CINCLUDES= -I.. -I../include -I${srcdir}/../include CWARNINGS= @BIND9_MAKE_RULES@ diff --git a/lib/bind/resolv/res_debug.c b/lib/bind/resolv/res_debug.c index 2ed234e..71dc676 100644 --- a/lib/bind/resolv/res_debug.c +++ b/lib/bind/resolv/res_debug.c @@ -95,7 +95,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $"; +static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.6 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -189,10 +189,56 @@ do_section(const res_state statp, p_type(ns_rr_type(rr)), p_class(ns_rr_class(rr))); else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { + u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr); u_int32_t ttl = ns_rr_ttl(rr); + fprintf(file, "; EDNS: version: %u, udp=%u, flags=%04x\n", (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); + + while (rdatalen >= 4) { + const u_char *cp = ns_rr_rdata(rr); + int i; + + GETSHORT(optcode, cp); + GETSHORT(optlen, cp); + + if (optcode == NS_OPT_NSID) { + fputs("; NSID: ", file); + if (optlen == 0) { + fputs("; NSID\n", file); + } else { + fputs("; NSID: ", file); + for (i = 0; i < optlen; i++) + fprintf(file, "%02x ", + cp[i]); + fputs(" (",file); + for (i = 0; i < optlen; i++) + fprintf(file, "%c", + isprint(cp[i])? + cp[i] : '.'); + fputs(")\n", file); + } + } else { + if (optlen == 0) { + fprintf(file, "; OPT=%u\n", + optcode); + } else { + fprintf(file, "; OPT=%u: ", + optcode); + for (i = 0; i < optlen; i++) + fprintf(file, "%02x ", + cp[i]); + fputs(" (",file); + for (i = 0; i < optlen; i++) + fprintf(file, "%c", + isprint(cp[i]) ? + cp[i] : '.'); + fputs(")\n", file); + } + } + rdatalen -= 4 + optlen; + } } else { n = ns_sprintrr(handle, &rr, NULL, NULL, buf, buflen); @@ -204,7 +250,7 @@ do_section(const res_state statp, buf = malloc(buflen += 1024); if (buf == NULL) { fprintf(file, - ";; memory allocation failure\n"); + ";; memory allocation failure\n"); return; } continue; @@ -381,7 +427,7 @@ const struct res_sym __p_default_section_syms[] = { {ns_s_an, "ANSWER", (char *)0}, {ns_s_ns, "AUTHORITY", (char *)0}, {ns_s_ar, "ADDITIONAL", (char *)0}, - {0, (char *)0, (char *)0} + {0, (char *)0, (char *)0} }; const struct res_sym __p_update_section_syms[] = { @@ -389,7 +435,7 @@ const struct res_sym __p_update_section_syms[] = { {S_PREREQ, "PREREQUISITE", (char *)0}, {S_UPDATE, "UPDATE", (char *)0}, {S_ADDT, "ADDITIONAL", (char *)0}, - {0, (char *)0, (char *)0} + {0, (char *)0, (char *)0} }; const struct res_sym __p_key_syms[] = { @@ -617,6 +663,7 @@ p_option(u_long option) { case RES_USE_INET6: return "inet6"; #ifdef RES_USE_EDNS0 /*%< KAME extension */ case RES_USE_EDNS0: return "edns0"; + case RES_NSID: return "nsid"; #endif #ifdef RES_USE_DNAME case RES_USE_DNAME: return "dname"; diff --git a/lib/bind/resolv/res_mkquery.c b/lib/bind/resolv/res_mkquery.c index 50e4a9e..049f6c5 100644 --- a/lib/bind/resolv/res_mkquery.c +++ b/lib/bind/resolv/res_mkquery.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp $"; +static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.2 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -203,9 +203,6 @@ res_nmkquery(res_state statp, #ifdef RES_USE_EDNS0 /* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */ -#ifndef T_OPT -#define T_OPT 41 -#endif int res_nopt(res_state statp, @@ -230,13 +227,14 @@ res_nopt(res_state statp, if ((ep - cp) < 1 + RRFIXEDSZ) return (-1); - *cp++ = 0; /*%< "." */ - ns_put16(T_OPT, cp); /*%< TYPE */ + *cp++ = 0; /*%< "." */ + ns_put16(ns_t_opt, cp); /*%< TYPE */ cp += INT16SZ; - ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ + ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ cp += INT16SZ; - *cp++ = NOERROR; /*%< extended RCODE */ - *cp++ = 0; /*%< EDNS version */ + *cp++ = NOERROR; /*%< extended RCODE */ + *cp++ = 0; /*%< EDNS version */ + if (statp->options & RES_USE_DNSSEC) { #ifdef DEBUG if (statp->options & RES_DEBUG) @@ -246,12 +244,60 @@ res_nopt(res_state statp, } ns_put16(flags, cp); cp += INT16SZ; - ns_put16(0, cp); /*%< RDLEN */ + + ns_put16(0U, cp); /*%< RDLEN */ cp += INT16SZ; + hp->arcount = htons(ntohs(hp->arcount) + 1); return (cp - buf); } + +/* + * Construct variable data (RDATA) block for OPT psuedo-RR, append it + * to the buffer, then update the RDLEN field (previously set to zero by + * res_nopt()) with the new RDATA length. + */ +int +res_nopt_rdata(res_state statp, + int n0, /*%< current offset in buffer */ + u_char *buf, /*%< buffer to put query */ + int buflen, /*%< size of buffer */ + u_char *rdata, /*%< ptr to start of opt rdata */ + u_short code, /*%< OPTION-CODE */ + u_short len, /*%< OPTION-LENGTH */ + u_char *data) /*%< OPTION_DATA */ +{ + register u_char *cp, *ep; + +#ifdef DEBUG + if ((statp->options & RES_DEBUG) != 0U) + printf(";; res_nopt_rdata()\n"); +#endif + + cp = buf + n0; + ep = buf + buflen; + + if ((ep - cp) < (4 + len)) + return (-1); + + if (rdata < (buf + 2) || rdata >= ep) + return (-1); + + ns_put16(code, cp); + cp += INT16SZ; + + ns_put16(len, cp); + cp += INT16SZ; + + memcpy(cp, data, len); + cp += len; + + len = cp - rdata; + ns_put16(len, rdata - 2); /* Update RDLEN field */ + + return (cp - buf); +} #endif /*! \file */ diff --git a/lib/bind/resolv/res_query.c b/lib/bind/resolv/res_query.c index c160e93..8c01cb0 100644 --- a/lib/bind/resolv/res_query.c +++ b/lib/bind/resolv/res_query.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_query.c,v 1.7.18.1 2005/04/27 05:01:11 sra Exp $"; +static const char rcsid[] = "$Id: res_query.c,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -116,8 +116,9 @@ res_nquery(res_state statp, { u_char buf[MAXPACKET]; HEADER *hp = (HEADER *) answer; - int n; u_int oflags; + u_char *rdata; + int n; oflags = statp->_flags; @@ -132,8 +133,14 @@ again: buf, sizeof(buf)); #ifdef RES_USE_EDNS0 if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && - (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U) + (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) { n = res_nopt(statp, n, buf, sizeof(buf), anslen); + rdata = &buf[n]; + if (n > 0 && (statp->options & RES_NSID) != 0U) { + n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata, + NS_OPT_NSID, 0, NULL); + } + } #endif if (n <= 0) { #ifdef DEBUG @@ -143,6 +150,7 @@ again: RES_SET_H_ERRNO(statp, NO_RECOVERY); return (n); } + n = res_nsend(statp, buf, n, answer, anslen); if (n < 0) { #ifdef RES_USE_EDNS0 diff --git a/lib/bind/resolv/res_send.c b/lib/bind/resolv/res_send.c index 39dc998..5154fe2 100644 --- a/lib/bind/resolv/res_send.c +++ b/lib/bind/resolv/res_send.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_send.c,v 1.9.18.8 2006/10/16 23:00:58 marka Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 1.9.18.10 2008/01/27 02:06:26 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /*! \file @@ -293,7 +293,7 @@ int res_nsend(res_state statp, const u_char *buf, int buflen, u_char *ans, int anssiz) { - int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; + int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n; char abuf[NI_MAXHOST]; #ifdef USE_POLL @@ -405,7 +405,7 @@ res_nsend(res_state statp, /* * Send request, RETRY times, or until successful. */ - for (try = 0; try < statp->retry; try++) { + for (tries = 0; tries < statp->retry; tries++) { for (ns = 0; ns < statp->nscount; ns++) { struct sockaddr *nsap; int nsaplen; @@ -453,7 +453,7 @@ res_nsend(res_state statp, if (v_circuit) { /* Use VC; at most one attempt per server. */ - try = statp->retry; + tries = statp->retry; n = send_vc(statp, buf, buflen, ans, anssiz, &terrno, ns); if (n < 0) @@ -464,7 +464,7 @@ res_nsend(res_state statp, } else { /* Use datagrams. */ n = send_dg(statp, buf, buflen, ans, anssiz, &terrno, - ns, try, &v_circuit, &gotsomewhere); + ns, tries, &v_circuit, &gotsomewhere); if (n < 0) goto fail; if (n == 0) @@ -601,6 +601,9 @@ send_vc(res_state statp, u_short len; u_char *cp; void *tmp; +#ifdef SO_NOSIGPIPE + int on = 1; +#endif nsap = get_nsaddr(statp, ns); nsaplen = get_salen(nsap); @@ -646,6 +649,17 @@ send_vc(res_state statp, return (-1); } } +#ifdef SO_NOSIGPIPE + /* + * Disable generation of SIGPIPE when writing to a closed + * socket. Write should return -1 and set errno to EPIPE + * instead. + * + * Push on even if setsockopt(SO_NOSIGPIPE) fails. + */ + (void)setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on, + sizeof(on)); +#endif errno = 0; if (connect(statp->_vcsock, nsap, nsaplen) < 0) { *terrno = errno; @@ -773,7 +787,7 @@ send_vc(res_state statp, static int send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, - int anssiz, int *terrno, int ns, int try, int *v_circuit, + int anssiz, int *terrno, int ns, int tries, int *v_circuit, int *gotsomewhere) { const HEADER *hp = (const HEADER *) buf; @@ -855,7 +869,7 @@ send_dg(res_state statp, const u_char *buf, int buflen, u_char *ans, /* * Wait for reply. */ - seconds = (statp->retrans << try); + seconds = (statp->retrans << tries); if (ns > 0) seconds /= statp->nscount; if (seconds <= 0) -- cgit v1.1