diff options
author | asmodai <asmodai@FreeBSD.org> | 2001-01-28 23:00:22 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2001-01-28 23:00:22 +0000 |
commit | 1f243835b5b81bfd6b9e5f666730965fe5d60ed6 (patch) | |
tree | 4c0925b2692b57db0c0c1044db977bbc4c0899d7 /contrib/bind/lib | |
parent | 43c4a8b07e19a2567390a7f788929e5c908a4d7b (diff) | |
download | FreeBSD-src-1f243835b5b81bfd6b9e5f666730965fe5d60ed6.zip FreeBSD-src-1f243835b5b81bfd6b9e5f666730965fe5d60ed6.tar.gz |
Virgin import of BIND v8.2.3-REL
Diffstat (limited to 'contrib/bind/lib')
39 files changed, 225 insertions, 113 deletions
diff --git a/contrib/bind/lib/Makefile b/contrib/bind/lib/Makefile index d06e543..1de1d01 100644 --- a/contrib/bind/lib/Makefile +++ b/contrib/bind/lib/Makefile @@ -13,14 +13,14 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 8.23 2000/07/11 06:41:36 vixie Exp $ +# $Id: Makefile,v 8.25 2000/12/23 08:02:56 vixie Exp $ SUBDIRS = resolv irs isc bsd inet nameser dst cylink dnssafe -# these are only appropriate for BSD 4.4 or derivatives, and are used in +# these are only appropriate for FreeBSD or similar, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd SHELL= /bin/sh O=o A=a @@ -62,7 +62,7 @@ LIBRTS = ${TOP}/lib/libbindr.ts all depend clean install distclean:: @for x in ${SUBDIRS}; do \ - (cd $$x; pwd; ${MAKE} ${MARGS} $@); \ + (cd $$x; pwd; ${MAKE} ${MARGS} $@) || exit 1; \ done all:: ${LIBTS} ${LIBRTS} @@ -103,7 +103,7 @@ links:: FRC ( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \ cp SRC/Makefile Makefile; chmod +w Makefile; \ ${MAKE} ${MARGS} links; \ - ); \ + ) || exit 1; \ done FRC: diff --git a/contrib/bind/lib/dst/Makefile b/contrib/bind/lib/dst/Makefile index ffd9b17..a5518bd 100644 --- a/contrib/bind/lib/dst/Makefile +++ b/contrib/bind/lib/dst/Makefile @@ -13,12 +13,12 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 1.17 2000/07/11 06:41:39 vixie Exp $ +# $Id: Makefile,v 1.18 2000/12/23 08:02:58 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -26,7 +26,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include diff --git a/contrib/bind/lib/dst/bsafe_link.c b/contrib/bind/lib/dst/bsafe_link.c index 8b24d99..7d9345e 100644 --- a/contrib/bind/lib/dst/bsafe_link.c +++ b/contrib/bind/lib/dst/bsafe_link.c @@ -1,5 +1,5 @@ #if defined(BSAFE) || defined(DNSSAFE) -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/bsafe_link.c,v 1.11 1999/10/13 16:39:22 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/bsafe_link.c,v 1.11 1999/10/13 16:39:22 vixie Exp $"; /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/cylink_link.c b/contrib/bind/lib/dst/cylink_link.c index c7cb276..0638ef1 100644 --- a/contrib/bind/lib/dst/cylink_link.c +++ b/contrib/bind/lib/dst/cylink_link.c @@ -1,5 +1,5 @@ #ifdef CYLINK_DSS -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/cylink_link.c,v 1.7 1999/10/13 16:39:22 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/cylink_link.c,v 1.7 1999/10/13 16:39:22 vixie Exp $"; /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/dst_api.c b/contrib/bind/lib/dst/dst_api.c index f25438e..e32d075 100644 --- a/contrib/bind/lib/dst/dst_api.c +++ b/contrib/bind/lib/dst/dst_api.c @@ -1,5 +1,5 @@ #ifndef LINT -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/dst_api.c,v 1.14 2000/02/28 07:51:50 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/dst_api.c,v 1.16 2000/11/13 04:09:23 vixie Exp $"; #endif /* @@ -771,8 +771,7 @@ dst_buffer_to_key(const char *key_name, /* name of the key */ if (dkey == NULL) return (NULL); - if (dkey->dk_func != NULL && - dkey->dk_func->from_dns_key != NULL) { + if (dkey->dk_func != NULL && dkey->dk_func->from_dns_key != NULL) { if (dkey->dk_func->from_dns_key(dkey, key_buf, key_len) < 0) { EREPORT(("dst_buffer_to_key(): dst_buffer_to_hmac failed\n")); return (dst_free_key(dkey)); @@ -787,9 +786,9 @@ dst_key_to_buffer(DST_KEY *key, u_char *out_buff, int buf_len) { int len; /* this function will extrac the secret of HMAC into a buffer */ - if(key == NULL) + if (key == NULL) return (0); - if(key->dk_func != NULL && key->dk_func != NULL) { + if (key->dk_func != NULL && key->dk_func->to_dns_key != NULL) { len = key->dk_func->to_dns_key(key, out_buff, buf_len); if (len < 0) return (0); diff --git a/contrib/bind/lib/dst/eay_dss_link.c b/contrib/bind/lib/dst/eay_dss_link.c index b060bf0..8542149 100644 --- a/contrib/bind/lib/dst/eay_dss_link.c +++ b/contrib/bind/lib/dst/eay_dss_link.c @@ -1,5 +1,5 @@ #ifdef EAY_DSS -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/eay_dss_link.c,v 1.4 1999/10/13 16:39:23 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/eay_dss_link.c,v 1.4 1999/10/13 16:39:23 vixie Exp $"; /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/hmac_link.c b/contrib/bind/lib/dst/hmac_link.c index 1f96bca..1b93088 100644 --- a/contrib/bind/lib/dst/hmac_link.c +++ b/contrib/bind/lib/dst/hmac_link.c @@ -1,6 +1,6 @@ #ifdef HMAC_MD5 #ifndef LINT -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/hmac_link.c,v 1.8 1999/10/15 21:30:07 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/hmac_link.c,v 1.8 1999/10/15 21:30:07 vixie Exp $"; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/prandom.c b/contrib/bind/lib/dst/prandom.c index dcd53435..a17e071 100644 --- a/contrib/bind/lib/dst/prandom.c +++ b/contrib/bind/lib/dst/prandom.c @@ -1,5 +1,5 @@ #ifndef LINT -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/prandom.c,v 1.9 2000/07/17 07:36:53 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/prandom.c,v 1.9 2000/07/17 07:36:53 vixie Exp $"; #endif /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/rsaref_link.c b/contrib/bind/lib/dst/rsaref_link.c index 2ccd96e..52a49b4 100644 --- a/contrib/bind/lib/dst/rsaref_link.c +++ b/contrib/bind/lib/dst/rsaref_link.c @@ -1,5 +1,5 @@ #ifdef RSAREF -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/rsaref_link.c,v 1.7 2000/07/17 07:36:53 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/rsaref_link.c,v 1.7 2000/07/17 07:36:53 vixie Exp $"; /* * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. diff --git a/contrib/bind/lib/dst/support.c b/contrib/bind/lib/dst/support.c index d50aa07..d07df5a 100644 --- a/contrib/bind/lib/dst/support.c +++ b/contrib/bind/lib/dst/support.c @@ -1,4 +1,4 @@ -static const char rcsid[] = "$Header: /proj/cvs/isc/bind/src/lib/dst/support.c,v 1.8 1999/10/13 16:39:24 vixie Exp $"; +static const char rcsid[] = "$Header: /proj/cvs/isc/bind8/src/lib/dst/support.c,v 1.8 1999/10/13 16:39:24 vixie Exp $"; /* diff --git a/contrib/bind/lib/inet/Makefile b/contrib/bind/lib/inet/Makefile index 2be32bd..1876bb6 100644 --- a/contrib/bind/lib/inet/Makefile +++ b/contrib/bind/lib/inet/Makefile @@ -13,12 +13,12 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 8.20 2000/07/11 06:41:40 vixie Exp $ +# $Id: Makefile,v 8.21 2000/12/23 08:02:59 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -26,7 +26,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include diff --git a/contrib/bind/lib/inet/inet_cidr_pton.c b/contrib/bind/lib/inet/inet_cidr_pton.c index 4fae2c6..9ead90b 100644 --- a/contrib/bind/lib/inet/inet_cidr_pton.c +++ b/contrib/bind/lib/inet/inet_cidr_pton.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_cidr_pton.c,v 8.3 1999/01/08 19:23:41 vixie Exp $"; +static const char rcsid[] = "$Id: inet_cidr_pton.c,v 8.4 2000/12/23 08:14:53 vixie Exp $"; #endif #include "port_before.h" @@ -122,11 +122,12 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, int *pbits) { goto enoent; /* Prefix length can default to /32 only if all four octets spec'd. */ - if (bits == -1) + if (bits == -1) { if (dst - odst == 4) bits = 32; else goto enoent; + } /* If nothing was written to the destination, we found no address. */ if (dst == odst) diff --git a/contrib/bind/lib/inet/inet_net_ntop.c b/contrib/bind/lib/inet/inet_net_ntop.c index 4e2f91f..d8b8377 100644 --- a/contrib/bind/lib/inet/inet_net_ntop.c +++ b/contrib/bind/lib/inet/inet_net_ntop.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.6 1999/01/08 19:23:42 vixie Exp $"; +static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.7 2001/01/25 19:55:59 vixie Exp $"; #endif #include "port_before.h" @@ -108,7 +108,7 @@ inet_net_ntop_ipv4(src, bits, dst, size) /* Format whole octets. */ for (b = bits / 8; b > 0; b--) { - if (size < sizeof "255.") + if (size <= sizeof "255.") goto emsgsize; t = dst; dst += SPRINTF((dst, "%u", *src++)); @@ -122,7 +122,7 @@ inet_net_ntop_ipv4(src, bits, dst, size) /* Format partial octet. */ b = bits % 8; if (b > 0) { - if (size < sizeof ".255") + if (size <= sizeof ".255") goto emsgsize; t = dst; if (dst != odst) @@ -133,7 +133,7 @@ inet_net_ntop_ipv4(src, bits, dst, size) } /* Format CIDR /width. */ - if (size < sizeof "/32") + if (size <= sizeof "/32") goto emsgsize; dst += SPRINTF((dst, "/%u", bits)); return (odst); diff --git a/contrib/bind/lib/inet/inet_ntop.c b/contrib/bind/lib/inet/inet_ntop.c index 0b85e70..d588e9f 100644 --- a/contrib/bind/lib/inet/inet_ntop.c +++ b/contrib/bind/lib/inet/inet_ntop.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: inet_ntop.c,v 1.8 1999/10/13 16:39:28 vixie Exp $"; +static const char rcsid[] = "$Id: inet_ntop.c,v 1.10 2001/01/25 20:21:10 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -96,7 +96,7 @@ inet_ntop4(src, dst, size) static const char fmt[] = "%u.%u.%u.%u"; char tmp[sizeof "255.255.255.255"]; - if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) { errno = ENOSPC; return (NULL); } diff --git a/contrib/bind/lib/irs/Makefile b/contrib/bind/lib/irs/Makefile index a17f252..4784ccf 100644 --- a/contrib/bind/lib/irs/Makefile +++ b/contrib/bind/lib/irs/Makefile @@ -13,12 +13,12 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 8.20 2000/07/11 06:41:40 vixie Exp $ +# $Id: Makefile,v 8.21 2000/12/23 08:02:59 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -26,7 +26,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include diff --git a/contrib/bind/lib/irs/getnameinfo.c b/contrib/bind/lib/irs/getnameinfo.c index 7bd30ae..9f186f3 100644 --- a/contrib/bind/lib/irs/getnameinfo.c +++ b/contrib/bind/lib/irs/getnameinfo.c @@ -165,14 +165,14 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) if (serv == NULL || servlen == 0) { /* what we should do? */ } else if (flags & NI_NUMERICSERV) { - snprintf(numserv, strlen(numserv), "%d", ntohs(port)); + snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); if (strlen(numserv) > servlen) return ENI_MEMORY; strcpy(serv, numserv); } else { sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp"); if (sp) { - if (strlen(sp->s_name) > servlen) + if (strlen(sp->s_name) + 1 > servlen) return ENI_MEMORY; strcpy(serv, sp->s_name); } else @@ -196,7 +196,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) == NULL) return ENI_SYSTEM; - if (strlen(numaddr) > hostlen) + if (strlen(numaddr) + 1 > hostlen) return ENI_MEMORY; strcpy(host, numaddr); } else { @@ -207,7 +207,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) p = strchr(hp->h_name, '.'); if (p) *p = '\0'; } - if (strlen(hp->h_name) > hostlen) + if (strlen(hp->h_name) + 1 > hostlen) return ENI_MEMORY; strcpy(host, hp->h_name); } else { @@ -216,7 +216,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) == NULL) return ENI_NOHOSTNAME; - if (strlen(numaddr) > hostlen) + if (strlen(numaddr) + 1 > hostlen) return ENI_MEMORY; strcpy(host, numaddr); } diff --git a/contrib/bind/lib/irs/getnetent.c b/contrib/bind/lib/irs/getnetent.c index b63ddaf..52aebe3 100644 --- a/contrib/bind/lib/irs/getnetent.c +++ b/contrib/bind/lib/irs/getnetent.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: getnetent.c,v 1.17 1999/10/13 16:39:30 vixie Exp $"; +static const char rcsid[] = "$Id: getnetent.c,v 1.18 2000/12/23 08:14:53 vixie Exp $"; #endif /* Imports */ @@ -175,14 +175,16 @@ getnetbyaddr_p(unsigned long net, int type, struct net_data *net_data) { addr[3] = (0x000000FF & net); /* reduce bits to as close to natural number as possible */ - if ((bits == 32) && (addr[0] < 224) && (addr[3] == 0)) - if ((addr[0] < 192) && (addr[2] == 0)) + if ((bits == 32) && (addr[0] < 224) && (addr[3] == 0)) { + if ((addr[0] < 192) && (addr[2] == 0)) { if ((addr[0] < 128) && (addr[1] == 0)) bits = 8; else bits = 16; - else + } else { bits = 24; + } + } net_data->nww_last = (*nw->byaddr)(nw, addr, bits, AF_INET); net_data->nw_last = nw_to_net(net_data->nww_last, net_data); diff --git a/contrib/bind/lib/irs/irpmarshall.c b/contrib/bind/lib/irs/irpmarshall.c index 8f7c330..240bb08 100644 --- a/contrib/bind/lib/irs/irpmarshall.c +++ b/contrib/bind/lib/irs/irpmarshall.c @@ -49,7 +49,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: irpmarshall.c,v 8.5 1999/10/13 17:11:19 vixie Exp $"; +static const char rcsid[] = "$Id: irpmarshall.c,v 8.6 2000/11/13 05:08:08 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #if 0 @@ -90,7 +90,10 @@ Double check memory allocations on unmarhsalling #include "port_after.h" +#ifndef HAVE_STRNDUP static char *strndup(const char *str, size_t len); +#endif + static char **splitarray(const char *buffer, const char *buffend, char delim); static int joinarray(char * const * argv, char *buffer, char delim); static char *getfield(char **res, size_t reslen, char **buffer, char delim); @@ -1862,6 +1865,7 @@ getfield(char **res, size_t reslen, char **ptr, char delim) { +#ifndef HAVE_STRNDUP /* * static char * strndup(const char *str, size_t len) * @@ -1886,6 +1890,7 @@ strndup(const char *str, size_t len) { p[len] = 0x0; return (p); } +#endif #if WANT_MAIN diff --git a/contrib/bind/lib/irs/irs_data.c b/contrib/bind/lib/irs/irs_data.c index f31fe69..8446c6b 100644 --- a/contrib/bind/lib/irs/irs_data.c +++ b/contrib/bind/lib/irs/irs_data.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irs_data.c,v 1.14 1999/10/13 16:39:31 vixie Exp $"; +static const char rcsid[] = "$Id: irs_data.c,v 1.15 2000/12/23 08:14:54 vixie Exp $"; #endif #include "port_before.h" @@ -55,7 +55,7 @@ static struct net_data *net_data; #endif void -irs_destroy() { +irs_destroy(void) { #ifndef DO_PTHREADS if (net_data != NULL) net_data_destroy(net_data); @@ -67,7 +67,6 @@ void net_data_destroy(void *p) { struct net_data *net_data = p; - res_nclose(net_data->res); if (net_data->gr != NULL) { (*net_data->gr->close)(net_data->gr); diff --git a/contrib/bind/lib/isc/Makefile b/contrib/bind/lib/isc/Makefile index 5485ec7..7845365 100644 --- a/contrib/bind/lib/isc/Makefile +++ b/contrib/bind/lib/isc/Makefile @@ -13,12 +13,12 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 8.26 2000/07/11 06:41:41 vixie Exp $ +# $Id: Makefile,v 8.28 2000/12/23 08:03:00 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -26,7 +26,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include @@ -47,13 +47,15 @@ SRCS= tree.c base64.c bitncmp.c assertions.c \ memcluster.c logging.c heap.c \ ctl_p.c ctl_srvr.c ctl_clnt.c \ eventlib.c ev_connects.c ev_files.c \ - ev_timers.c ev_streams.c ev_waits.c + ev_timers.c ev_streams.c ev_waits.c \ + movefile.c OBJS= tree.${O} base64.${O} bitncmp.${O} assertions.${O} \ memcluster.${O} logging.${O} heap.${O} \ ctl_p.${O} ctl_srvr.${O} ctl_clnt.${O} \ eventlib.${O} ev_connects.${O} ev_files.${O} \ - ev_timers.${O} ev_streams.${O} ev_waits.${O} + ev_timers.${O} ev_streams.${O} ev_waits.${O} \ + movefile.${O} all: ${LIBBIND} diff --git a/contrib/bind/lib/isc/ctl_clnt.c b/contrib/bind/lib/isc/ctl_clnt.c index 66f32f8..4e19d2c 100644 --- a/contrib/bind/lib/isc/ctl_clnt.c +++ b/contrib/bind/lib/isc/ctl_clnt.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ctl_clnt.c,v 8.14 1999/10/13 16:39:33 vixie Exp $"; +static const char rcsid[] = "$Id: ctl_clnt.c,v 8.15 2000/11/14 01:10:36 vixie Exp $"; #endif /* not lint */ /* @@ -261,11 +261,11 @@ new_tran(struct ctl_cctx *ctx, ctl_clntdone donefunc, void *uap, int w) { buffer_init(new->outbuf); new->donefunc = donefunc; new->uap = uap; + INIT_LINK(new, link); + INIT_LINK(new, wlink); APPEND(ctx->tran, new, link); if (w) APPEND(ctx->wtran, new, wlink); - else - INIT_LINK(new, wlink); return (new); } diff --git a/contrib/bind/lib/isc/ctl_srvr.c b/contrib/bind/lib/isc/ctl_srvr.c index ff1fc82..9beea0d 100644 --- a/contrib/bind/lib/isc/ctl_srvr.c +++ b/contrib/bind/lib/isc/ctl_srvr.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: ctl_srvr.c,v 8.23 2000/02/04 08:28:33 vixie Exp $"; +static const char rcsid[] = "$Id: ctl_srvr.c,v 8.24 2000/11/14 01:10:37 vixie Exp $"; #endif /* not lint */ /* @@ -422,6 +422,7 @@ ctl_accept(evContext lev, void *uap, int fd, strerror(errno)); } ctx->cur_sess++; + INIT_LINK(sess, link); APPEND(ctx->sess, sess, link); sess->ctx = ctx; sess->sock = fd; diff --git a/contrib/bind/lib/isc/ev_connects.c b/contrib/bind/lib/isc/ev_connects.c index 1da5c10..5378665 100644 --- a/contrib/bind/lib/isc/ev_connects.c +++ b/contrib/bind/lib/isc/ev_connects.c @@ -20,7 +20,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: ev_connects.c,v 8.26 2000/02/04 08:28:34 vixie Exp $"; +static const char rcsid[] = "$Id: ev_connects.c,v 8.27 2000/11/14 01:10:37 vixie Exp $"; #endif /* Import. */ @@ -256,6 +256,7 @@ evTryAccept(evContext opaqueCtx, evConnID id, int *sys_errno) { return (-1); } } + INIT_LINK(new, link); APPEND(ctx->accepts, new, link); *sys_errno = new->ioErrno; return (0); diff --git a/contrib/bind/lib/isc/heap.mdoc b/contrib/bind/lib/isc/heap.mdoc index 516490b..6e0384d 100644 --- a/contrib/bind/lib/isc/heap.mdoc +++ b/contrib/bind/lib/isc/heap.mdoc @@ -1,11 +1,11 @@ -.\" $Id: heap.mdoc,v 8.5 1999/01/08 19:25:38 vixie Exp $ +.\" $Id: heap.mdoc,v 8.6 2000/11/15 02:03:52 marka Exp $ .\" .\"Copyright (c) 1997,1999 by Internet Software Consortium. - * +.\" .\"Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS .\"ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES .\"OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE @@ -18,9 +18,8 @@ .Dd Jan 1, 1997 .\"Os OPERATING_SYSTEM [version/release] .Os BSD 4 -.\" TODO--get correct section # below!! .Dt HEAP @SYSCALL_EXT@ -.Sh DESCRIPTION +.Sh NAME .Nm heap_new , .Nm heap_free , .Nm heap_insert , diff --git a/contrib/bind/lib/isc/logging.c b/contrib/bind/lib/isc/logging.c index 7d6964b..0d9037f 100644 --- a/contrib/bind/lib/isc/logging.c +++ b/contrib/bind/lib/isc/logging.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: logging.c,v 8.26 2000/04/23 02:19:02 vixie Exp $"; +static const char rcsid[] = "$Id: logging.c,v 8.28 2000/12/23 08:14:54 vixie Exp $"; #endif /* not lint */ #include "port_before.h" @@ -39,6 +39,7 @@ static const char rcsid[] = "$Id: logging.c,v 8.26 2000/04/23 02:19:02 vixie Exp #include <isc/assertions.h> #include <isc/logging.h> #include <isc/memcluster.h> +#include <isc/misc.h> #include "port_after.h" @@ -78,10 +79,10 @@ version_rename(log_channel chan) { for (ver--; ver > 0; ver--) { sprintf(old_name, "%s.%d", chan->out.file.name, ver-1); sprintf(new_name, "%s.%d", chan->out.file.name, ver); - (void)rename(old_name, new_name); + (void)isc_movefile(old_name, new_name); } sprintf(new_name, "%s.0", chan->out.file.name); - (void)rename(chan->out.file.name, new_name); + (void)isc_movefile(chan->out.file.name, new_name); } FILE * diff --git a/contrib/bind/lib/isc/movefile.c b/contrib/bind/lib/isc/movefile.c new file mode 100644 index 0000000..1b64b6c --- /dev/null +++ b/contrib/bind/lib/isc/movefile.c @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2000 by Internet Software Consortium, Inc. + * + * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM 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. + */ + + +#include <port_before.h> +#include <stdio.h> +#include <isc/misc.h> +#include <port_after.h> +#ifndef HAVE_MOVEFILE +/* + * rename() is lame (can't overwrite an existing file) on some systems. + * use movefile() instead, and let lame OS ports do what they need to. + */ + +int +isc_movefile(const char *oldname, const char *newname) { + return (rename(oldname, newname)); +} +#else + static int os_port_has_isc_movefile = 1; +#endif diff --git a/contrib/bind/lib/nameser/Makefile b/contrib/bind/lib/nameser/Makefile index b221793..1ab67ef 100644 --- a/contrib/bind/lib/nameser/Makefile +++ b/contrib/bind/lib/nameser/Makefile @@ -15,12 +15,12 @@ # SOFTWARE. # -# $Id: Makefile,v 8.20 2000/07/11 06:41:42 vixie Exp $ +# $Id: Makefile,v 8.21 2000/12/23 08:03:02 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -28,7 +28,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include diff --git a/contrib/bind/lib/nameser/ns_parse.c b/contrib/bind/lib/nameser/ns_parse.c index 35f7f40..6858a91 100644 --- a/contrib/bind/lib/nameser/ns_parse.c +++ b/contrib/bind/lib/nameser/ns_parse.c @@ -16,7 +16,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $"; +static const char rcsid[] = "$Id: ns_parse.c,v 8.15 2000/12/23 08:14:55 vixie Exp $"; #endif /* Import. */ @@ -64,6 +64,10 @@ struct _ns_flagdata _ns_flagdata[16] = { { 0x0000, 0 }, /* expansion (6/6). */ }; +int ns_msg_getflag(ns_msg handle, int flag) { + return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift); +} + int ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) { const u_char *optr = ptr; diff --git a/contrib/bind/lib/nameser/ns_print.c b/contrib/bind/lib/nameser/ns_print.c index 6c47882..41b4d65 100644 --- a/contrib/bind/lib/nameser/ns_print.c +++ b/contrib/bind/lib/nameser/ns_print.c @@ -16,7 +16,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $"; +static const char rcsid[] = "$Id: ns_print.c,v 8.21 2000/12/09 00:15:38 marka Exp $"; #endif /* Import. */ @@ -123,7 +123,9 @@ ns_sprintrrf(const u_char *msg, size_t msglen, T(addstr("\t\t\t", 3, &buf, &buflen)); } else { len = prune_origin(name, origin); - if (len == 0) { + if (*name == '\0') { + goto root; + } else if (len == 0) { T(addstr("@\t\t\t", 4, &buf, &buflen)); } else { T(addstr(name, len, &buf, &buflen)); @@ -131,6 +133,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, if (((origin == NULL || origin[0] == '\0') || (origin[0] != '.' && origin[1] != '\0' && name[len] == '\0')) && name[len - 1] != '.') { + root: T(addstr(".", 1, &buf, &buflen)); len++; } @@ -145,6 +148,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen, addlen(x, &buf, &buflen); len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type))); T(addstr(tmp, len, &buf, &buflen)); + if (rdlen == 0) + return (buf - obuf); T(spaced = addtab(x + len, 16, spaced, &buf, &buflen)); /* @@ -605,6 +610,36 @@ ns_sprintrrf(const u_char *msg, size_t msglen, break; } + case ns_t_tkey: { + /* KJD - need to complete this */ + u_long t; + int mode, err, keysize; + + /* Algorithm name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Inception. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Experation. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Mode , Error, Key Size. */ + /* Priority, Weight, Port. */ + mode = ns_get16(rdata); rdata += NS_INT16SZ; + err = ns_get16(rdata); rdata += NS_INT16SZ; + keysize = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize)); + T(addstr(tmp, len, &buf, &buflen)); + + /* needs to dump key, print otherdata length & other data */ + break; + } case ns_t_tsig: { /* BEW - need to complete this */ int n; @@ -752,7 +787,9 @@ addname(const u_char *msg, size_t msglen, if (n < 0) goto enospc; /* Guess. */ newlen = prune_origin(*buf, origin); - if (newlen == 0) { + if (**buf == '\0') { + goto root; + } else if (newlen == 0) { /* Use "@" instead of name. */ if (newlen + 2 > *buflen) goto enospc; /* No room for "@\0". */ @@ -763,6 +800,7 @@ addname(const u_char *msg, size_t msglen, (origin[0] != '.' && origin[1] != '\0' && (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { /* No trailing dot. */ + root: if (newlen + 2 > *buflen) goto enospc; /* No room for ".\0". */ (*buf)[newlen++] = '.'; diff --git a/contrib/bind/lib/nameser/ns_sign.c b/contrib/bind/lib/nameser/ns_sign.c index 75af894..05a038a 100644 --- a/contrib/bind/lib/nameser/ns_sign.c +++ b/contrib/bind/lib/nameser/ns_sign.c @@ -16,7 +16,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_sign.c,v 8.8 1999/10/13 16:39:36 vixie Exp $"; +static const char rcsid[] = "$Id: ns_sign.c,v 8.9 2000/12/23 08:14:57 vixie Exp $"; #endif /* Import. */ @@ -37,6 +37,7 @@ static const char rcsid[] = "$Id: ns_sign.c,v 8.8 1999/10/13 16:39:36 vixie Exp #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include <unistd.h> #include <isc/dst.h> diff --git a/contrib/bind/lib/resolv/Makefile b/contrib/bind/lib/resolv/Makefile index c460b6e..bfb49ec 100644 --- a/contrib/bind/lib/resolv/Makefile +++ b/contrib/bind/lib/resolv/Makefile @@ -13,12 +13,12 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -# $Id: Makefile,v 8.34 2000/07/11 06:41:42 vixie Exp $ +# $Id: Makefile,v 8.35 2000/12/23 08:03:03 vixie Exp $ # these are only appropriate for BSD 4.4 or derivatives, and are used in # development. normal builds will be done in the top level directory and # this Makefile will be invoked with a lot of overrides for the following: -SYSTYPE= bsdos +SYSTYPE= freebsd DESTDIR = DESTLIB = /usr/local/lib O=o @@ -26,7 +26,7 @@ A=a CC= cc LD= ld SHELL= /bin/sh -CDEBUG= -g +CDEBUG= -g -Wall TOP= ../.. INCL = ${TOP}/include PORTINCL = ${TOP}/port/${SYSTYPE}/include diff --git a/contrib/bind/lib/resolv/res_data.c b/contrib/bind/lib/resolv/res_data.c index 7688637..559e860 100644 --- a/contrib/bind/lib/resolv/res_data.c +++ b/contrib/bind/lib/resolv/res_data.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: res_data.c,v 8.17 1999/10/13 17:11:31 vixie Exp $"; +static const char rcsid[] = "$Id: res_data.c,v 8.18 2000/12/23 08:14:58 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -80,7 +80,6 @@ struct __res_state _res /* Proto. */ int res_ourserver_p(const res_state, const struct sockaddr_in *); -void res_pquery(const res_state, const u_char *, int, FILE *); int res_init(void) { diff --git a/contrib/bind/lib/resolv/res_debug.c b/contrib/bind/lib/resolv/res_debug.c index 180d67f..7f2453a 100644 --- a/contrib/bind/lib/resolv/res_debug.c +++ b/contrib/bind/lib/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 8.34 2000/02/29 05:30:55 vixie Exp $"; +static const char rcsid[] = "$Id: res_debug.c,v 8.37 2000/11/13 05:22:53 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -442,6 +442,7 @@ const struct res_sym __p_type_syms[] = { {ns_t_nimloc, "NIMLOC", "NIMROD locator (unimplemented)"}, {ns_t_srv, "SRV", "server selection"}, {ns_t_atma, "ATMA", "ATM address (unimplemented)"}, + {ns_t_tkey, "TKEY", "tkey"}, {ns_t_tsig, "TSIG", "transaction signature"}, {ns_t_ixfr, "IXFR", "incremental zone transfer"}, {ns_t_axfr, "AXFR", "zone transfer"}, @@ -629,7 +630,7 @@ precsize_ntoa(prec) val = mantissa * poweroften[exponent]; - (void) sprintf(retbuf, "%ld.%.2ld", val/100, val%100); + (void) sprintf(retbuf, "%lu.%.2lu", val/100, val%100); return (retbuf); } @@ -898,8 +899,8 @@ loc_ntoa(binary, ascii) int latdeg, latmin, latsec, latsecfrac; int longdeg, longmin, longsec, longsecfrac; - char northsouth, eastwest; - int altmeters, altfrac, altsign; + char northsouth, eastwest, *altsign; + int altmeters, altfrac; const u_int32_t referencealt = 100000 * 100; @@ -933,10 +934,10 @@ loc_ntoa(binary, ascii) GETLONG(templ, cp); if (templ < referencealt) { /* below WGS 84 spheroid */ altval = referencealt - templ; - altsign = -1; + altsign = "-"; } else { altval = templ - referencealt; - altsign = 1; + altsign = ""; } if (latval < 0) { @@ -968,7 +969,7 @@ loc_ntoa(binary, ascii) longdeg = longval; altfrac = altval % 100; - altmeters = (altval / 100) * altsign; + altmeters = (altval / 100); if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL) sizestr = error; @@ -978,10 +979,10 @@ loc_ntoa(binary, ascii) vpstr = error; sprintf(ascii, - "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm", + "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %s%d.%.2dm %sm %sm %sm", latdeg, latmin, latsec, latsecfrac, northsouth, longdeg, longmin, longsec, longsecfrac, eastwest, - altmeters, altfrac, sizestr, hpstr, vpstr); + altsign, altmeters, altfrac, sizestr, hpstr, vpstr); if (sizestr != error) free(sizestr); diff --git a/contrib/bind/lib/resolv/res_findzonecut.c b/contrib/bind/lib/resolv/res_findzonecut.c index e65faa1..2e8df2c 100644 --- a/contrib/bind/lib/resolv/res_findzonecut.c +++ b/contrib/bind/lib/resolv/res_findzonecut.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_findzonecut.c,v 8.9 1999/12/21 09:33:34 cyarnell Exp $"; +static const char rcsid[] = "$Id: res_findzonecut.c,v 8.12 2000/11/22 01:20:44 marka Exp $"; #endif /* not lint */ /* @@ -128,8 +128,6 @@ static void dprintf(const char *, ...); * match our dname (since that would have been returned in the answer * section). an authority section SOA has to be "above" our dname. * - * we cannot fail to find an SOA in this way. ultimately we'll return - * a zname indicating the root zone if that's the closest enclosing zone. * however, since authority section SOA's were once optional, it's * possible that we'll have to go hunting for the enclosing SOA by * ripping labels off the front of our dname -- this is known as "doing @@ -369,7 +367,7 @@ get_ns(res_state statp, const char *zname, ns_class class, rrset_ns *nsrrsp) { /* Go and get the NS RRs for this zone. */ n = do_query(statp, zname, class, ns_t_ns, resp, &msg); if (n != 0) { - DPRINTF(("get_ns: do_query('zname', %s) failed (%d)", + DPRINTF(("get_ns: do_query('%s', %s) failed (%d)", zname, p_class(class), n)); return (-1); } @@ -471,6 +469,7 @@ save_ns(res_state statp, ns_msg *msg, ns_sect sect, free(nsrr); return (-1); } + INIT_LINK(nsrr, link); INIT_LIST(nsrr->addrs); APPEND(*nsrrsp, nsrr, link); } @@ -510,6 +509,7 @@ save_a(res_state statp, ns_msg *msg, ns_sect sect, DPRINTF(("save_a: malloc failed")); return (-1); } + INIT_LINK(arr, link); memcpy(&arr->addr, ns_rr_rdata(rr), NS_INADDRSZ); APPEND(*arrsp, arr, link); } diff --git a/contrib/bind/lib/resolv/res_init.c b/contrib/bind/lib/resolv/res_init.c index 12d9969..3ea9f02 100644 --- a/contrib/bind/lib/resolv/res_init.c +++ b/contrib/bind/lib/resolv/res_init.c @@ -70,7 +70,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static const char rcsid[] = "$Id: res_init.c,v 8.16 2000/05/09 07:10:12 vixie Exp $"; +static const char rcsid[] = "$Id: res_init.c,v 8.17 2000/11/08 06:47:37 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -350,6 +350,15 @@ __res_vinit(res_state statp, int preinit) { #endif (void) fclose(fp); } +/* + * Last chance to get a nameserver. This should not normally + * be necessary + */ +#ifdef NO_RESOLV_CONF + if(nserv == 0) + nserv = get_nameservers(statp); +#endif + if (statp->defdname[0] == 0 && gethostname(buf, sizeof(statp->defdname) - 1) == 0 && (cp = strchr(buf, '.')) != NULL) diff --git a/contrib/bind/lib/resolv/res_mkupdate.c b/contrib/bind/lib/resolv/res_mkupdate.c index 14e1a60..ecf66dd 100644 --- a/contrib/bind/lib/resolv/res_mkupdate.c +++ b/contrib/bind/lib/resolv/res_mkupdate.c @@ -21,7 +21,7 @@ */ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_mkupdate.c,v 1.24 1999/10/13 17:11:32 vixie Exp $"; +static const char rcsid[] = "$Id: res_mkupdate.c,v 1.25 2000/11/22 01:20:46 marka Exp $"; #endif /* not lint */ #include "port_before.h" @@ -861,6 +861,8 @@ res_mkupdrec(int section, const char *dname, free((char *)rrecp); return (NULL); } + INIT_LINK(rrecp, r_link); + INIT_LINK(rrecp, r_glink); rrecp->r_class = class; rrecp->r_type = type; rrecp->r_ttl = ttl; diff --git a/contrib/bind/lib/resolv/res_send.c b/contrib/bind/lib/resolv/res_send.c index af674a1..462d65d 100644 --- a/contrib/bind/lib/resolv/res_send.c +++ b/contrib/bind/lib/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 8.38 2000/03/30 20:16:51 vixie Exp $"; +static const char rcsid[] = "$Id: res_send.c,v 8.41 2000/12/23 08:14:58 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -128,10 +128,6 @@ static int pselect(int, void *, void *, void *, const sigset_t *); #endif -/* Reachover. */ - -void res_pquery(const res_state, const u_char *, int, FILE *); - /* Public. */ /* int @@ -284,8 +280,10 @@ res_nsend(res_state statp, needclose++; break; } - if (needclose) + if (needclose) { res_nclose(statp); + EXT(statp).nscount = 0; + } } /* @@ -308,11 +306,16 @@ res_nsend(res_state statp, (statp->options & RES_BLAST) == 0) { struct sockaddr_in ina; int lastns = statp->nscount - 1; + int fd; ina = statp->nsaddr_list[0]; - for (ns = 0; ns < lastns; ns++) + fd = EXT(statp).nssocks[0]; + for (ns = 0; ns < lastns; ns++) { statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1]; + EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1]; + } statp->nsaddr_list[lastns] = ina; + EXT(statp).nssocks[lastns] = fd; } /* @@ -347,7 +350,7 @@ res_nsend(res_state statp, case res_error: /*FALLTHROUGH*/ default: - return (-1); + goto fail; } } while (!done); } @@ -362,7 +365,7 @@ res_nsend(res_state statp, n = send_vc(statp, buf, buflen, ans, anssiz, &terrno, ns); if (n < 0) - return (-1); + goto fail; if (n == 0) goto next_ns; resplen = n; @@ -371,7 +374,7 @@ res_nsend(res_state statp, n = send_dg(statp, buf, buflen, ans, anssiz, &terrno, ns, &v_circuit, &gotsomewhere); if (n < 0) - return (-1); + goto fail; if (n == 0) goto next_ns; if (v_circuit) @@ -394,7 +397,7 @@ res_nsend(res_state statp, * or if we haven't been asked to keep a socket open, * close the socket. */ - if (v_circuit && (statp->options & RES_USEVC) == 0 || + if ((v_circuit && (statp->options & RES_USEVC) == 0) || (statp->options & RES_STAYOPEN) == 0) { res_nclose(statp); } @@ -422,7 +425,7 @@ res_nsend(res_state statp, case res_error: /*FALLTHROUGH*/ default: - return (-1); + goto fail; } } while (!done); @@ -440,6 +443,9 @@ res_nsend(res_state statp, } else errno = terrno; return (-1); + fail: + res_nclose(statp); + return (-1); } /* Private */ @@ -686,9 +692,16 @@ send_dg(res_state statp, now = evNowTime(); timeout = evConsTime(seconds, 0); finish = evAddTime(now, timeout); + goto nonow; wait: + now = evNowTime(); + nonow: FD_ZERO(&dsmask); FD_SET(s, &dsmask); + if (evCmpTime(finish, now) > 0) + timeout = evSubTime(finish, now); + else + timeout = evConsTime(0, 0); n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL); if (n == 0) { Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n")); @@ -696,13 +709,8 @@ send_dg(res_state statp, return (0); } if (n < 0) { - if (errno == EINTR) { - now = evNowTime(); - if (evCmpTime(finish, now) > 0) { - timeout = evSubTime(finish, now); - goto wait; - } - } + if (errno == EINTR) + goto wait; Perror(statp, stderr, "select", errno); res_nclose(statp); return (0); diff --git a/contrib/bind/lib/resolv/res_sendsigned.c b/contrib/bind/lib/resolv/res_sendsigned.c index efa463c..b450926 100644 --- a/contrib/bind/lib/resolv/res_sendsigned.c +++ b/contrib/bind/lib/resolv/res_sendsigned.c @@ -78,6 +78,7 @@ res_nsendsigned(res_state statp, const u_char *msg, int msglen, if (ret < 0) { free (nstatp); free (newmsg); + dst_free_key(dstkey); if (ret == NS_TSIG_ERROR_NO_SPACE) errno = EMSGSIZE; else if (ret == -1) @@ -98,6 +99,7 @@ retry: if (ret < 0) { free (nstatp); free (newmsg); + dst_free_key(dstkey); return (ret); } @@ -109,6 +111,7 @@ retry: (stdout, ";; TSIG invalid (%s)\n", p_rcode(ret))); free (nstatp); free (newmsg); + dst_free_key(dstkey); if (ret == -1) errno = EINVAL; else @@ -126,5 +129,6 @@ retry: free (nstatp); free (newmsg); + dst_free_key(dstkey); return (anslen); } diff --git a/contrib/bind/lib/resolv/res_update.c b/contrib/bind/lib/resolv/res_update.c index bb2456e..685e467 100644 --- a/contrib/bind/lib/resolv/res_update.c +++ b/contrib/bind/lib/resolv/res_update.c @@ -1,5 +1,5 @@ #if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: res_update.c,v 1.24 1999/10/15 19:49:12 vixie Exp $"; +static const char rcsid[] = "$Id: res_update.c,v 1.25 2000/11/22 01:20:47 marka Exp $"; #endif /* not lint */ /* @@ -129,6 +129,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) { } *zptr = tgrp; zptr->z_flags = 0; + INIT_LINK(zptr, z_link); INIT_LIST(zptr->z_rrlist); APPEND(zgrps, zptr, z_link); } |