Apply with "patch -E -p0" from the top of your source tree.

Index: dist/bind/README
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/README,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 README
--- dist/bind/README	1999/12/04 16:51:38	1.1.2.1
+++ dist/bind/README	2000/11/18 22:20:09
@@ -1,4 +1,4 @@
-This is the source portion of BIND version 8.2.2, Patchlevel 5.  Its
+This is the source portion of BIND version 8.2.2, Patchlevel 7.  Its
 companions are "doc" and "contrib" so you are probably not missing anything.
 
 See the CHANGES file for a detailed listing of all changes.  See the INSTALL
Index: dist/bind/bind2netbsd
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bind2netbsd,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 bind2netbsd
--- dist/bind/bind2netbsd	1999/12/04 16:51:43	1.9.2.1
+++ dist/bind/bind2netbsd	2000/11/18 22:20:09
@@ -66,7 +66,7 @@
 
 ### Copy the files and directories
 cd $r/src
-pax -rvw LICENSE README bin include lib $d
+pax -rvw LICENSE LICENSE_RSA README bin include lib $d
 cd $r/src/port/netbsd/include
 pax -rvw port_after.h port_before.h prand_conf.h $d/include
 cd $r/src/port/netbsd/bin
@@ -78,11 +78,22 @@
 cd $d/lib
 rm -r bsd cylink dnssafe
 
+### Remove yacc/lex-generated files
+cd $d/bin
+rm -f named/ns_parser.c named/ns_parser.h
+rm -f nslookup/commands.c
+
 ### Remove .cvsignore, Makefiles and *.mdoc files
 find $d -name '.cvsignore' -exec rm {} \;
 find $d -name 'Makefile' -exec rm {} \;
 cd $d/lib/isc && rm *.mdoc
 
+### Remove the $'s around the Header:
+find $d -type f -print | while read f; do
+	sed -e ' s/\$\(Header.*\) \$/\1/' < $f > /tmp/bind1f$$ && mv /tmp/bind1f$$ $f && \
+	echo removed \$Header tag from $f
+done
+
 ### Remove the $'s around the Id:
 find $d -type f -print | while read f; do
 	sed -e ' s/\$\(Id.*\) \$/\1/' < $f > /tmp/bind1f$$ && mv /tmp/bind1f$$ $f && \
@@ -124,6 +135,7 @@
 # Make sure you add the RCS Id before you do the import.
 # This is the list of missing files as of 8.2.2-P5:
 # LICENSE
+# LICENSE_RSA
 # README
 # bin/probe_ipv6
 # bin/irpd/irs-irpd.conf
Index: dist/bind/bin/named/ns_config.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_config.c,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 ns_config.c
--- dist/bind/bin/named/ns_config.c	1999/12/04 16:54:13	1.2.2.1
+++ dist/bind/bin/named/ns_config.c	2000/11/18 22:20:09
@@ -1,7 +1,7 @@
 /*	$NetBSD: ns_config.c,v 1.2.2.1 1999/12/04 16:54:13 he Exp $	*/
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_config.c,v 8.104 1999/11/08 23:09:42 vixie Exp";
+static const char rcsid[] = "Id: ns_config.c,v 8.105 1999/11/16 06:01:37 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -3059,4 +3059,6 @@
 
 	initial_configuration = 0;
 	loading = 0;
+	/* release queued notifies */
+	notify_afterload();
 }
Index: dist/bind/bin/named/ns_ctl.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_ctl.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 ns_ctl.c
--- dist/bind/bin/named/ns_ctl.c	2000/10/10 21:12:23	1.1.2.2
+++ dist/bind/bin/named/ns_ctl.c	2000/11/18 22:20:10
@@ -1,7 +1,7 @@
 /*	$NetBSD: ns_ctl.c,v 1.1.2.2 2000/10/10 21:12:23 he Exp $	*/
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_ctl.c,v 8.28 1999/10/13 16:39:04 vixie Exp";
+static const char rcsid[] = "Id: ns_ctl.c,v 8.28.2.1 2000/11/09 23:15:28 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -248,6 +248,7 @@
 	/* Add any new controls which were found. */
 	for (ctl = HEAD(*new); ctl != NULL; ctl = next) {
 		next = NEXT(ctl, link);
+		UNLINK(*new, ctl, link);
 		APPEND(server_controls, ctl, link);
 		install(ctl);
 		if (ctl->sctx == NULL)
Index: dist/bind/bin/named/ns_defs.h
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_defs.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ns_defs.h
--- dist/bind/bin/named/ns_defs.h	1999/12/04 16:54:24	1.1.2.1
+++ dist/bind/bin/named/ns_defs.h	2000/11/18 22:20:10
@@ -2,7 +2,7 @@
 
 /*
  *	from ns.h	4.33 (Berkeley) 8/23/90
- *	Id: ns_defs.h,v 8.89 1999/10/07 08:24:08 vixie Exp
+ *	Id: ns_defs.h,v 8.89.2.1 2000/11/09 04:01:21 marka Exp
  */
 
 /*
@@ -604,7 +604,7 @@
 #define STREAM_CONNECT_EV	0x08
 #define STREAM_DONE_CLOSE	0x10
 #define STREAM_AXFR		0x20
-#define STREAM_AXFRIXFR		0x22
+#define STREAM_AXFRIXFR		0x40
 
 #define ALLOW_NETS	0x0001
 #define	ALLOW_HOSTS	0x0002
Index: dist/bind/bin/named/ns_forw.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_forw.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 ns_forw.c
--- dist/bind/bin/named/ns_forw.c	2000/10/10 21:12:26	1.1.2.2
+++ dist/bind/bin/named/ns_forw.c	2000/11/18 22:20:10
@@ -2,7 +2,7 @@
 
 #if !defined(lint) && !defined(SABER)
 static const char sccsid[] = "@(#)ns_forw.c	4.32 (Berkeley) 3/3/91";
-static const char rcsid[] = "Id: ns_forw.c,v 8.68 1999/10/13 16:39:07 vixie Exp";
+static const char rcsid[] = "Id: ns_forw.c,v 8.69 1999/11/16 06:01:38 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -162,7 +162,7 @@
 		}
 	}
 
-	qp = qnew(dname, class, type);
+	qp = qnew(dname, class, type, 1);
 	getname(np, tmpdomain, sizeof tmpdomain);
 	qp->q_domain = savestr(tmpdomain, 1);
 	qp->q_from = from;	/* nslookup wants to know this */
@@ -1142,7 +1142,7 @@
 }
 
 struct qinfo *
