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/resolv | |
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/resolv')
-rw-r--r-- | contrib/bind/lib/resolv/Makefile | 6 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_data.c | 3 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_debug.c | 19 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_findzonecut.c | 8 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_init.c | 11 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_mkupdate.c | 4 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_send.c | 46 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_sendsigned.c | 4 | ||||
-rw-r--r-- | contrib/bind/lib/resolv/res_update.c | 3 |
9 files changed, 64 insertions, 40 deletions
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); } |