-qnew(const char *name, int class, int type) {
+qnew(const char *name, int class, int type, int forward) {
 	struct qinfo *qp;
 	const char *s;
 	int escape = 0;
@@ -1162,7 +1162,8 @@
 	qp->q_type = (u_int16_t)type;
 	qp->q_flags = 0;
 	s = name;
-	for (;;) {		/* find forwarding zone, if any */
+	qp->q_fzone = NULL;
+	for (;forward;) {		/* find forwarding zone, if any */
 		if ((qp->q_fzone = find_zone(s, class)) != NULL &&
 		    (qp->q_fzone->z_flags & Z_FORWARD_SET) != 0)
 			break;
Index: dist/bind/bin/named/ns_func.h
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_func.h,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 ns_func.h
--- dist/bind/bin/named/ns_func.h	2000/10/10 21:12:30	1.2.2.2
+++ dist/bind/bin/named/ns_func.h	2000/11/18 22:20:10
@@ -92,7 +92,7 @@
 
 /* ns_func.h - declarations for ns_*.c's externally visible functions
  *
- * Id: ns_func.h,v 8.90 1999/10/11 18:22:20 vixie Exp
+ * Id: ns_func.h,v 8.91 1999/11/16 06:01:38 vixie Exp
  */
 
 /* ++from ns_glue.c++ */
@@ -151,6 +151,7 @@
 /* ++from ns_notify.c++ */
 #ifdef BIND_NOTIFY
 void			ns_notify(const char *, ns_class, ns_type);
+void			notify_afterload(void);
 void			ns_unnotify(void);
 #endif
 /* --from ns_notify.c-- */
@@ -259,7 +260,7 @@
 			freeComplaints(void),
 			nsfwdadd(struct qinfo *, struct fwdinfo *);
 extern struct qinfo	*qfindid(u_int16_t),
-			*qnew(const char *, int, int);
+			*qnew(const char *, int, int, int);
 /* --from ns_forw.c-- */
 
 /* ++from ns_main.c++ */
Index: dist/bind/bin/named/ns_main.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_main.c,v
retrieving revision 1.4.2.3
diff -u -r1.4.2.3 ns_main.c
--- dist/bind/bin/named/ns_main.c	2000/10/10 21:12:52	1.4.2.3
+++ dist/bind/bin/named/ns_main.c	2000/11/18 22:20:10
@@ -756,6 +756,10 @@
 		sq_remove(sp);
 		return (SERVFAIL);
 	}
+	if (fcntl(sp->s_rfd, F_SETFD, 1) < 0) {
+		sq_remove(sp);
+		return (SERVFAIL);
+	}
 	if (sq_openw(sp, qp->q_msglen + INT16SZ) == -1) {
 		sq_remove(sp);
 		return (SERVFAIL);
@@ -1433,6 +1437,11 @@
 		ns_notice(ns_log_default, "fcntl(dfd, F_DUPFD, 20): %s",
 			  strerror(errno));
 #endif
+	if (fcntl(ifp->dfd, F_SETFD, 1) < 0) {
+		ns_error(ns_log_default, "F_SETFD: %s", strerror(errno));
+		close(ifp->dfd);
+		return (-1);
+	}
 	ns_debug(ns_log_default, 1, "ifp->addr %s d_dfd %d",
 		 sin_ntoa(nsa), ifp->dfd);
 	if (setsockopt(ifp->dfd, SOL_SOCKET, SO_REUSEADDR,
@@ -1518,6 +1527,11 @@
 		ns_notice(ns_log_default, "fcntl(sfd, F_DUPFD, 20): %s",
 			  strerror(errno));
 #endif
+	if (fcntl(ifp->sfd, F_SETFD, 1) < 0) {
+		ns_error(ns_log_default, "F_SETFD: %s", strerror(errno));
+		close(ifp->sfd);
+		return (-1);
+	}
 	if (setsockopt(ifp->sfd, SOL_SOCKET, SO_REUSEADDR,
 		       (char *)&on, sizeof on) != 0) {
 		ns_notice(ns_log_default, "setsockopt(REUSEADDR): %s",
@@ -1619,6 +1633,8 @@
 			 strerror(errno));
 	if (ds > evHighestFD(ev))
 		ns_panic(ns_log_default, 1, "socket too high: %d", ds);
+	if (fcntl(ds, F_SETFD, 1) < 0)
+		ns_panic(ns_log_default, 1, "F_SETFD: %s", strerror(errno));
 	if (setsockopt(ds, SOL_SOCKET, SO_REUSEADDR,
 	    (char *)&on, sizeof on) != 0) {
 		ns_notice(ns_log_default, "setsockopt(REUSEADDR): %s",
Index: dist/bind/bin/named/ns_notify.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_notify.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ns_notify.c
--- dist/bind/bin/named/ns_notify.c	1999/12/04 16:55:23	1.1.2.1
+++ dist/bind/bin/named/ns_notify.c	2000/11/18 22:20:10
@@ -1,7 +1,7 @@
 /*	$NetBSD: ns_notify.c,v 1.1.2.1 1999/12/04 16:55:23 he Exp $	*/
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_notify.c,v 8.4 1999/10/15 19:49:04 vixie Exp";
+static const char rcsid[] = "Id: ns_notify.c,v 8.5 1999/11/16 06:01:39 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -80,6 +80,7 @@
 /* Local. */
 
 static LIST(struct notify) pending_notifies;
+static LIST(struct notify) loading_notifies;
 
 /* Public. */
 
@@ -125,6 +126,11 @@
 	ni->type = type;
 	evInitID(&ni->timer);
 
+	if (loading != 0) {
+		APPEND(loading_notifies, ni, link);
+		return;
+	}
+
 	/* Delay notification for from five seconds up to fifteen minutes. */
 	max_delay = MIN(nzones/5, 895);
 	max_delay = MAX(max_delay, 25);
@@ -146,6 +152,19 @@
 		 (dname && *dname) ? dname : ".",
 		 p_class(class), p_type(type),
 		 ni, zp, delay);
+}
+
+void
+notify_afterload() {
+	struct notify *ni;
+
+	INSIST(loading == 0);
+	while ((ni = HEAD(loading_notifies)) != NULL) {
+		UNLINK(loading_notifies, ni, link);
+		ns_notify(ni->name, ni->class, ni->type);
+		freestr(ni->name);
+		memput(ni, sizeof *ni);
+	}
 }
 
 /*
Index: dist/bind/bin/named/ns_parser.h
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/Attic/ns_parser.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ns_parser.h
--- dist/bind/bin/named/ns_parser.h	1999/12/04 16:55:27	1.1.2.1
+++ dist/bind/bin/named/ns_parser.h	2000/11/18 22:20:10
@@ -1,6 +1,3 @@
-/*	$NetBSD: ns_parser.h,v 1.1.2.1 1999/12/04 16:55:27 he Exp $	*/
-
-#define YYEMPTY (-1)
 #define L_EOS 257
 #define L_IPADDR 258
 #define L_NUMBER 259
Index: dist/bind/bin/named/ns_req.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_req.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ns_req.c
--- dist/bind/bin/named/ns_req.c	1999/12/04 16:55:46	1.1.2.1
+++ dist/bind/bin/named/ns_req.c	2000/11/18 22:20:10
@@ -2,7 +2,7 @@
 
 #if !defined(lint) && !defined(SABER)
 static const char sccsid[] = "@(#)ns_req.c	4.47 (Berkeley) 7/1/91";
-static const char rcsid[] = "Id: ns_req.c,v 8.104 1999/10/15 19:49:04 vixie Exp";
+static const char rcsid[] = "Id: ns_req.c,v 8.104.2.2 2000/11/09 23:15:29 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -1115,7 +1115,7 @@
 		if (qsp == NULL)
 			return (Finish);
 		else {
-			if (!ixfr_found) {
+			if (!ixfr_found && type == ns_t_ixfr) {
 				qsp->flags |= STREAM_AXFRIXFR;
 				hp->qdcount = htons(1);
 			}
@@ -1593,11 +1593,11 @@
 	}
 #endif
 	if ((n = dn_comp(name, buf, buflen, comp_ptrs, edp)) < 0)
-		return (-1);
+		goto cleanup;
 	cp = buf + n;
 	buflen -= n;
 	if (buflen < 0)
-		return (-1);
+		goto cleanup;
 	PUTSHORT((u_int16_t)type, cp);
 	PUTSHORT((u_int16_t)dp->d_class, cp);
 	PUTLONG(ttl, cp);
@@ -1610,7 +1610,7 @@
 	case T_PTR:
 		n = dn_comp((char *)dp->d_data, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		PUTSHORT((u_int16_t)n, sp);
 		cp += n;
 		break;
@@ -1620,7 +1620,7 @@
 		/* Store domain name in answer */
 		n = dn_comp((char *)dp->d_data, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		PUTSHORT((u_int16_t)n, sp);
 		cp += n;
 		if (doadd) {
@@ -1636,15 +1636,15 @@
 		cp1 = dp->d_data;
 		n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 		buflen -= type == T_SOA ? n + 5 * INT32SZ : n;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
 		cp1 += strlen((char *)cp1) + 1;
 		n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 		if (type == T_SOA) {
 			cp1 += strlen((char *)cp1) + 1;
@@ -1672,7 +1672,7 @@
  		/* copy order */
 		buflen -= INT16SZ;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
  		memcpy(cp, cp1, INT16SZ);
  		cp += INT16SZ;
  		cp1 += INT16SZ;
@@ -1682,7 +1682,7 @@
 		/* copy preference */
 		buflen -= INT16SZ;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
 		memcpy(cp, cp1, INT16SZ);
 		cp += INT16SZ;
 		cp1 += INT16SZ;
@@ -1694,7 +1694,7 @@
 		ns_debug(ns_log_default, 1, "size of n at flags = %d", n);
 		buflen -= n + 1;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
 		*cp++ = n;
 		memcpy(cp, cp1, n);
 		cp += n;
@@ -1706,7 +1706,7 @@
 		n = *cp1++;
 		buflen -= n + 1;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
 		*cp++ = n;
 		memcpy(cp, cp1, n);
 		cp += n;
@@ -1718,7 +1718,7 @@
 		n = *cp1++;
 		buflen -= n + 1;
 		if (buflen < 0)
-			return (-1);
+			goto cleanup;
 		*cp++ = n;
 		memcpy(cp, cp1, n);
 		cp += n;
@@ -1731,7 +1731,7 @@
 		n = dn_comp((char *)cp1, cp, buflen, dnptrs, edp);
 		ns_debug(ns_log_default, 1, "dn_comp's n = %u", n);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 
 		/* save data length */
@@ -1749,7 +1749,7 @@
 		cp1 = dp->d_data;
 
  		if ((buflen -= INT16SZ) < 0)
-			return (-1);
+			goto cleanup;
 
  		/* copy preference */
  		memcpy(cp, cp1, INT16SZ);
@@ -1759,7 +1759,7 @@
 		if (type == T_SRV) {
 			buflen -= INT16SZ*2;
 			if (buflen < 0)
-				return (-1);
+				goto cleanup;
 			memcpy(cp, cp1, INT16SZ*2);
 			cp += INT16SZ*2;
 			cp1 += INT16SZ*2;
@@ -1769,7 +1769,7 @@
 			    (type == ns_t_mx) ? comp_ptrs : NULL,
 			    (type == ns_t_mx) ? edp : NULL);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 
 		/* save data length */
@@ -1783,7 +1783,7 @@
 		cp1 = dp->d_data;
 
 		if ((buflen -= INT16SZ) < 0)
-			return (-1);
+			goto cleanup;
 
 		/* copy preference */
 		memcpy(cp, cp1, INT16SZ);
@@ -1792,13 +1792,13 @@
 
 		n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 		buflen -= n;
 		cp1 += strlen((char *)cp1) + 1;
 		n = dn_comp((char *)cp1, cp, buflen, comp_ptrs, edp);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 
 		/* save data length */
@@ -1813,7 +1813,7 @@
 		/* first just copy over the type_covered, algorithm, */
 		/* labels, orig ttl, two timestamps, and the footprint */
 		if ((dp->d_size - 18) > buflen)
-			return (-1);  /* out of room! */
+			goto cleanup;  /* out of room! */
 		memcpy(cp, cp1, 18);
 		cp  += 18;
 		cp1 += 18;
@@ -1822,7 +1822,7 @@
 		/* then the signer's name */
 		n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 		cp += n;
 		buflen -= n;
 		cp1 += strlen((char*)cp1)+1;
@@ -1830,7 +1830,7 @@
 		/* finally, we copy over the variable-length signature */
 		n = dp->d_size - (u_int16_t)((cp1 - dp->d_data));
 		if (n > buflen)
-			return (-1);  /* out of room! */
+			goto cleanup;  /* out of room! */
 		memcpy(cp, cp1, n);
 		cp += n;
 		
@@ -1843,7 +1843,7 @@
 		cp1 = dp->d_data;
 		n = dn_comp((char *)cp1, cp, buflen, NULL, NULL);
 		if (n < 0)
-			return (-1);
+			goto cleanup;
 
 		cp += n;
 		buflen -=n;
@@ -1852,7 +1852,7 @@
 		/* copy nxt bit map */
 		n = dp->d_size - (u_int16_t)((cp1 - dp->d_data));
 		if (n > buflen)
-			return (-1);  /* out of room! */
+			goto cleanup;  /* out of room! */
 		memcpy(cp, cp1, n);
 		cp += n;
 		buflen -= n;
@@ -1866,12 +1866,17 @@
 		if ((type == T_A || type == T_AAAA) && doadd)
 			addname(name, name, type, T_KEY, dp->d_class);
 		if (dp->d_size > buflen)
-			return (-1);
+			goto cleanup;
 		memcpy(cp, dp->d_data, dp->d_size);
 		PUTSHORT((u_int16_t)dp->d_size, sp);
 		cp += dp->d_size;
 	}
 	return (cp - buf);
+
+cleanup:
+	/* Rollback RR. */
+	ns_name_rollback(buf, (const u_char **)comp_ptrs, (const u_char **)edp);
+	return (-1);
 }
 
 static void
@@ -1995,6 +2000,10 @@
 				ns_debug(ns_log_default, 5,
 			  "addinfo: not enough room, remaining msglen = %d",
 					 save_msglen);
+				/* Rollback RRset. */
+				ns_name_rollback(save_cp, 
+				    (const u_char **)dnptrs,
+				    (const u_char **)dnptrs_end);
 				cp = save_cp;
 				msglen = save_msglen;
 				count = save_count;
Index: dist/bind/bin/named/ns_resp.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/bin/named/ns_resp.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 ns_resp.c
--- dist/bind/bin/named/ns_resp.c	2000/10/10 21:13:03	1.1.2.2
+++ dist/bind/bin/named/ns_resp.c	2000/11/18 22:20:10
@@ -2,7 +2,7 @@
 
 #if !defined(lint) && !defined(SABER)
 static const char sccsid[] = "@(#)ns_resp.c	4.65 (Berkeley) 3/3/91";
-static const char rcsid[] = "Id: ns_resp.c,v 8.133 1999/11/05 04:40:57 vixie Exp";
+static const char rcsid[] = "Id: ns_resp.c,v 8.136 1999/11/16 07:10:34 vixie Exp";
 #endif /* not lint */
 
 /*
@@ -790,7 +790,7 @@
 	/* -ve $ing non-existence of record, must handle non-authoritative
 	 * NOERRORs with c == 0.
 	 */
-	if (!hp->aa && hp->rcode == NOERROR && c == 0)
+	if (!hp->aa && !hp->tc && hp->rcode == NOERROR && c == 0)
 		goto return_msg;
 
 	if (qp->q_flags & Q_SYSTEM)
@@ -2281,7 +2281,7 @@
 	nsp[0] = NULL;
 	ns_debug(ns_log_default, 3, "sysquery(%s, %d, %d, %p, %d, %d)",
 		 dname, class, type, nss, nsc, ntohs(port));
-	qp = qnew(dname, class, type);
+	qp = qnew(dname, class, type, (nss != NULL && nsc != 0) ? 0 : 1);
 
 	if (nss != NULL && nsc != 0)
 		np = NULL;
@@ -3108,7 +3108,10 @@
 
 		case cyclic_order:
 			/* first we do the non-SIG records */
-			choice = ((u_int)rand()>>3) % non_sig_count;
+			if (non_sig_count > 0)
+				choice = ((u_int)rand()>>3) % non_sig_count;
+			else
+				choice = 0;
 			for (i = 0; i < non_sig_count ; i++) {
 				dp = found[(i + choice) % non_sig_count];
 				if (foundcname != 0 && dp->d_type == T_CNAME)
Index: dist/bind/include/arpa/nameser.h
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/include/arpa/nameser.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 nameser.h
--- dist/bind/include/arpa/nameser.h	1999/12/04 17:08:58	1.1.2.1
+++ dist/bind/include/arpa/nameser.h	2000/11/18 22:20:10
@@ -51,7 +51,7 @@
  */
 
 /*
- *	Id: nameser.h,v 8.36 1999/10/15 19:49:08 vixie Exp
+ *	Id: nameser.h,v 8.36.2.1 2000/11/09 23:15:31 vixie Exp
  */
 
 #ifndef _ARPA_NAMESER_H_
@@ -491,6 +491,7 @@
 #define	ns_name_compress	__ns_name_compress
 #define	ns_name_uncompress	__ns_name_uncompress
 #define	ns_name_skip		__ns_name_skip
+#define	ns_name_rollback	__ns_name_rollback
 #define	ns_sign			__ns_sign
 #define	ns_sign_tcp		__ns_sign_tcp
 #define	ns_sign_tcp_init	__ns_sign_tcp_init
@@ -532,6 +533,8 @@
 int		ns_name_compress __P((const char *, u_char *, size_t,
 				      const u_char **, const u_char **));
 int		ns_name_skip __P((const u_char **, const u_char *));
+void		ns_name_rollback __P((const u_char *, const u_char **,
+				      const u_char **));
 int		ns_sign __P((u_char *, int *, int, int, void *,
 			     const u_char *, int, u_char *, int *, time_t));
 int		ns_sign_tcp __P((u_char *, int *, int, int,
Index: dist/bind/lib/irs/irs_data.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/lib/irs/irs_data.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 irs_data.c
--- dist/bind/lib/irs/irs_data.c	2000/03/02 20:59:09	1.1.2.2
+++ dist/bind/lib/irs/irs_data.c	2000/11/18 22:20:10
@@ -44,7 +44,6 @@
 #include "port_after.h"
 
 #include "irs_data.h"
-#undef _res
 #undef h_errno
 
 extern struct __res_state _res;
Index: dist/bind/lib/nameser/ns_name.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/lib/nameser/ns_name.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ns_name.c
--- dist/bind/lib/nameser/ns_name.c	1999/12/04 17:06:47	1.1.2.1
+++ dist/bind/lib/nameser/ns_name.c	2000/11/18 22:20:10
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "Id: ns_name.c,v 8.12 1999/10/13 17:11:23 vixie Exp";
+static const char rcsid[] = "Id: ns_name.c,v 8.12.2.1 2000/11/09 23:15:32 vixie Exp";
 #endif
 
 #include "port_before.h"
@@ -502,6 +502,23 @@
 	if (ns_name_pton(src, tmp, sizeof tmp) == -1)
 		return (-1);
 	return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
+}
+
+/*
+ * Reset dnptrs so that there are no active references to pointers at or
+ * after src.
+ */
+void
+ns_name_rollback(const u_char *src, const u_char **dnptrs,
+		const u_char **lastdnptr)
+{
+	while (dnptrs < lastdnptr && *dnptrs != NULL) {
+		if (*dnptrs >= src) {
+			*dnptrs = NULL;
+			break;
+		}
+		dnptrs++;
+	}
 }
 
 /*
Index: dist/bind/lib/resolv/res_debug.c
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/lib/resolv/res_debug.c,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 res_debug.c
--- dist/bind/lib/resolv/res_debug.c	1999/12/04 17:07:34	1.1.2.1
+++ dist/bind/lib/resolv/res_debug.c	2000/11/18 22:20:10
@@ -97,7 +97,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.32 1999/10/13 16:39:39 vixie Exp";
+static const char rcsid[] = "Id: res_debug.c,v 8.33 1999/11/16 05:48:25 vixie Exp";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -151,7 +151,8 @@
 	   int pflag, FILE *file)
 {
 	int n, sflag, rrnum;
-	char buf[2048];	/* XXX need to malloc */
+	static int buflen = 2048;
+	char *buf;
 	ns_opcode opcode;
 	ns_rr rr;
 
@@ -162,6 +163,13 @@
 	if (statp->pfcode && !sflag)
 		return;
 
+	buf = malloc(buflen);
+	if (buf == NULL) {
+		fprintf(file, ";; memory allocation failure\n");
+		return;
+	}
+		
+
 	opcode = (ns_opcode) ns_msg_getflag(*handle, ns_f_opcode);
 	rrnum = 0;
 	for (;;) {
@@ -172,7 +180,7 @@
 			else if (rrnum > 0 && sflag != 0 &&
 				 (statp->pfcode & RES_PRF_HEAD1))
 				putc('\n', file);
-			return;
+			goto cleanup;
 		}
 		if (rrnum == 0 && sflag != 0 && (statp->pfcode & RES_PRF_HEAD1))
 			fprintf(file, ";; %s SECTION:\n",
@@ -184,17 +192,30 @@
 				p_class(ns_rr_class(rr)));
 		else {
 			n = ns_sprintrr(handle, &rr, NULL, NULL,
-					buf, sizeof buf);
+					buf, buflen);
 			if (n < 0) {
+				if (errno == ENOSPC) {
+					free(buf);
+					buf = malloc(buflen += 1024);
+					if (buf == NULL) {
+						fprintf(file,
+				              ";; memory allocation failure\n");
+					      return;
+					}
+					continue;
+				}
 				fprintf(file, ";; ns_sprintrr: %s\n",
 					strerror(errno));
-				return;
+				goto cleanup;
 			}
 			fputs(buf, file);
 			fputc('\n', file);
 		}
 		rrnum++;
 	}
+ cleanup:
+	if (buf != NULL)
+		free(buf);
 }
 
 /*
Index: dist/bind/man/dnskeygen.1
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/man/dnskeygen.1,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 dnskeygen.1
--- dist/bind/man/dnskeygen.1	1999/12/04 17:09:55	1.1.2.1
+++ dist/bind/man/dnskeygen.1	2000/11/18 22:20:10
@@ -37,10 +37,10 @@
 .Op Cm Fl s Ar num
 .Fl n Ar name
 .Sh DESCRIPTION
-.Ic Dnskeygen
+.Nm
 (DNS Key Generator) is a tool to generate and maintain keys for DNS Security
 within the DNS (Domain Name System).
-.Nm Dnskeygen
+.Nm
 can generate public and private keys to authenticate zone data, and shared
 secret keys to be used for Request/Transaction signatures.
 .Bl -tag -width Fl
Index: dist/bind/man/named.8
===================================================================
RCS file: /cvsroot/basesrc/dist/bind/man/named.8,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 named.8
--- dist/bind/man/named.8	1999/12/04 17:10:16	1.2.2.1
+++ dist/bind/man/named.8	2000/11/18 22:20:10
@@ -77,7 +77,7 @@
 .Op Fl w Ar directory
 .Op Ar config_file
 .Sh DESCRIPTION
-.Ic Named
+.Nm
 is the Internet domain name server.
 See RFC's 1033, 1034, and 1035 for more information on the Internet
 name-domain system.  Without any arguments,
@@ -96,7 +96,7 @@
 .Pp
 .Sy NOTE:
 Several of 
-.Nm named Ns 's
+.Nm "" Ns 's
 options, and much more of its behaviour, can be controlled in the configuration 
 file.  Please refer to the configuration file guide included with this 
 .Sy BIND
@@ -116,7 +116,7 @@
 .Sy NOTE:
 The new debugging framework is considerably more sophisticated than it
 was in older versions of 
-.Nm NAMED .
+.Nm "" .
 The configuration file's
 .Dq Li logging
 statement allows for multiple, distinct levels of debugging for each of
@@ -126,7 +126,7 @@
 distribution for further information about these extensive new capabilities.
 .It Fl p Ar port#
 Use the specified remote port number; this is the port number to which 
-.Nm NAMED
+.Nm
 will send queries.  The default value is the standard port number, i.e.,
 the port number returned by 
 .Xr getservbyname 3 
@@ -141,7 +141,7 @@
 servers, and the second one was the service port bound by the 
 .Em local 
 instance of
-.Nm NAMED .
+.Nm "" .
 The current usage is equivalent to the old usage without the 
 .Ar localport#
 specified; this functionality can be specified with the 
@@ -166,7 +166,7 @@
 and daemonize.  (The default is to daemonize.)
 .It Fl q
 Trace all incoming queries if 
-.Nm NAMED 
+.Nm
 has been compiled with
 .Li QRYLOG 
 defined.  
Index: usr.sbin/bind/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/bind/Makefile,v
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1.2.1 Makefile
--- usr.sbin/bind/Makefile	1999/12/04 17:10:37	1.1.1.1.2.1
+++ usr.sbin/bind/Makefile	2000/11/18 22:20:10
@@ -12,6 +12,6 @@
 depend-named-xfer depend-ndc: depend-named
 all-named-xfer all-ndc: all-named
 
-VER= 8.2.2-P5
+VER= 8.2.2-P7
 
 .include <bsd.subdir.mk>
Index: usr.sbin/bind/named/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/bind/named/Makefile,v
retrieving revision 1.5.2.1
diff -u -r1.5.2.1 Makefile
--- usr.sbin/bind/named/Makefile	1999/12/04 17:11:09	1.5.2.1
+++ usr.sbin/bind/named/Makefile	2000/11/18 22:20:10
@@ -14,10 +14,11 @@
 		ns_resp.c ns_stats.c ns_ncache.c ns_xfr.c ns_glue.c \
 		ns_udp.c ns_config.c ns_update.c ns_ixfr.c ns_signal.c \
 		ns_sort.c ns_notify.c tmp_version.c
-CPPFLAGS+=	${INCLUDE}
+CPPFLAGS+=	${INCLUDE} -I${BIND_DIST_DIR}/bin/named
 LDADD=		${LIBRARY}
 CLEANFILES+=	y.tab.h named-bootconf tmp_version.c pathnames.h
 MAN=		${PROG}.8 named.conf.5
+YHEADER=	yes
 
 HOSTNAMECMD=	hostname
 
Index: usr.sbin/bind/nslookup/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/bind/nslookup/Makefile,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 Makefile
--- usr.sbin/bind/nslookup/Makefile	1999/12/04 17:11:18	1.2.2.1
+++ usr.sbin/bind/nslookup/Makefile	2000/11/18 22:20:10
@@ -7,7 +7,7 @@
 BINDIR=	/usr/bin
 PROG=	nslookup
 SRCS=	main.c getinfo.c debug.c send.c skip.c list.c subr.c commands.l
-CPPFLAGS+= ${INCLUDE}
+CPPFLAGS+= ${INCLUDE} -I${BIND_DIST_DIR}/bin/nslookup
 DPADD=	${LIBL}
 LDADD=	-ll ${LIBRARY}
 MAN=	${PROG}.8
Index: dist/bind/LICENSE_RSA
--- /dev/null	Sat Nov 18 23:12:59 2000
+++ dist/bind/LICENSE_RSA	Sat Nov 18 23:12:39 2000
@@ -0,0 +1,43 @@
+			DNSSAFE LICENSE TERMS
+
+This BIND software includes the DNSsafe software from RSA Data
+Security, Inc., which is copyrighted software that can only be
+distributed under the terms of this license agreement.
+
+The DNSsafe software cannot be used or distributed separately from the
+BIND software.  You only have the right to use it or distribute it as
+a bundled, integrated product.
+
+The DNSsafe software can ONLY be used to provide authentication for
+resource records in the Domain Name System, as specified in RFC 2065
+and successors.  You cannot modify the BIND software to use the
+DNSsafe software for other purposes, or to make its cryptographic
+functions available to end-users for other uses.
+
+If you modify the DNSsafe software itself, you cannot modify its
+documented API, and you must grant RSA Data Security the right to use,
+modify, and distribute your modifications, including the right to use
+any patents or other intellectual property that your modifications
+depend upon.
+
+You must not remove, alter, or destroy any of RSA's copyright notices
+or license information.  When distributing the software to the Federal
+Government, it must be licensed to them as "commercial computer
+software" protected under 48 CFR 12.212 of the FAR, or 48 CFR
+227.7202.1 of the DFARS.
+
+You must not violate United States export control laws by distributing
+the DNSsafe software or information about it, when such distribution
+is prohibited by law.
+
+THE DNSSAFE SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY
+WHATSOEVER.  RSA HAS NO OBLIGATION TO SUPPORT, CORRECT, UPDATE OR
+MAINTAIN THE RSA SOFTWARE.  RSA DISCLAIMS ALL WARRANTIES, EXPRESS,
+IMPLIED OR STATUTORY, AS TO ANY MATTER WHATSOEVER, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
+
+If you desire to use DNSsafe in ways that these terms do not permit,
+please contact RSA Data Security, Inc., 100 Marine Parkway, Redwood
+City, California 94065, USA, to discuss alternate licensing
+arrangements.
Index: dist/bind/bin/named/ns_parser.h
--- dist/bind/bin/named/ns_parser.h	Sat Nov 18 23:02:41 2000
+++ /dev/null	Sat Nov 18 23:12:59 2000
@@ -1,144 +0,0 @@
-#define L_EOS 257
-#define L_IPADDR 258
-#define L_NUMBER 259
-#define L_STRING 260
-#define L_QSTRING 261
-#define L_END_INCLUDE 262
-#define T_INCLUDE 263
-#define T_OPTIONS 264
-#define T_DIRECTORY 265
-#define T_PIDFILE 266
-#define T_NAMED_XFER 267
-#define T_DUMP_FILE 268
-#define T_STATS_FILE 269
-#define T_MEMSTATS_FILE 270
-#define T_FAKE_IQUERY 271
-#define T_RECURSION 272
-#define T_FETCH_GLUE 273
-#define T_QUERY_SOURCE 274
-#define T_LISTEN_ON 275
-#define T_PORT 276
-#define T_ADDRESS 277
-#define T_RRSET_ORDER 278
-#define T_ORDER 279
-#define T_NAME 280
-#define T_CLASS 281
-#define T_CONTROLS 282
-#define T_INET 283
-#define T_UNIX 284
-#define T_PERM 285
-#define T_OWNER 286
-#define T_GROUP 287
-#define T_ALLOW 288
-#define T_DATASIZE 289
-#define T_STACKSIZE 290
-#define T_CORESIZE 291
-#define T_DEFAULT 292
-#define T_UNLIMITED 293
-#define T_FILES 294
-#define T_VERSION 295
-#define T_HOSTSTATS 296
-#define T_DEALLOC_ON_EXIT 297
-#define T_TRANSFERS_IN 298
-#define T_TRANSFERS_OUT 299
-#define T_TRANSFERS_PER_NS 300
-#define T_TRANSFER_FORMAT 301
-#define T_MAX_TRANSFER_TIME_IN 302
-#define T_SERIAL_QUERIES 303
-#define T_ONE_ANSWER 304
-#define T_MANY_ANSWERS 305
-#define T_NOTIFY 306
-#define T_AUTH_NXDOMAIN 307
-#define T_MULTIPLE_CNAMES 308
-#define T_USE_IXFR 309
-#define T_MAINTAIN_IXFR_BASE 310
-#define T_CLEAN_INTERVAL 311
-#define T_INTERFACE_INTERVAL 312
-#define T_STATS_INTERVAL 313
-#define T_MAX_LOG_SIZE_IXFR 314
-#define T_HEARTBEAT 315
-#define T_USE_ID_POOL 316
-#define T_MAX_NCACHE_TTL 317
-#define T_HAS_OLD_CLIENTS 318
-#define T_RFC2308_TYPE1 319
-#define T_LAME_TTL 320
-#define T_MIN_ROOTS 321
-#define T_TREAT_CR_AS_SPACE 322
-#define T_LOGGING 323
-#define T_CATEGORY 324
-#define T_CHANNEL 325
-#define T_SEVERITY 326
-#define T_DYNAMIC 327
-#define T_FILE 328
-#define T_VERSIONS 329
-#define T_SIZE 330
-#define T_SYSLOG 331
-#define T_DEBUG 332
-#define T_NULL_OUTPUT 333
-#define T_PRINT_TIME 334
-#define T_PRINT_CATEGORY 335
-#define T_PRINT_SEVERITY 336
-#define T_SORTLIST 337
-#define T_TOPOLOGY 338
-#define T_SERVER 339
-#define T_LONG_AXFR 340
-#define T_BOGUS 341
-#define T_TRANSFERS 342
-#define T_KEYS 343
-#define T_SUPPORT_IXFR 344
-#define T_ZONE 345
-#define T_IN 346
-#define T_CHAOS 347
-#define T_HESIOD 348
-#define T_TYPE 349
-#define T_MASTER 350
-#define T_SLAVE 351
-#define T_STUB 352
-#define T_RESPONSE 353
-#define T_HINT 354
-#define T_MASTERS 355
-#define T_TRANSFER_SOURCE 356
-#define T_PUBKEY 357
-#define T_ALSO_NOTIFY 358
-#define T_DIALUP 359
-#define T_FILE_IXFR 360
-#define T_IXFR_TMP 361
-#define T_TRUSTED_KEYS 362
-#define T_ACL 363
-#define T_ALLOW_UPDATE 364
-#define T_ALLOW_QUERY 365
-#define T_ALLOW_TRANSFER 366
-#define T_ALLOW_RECURSION 367
-#define T_BLACKHOLE 368
-#define T_SEC_KEY 369
-#define T_ALGID 370
-#define T_SECRET 371
-#define T_CHECK_NAMES 372
-#define T_WARN 373
-#define T_FAIL 374
-#define T_IGNORE 375
-#define T_FORWARD 376
-#define T_FORWARDERS 377
-#define T_ONLY 378
-#define T_FIRST 379
-#define T_IF_NO_ANSWER 380
-#define T_IF_NO_DOMAIN 381
-#define T_YES 382
-#define T_TRUE 383
-#define T_NO 384
-#define T_FALSE 385
-typedef union {
-	char *			cp;
-	int			s_int;
-	long			num;
-	u_long			ul_int;
-	u_int16_t		us_int;
-	struct in_addr		ip_addr;
-	ip_match_element	ime;
-	ip_match_list		iml;
-	rrset_order_list	rol;
-	rrset_order_element	roe;
-	struct dst_key *	keyi;
-	enum axfr_format	axfr_fmt;
-} YYSTYPE;
-extern YYSTYPE yylval;
