Index: bind8/src/CHANGES
diff -c bind8/src/CHANGES:8.1033 bind8/src/CHANGES:8.1040
*** bind8/src/CHANGES:8.1033	Mon Jun 17 20:27:13 2002
--- bind8/src/CHANGES	Wed Jun 26 21:25:08 2002
***************
*** 1,4 ****
--- 1,30 ----
  
+ 	--- 8.3.3-REL released --- (Wed Jun 26 21:15:43 PDT 2002)
+ 
+ 1301.	[func]		log attempts to exploit #1300.
+ 
+ 1300.	[bug]		Remote buffer overrun.
+ 
+ 1299.	[func]		Log to xfer-in when a named-xfer fails and one of
+ 			the masters returned REFUSED.
+ 
+ 1298.	[bug]		named could leak a OPT record when returning a
+ 			negative response.
+ 
+ 1297.	[func]		'ndc restart' will now attempt to preserve the
+ 			arguments named was started with.
+ 			Use 'ndc restart --' to clear the arguements.
+ 			Use 'ndc restart <new arguements>' to restart named
+ 			with a alternate set of arguements.
+ 
+ 1296.	[bug]		delay setting need_restart until the response to
+ 			ndc exec has been sent.
+ 			
+ 1295.	[func]		new ndc command 'args'.  returns the arguements that
+ 			named was started with %xx escaped.
+ 
+ 1294.	[bug]		#1272 broke linkage for those OS's using -lfl (flex).
+ 			Move -ll/-lfl to LIBL for all platforms.
  
  	--- 8.3.2-REL released --- (Mon Jun 17 20:24:32 PDT 2002)
  
Index: bind8/src/README
diff -c bind8/src/README:8.50 bind8/src/README:8.51
*** bind8/src/README:8.50	Wed Apr 24 18:03:44 2002
--- bind8/src/README	Wed Jun 26 21:25:10 2002
***************
*** 10,15 ****
--- 10,20 ----
  Note that BIND 8 is in "end-of-life", having been replaced by BIND 9.  See
  http://www.isc.org/ for more details.
  
+ BIND 8.3.3 Highlights
+ 	Security Fix libbind. All applications linked against libbind
+ 	need to relinked.
+ 	'rndc restart' now preserves named's arguements
+ 
  BIND 8.3.2 Highlights
  	dig, nslookup, host and nsupdate have improved IPv6 support.
  
Index: bind8/src/Version
diff -c bind8/src/Version:8.77 bind8/src/Version:8.78
*** bind8/src/Version:8.77	Mon Jun 17 20:27:14 2002
--- bind8/src/Version	Wed Jun 26 21:25:09 2002
***************
*** 1 ****
! 8.3.2-REL
--- 1 ----
! 8.3.3-REL
Index: bind8/src/bin/named/ns_ctl.c
diff -c bind8/src/bin/named/ns_ctl.c:8.46 bind8/src/bin/named/ns_ctl.c:8.47
*** bind8/src/bin/named/ns_ctl.c:8.46	Wed Dec 19 03:53:48 2001
--- bind8/src/bin/named/ns_ctl.c	Mon Jun 24 00:11:07 2002
***************
*** 112,117 ****
--- 112,119 ----
  static void		verb_exec(struct ctl_sctx *, struct ctl_sess *,
  				  const struct ctl_verb *,
  				  const char *, u_int, const void *, void *);
+ static void		exec_closure(struct ctl_sctx *, struct ctl_sess *,
+ 				     void *);
  static void		verb_reload(struct ctl_sctx *, struct ctl_sess *,
  				    const struct ctl_verb *,
  				    const char *, u_int, const void *, void *);
***************
*** 141,146 ****
--- 143,151 ----
  static void		verb_quit(struct ctl_sctx *, struct ctl_sess *,
  				  const struct ctl_verb *,
  				  const char *, u_int, const void *, void *);
+ static void		verb_args(struct ctl_sctx *, struct ctl_sess *,
+ 				  const struct ctl_verb *,
+ 				  const char *, u_int, const void *, void *);
  
  /* Private data. */
  
***************
*** 162,167 ****
--- 167,173 ----
  	{ "qrylog",	verb_querylog,	"qrylog"},
  	{ "help",	verb_help,	"help"},
  	{ "quit",	verb_quit,	"quit"},
+ 	{ "args",	verb_args,	"args"},
  	{ NULL,		NULL,		NULL}
  };
  
***************
*** 794,807 ****
  			   saved_argv[0], save);
  		ctl_response(sess, 502, save, 0, NULL, NULL, NULL,
  			     NULL, 0);
  	} else {
- 		ns_need(main_need_restart);
  		ctl_response(sess, 250, "Restart initiated.", 0, NULL,
! 			     NULL, NULL, NULL, 0);
  	}
  }
  
  static void
  verb_reload(struct ctl_sctx *ctl, struct ctl_sess *sess,
  	    const struct ctl_verb *verb, const char *rest,
  	    u_int respflags, const void *respctx, void *uctx)
--- 800,825 ----
  			   saved_argv[0], save);
  		ctl_response(sess, 502, save, 0, NULL, NULL, NULL,
  			     NULL, 0);
+ 	} else if (user_name != NULL || group_name != NULL) {
+ 		ctl_response(sess, 502,
+ 			     "can't exec as user or group was specified",
+ 			     0, NULL, NULL, NULL, NULL, 0);
  	} else {
  		ctl_response(sess, 250, "Restart initiated.", 0, NULL,
! 			     exec_closure, NULL, NULL, 0);
  	}
  }
  
  static void
+ exec_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
+ 
+ 	UNUSED(sctx);
+ 	UNUSED(sess);
+ 	UNUSED(uap);
+ 	ns_need(main_need_restart);
+ }
+ 
+ static void
  verb_reload(struct ctl_sctx *ctl, struct ctl_sess *sess,
  	    const struct ctl_verb *verb, const char *rest,
  	    u_int respflags, const void *respctx, void *uctx)
***************
*** 1048,1051 ****
--- 1066,1147 ----
  
  	ctl_response(sess, 221, "End of control session.", CTL_EXIT, NULL,
  		     NULL, NULL, NULL, 0);
+ }
+ 
+ static char hex[] = "0123456789abcdef";
+ 
+ struct pvt_args {
+ 	int	argc;
+ 	char            text[MAX_STR_LEN];
+ };
+ 
+ static void
+ args_closure(struct ctl_sctx *sctx, struct ctl_sess *sess, void *uap) {
+ 	struct pvt_args *pvt = ctl_getcsctx(sess);
+ 
+ 	UNUSED(sctx);
+ 	UNUSED(uap);
+ 
+ 	memput(pvt, sizeof *pvt);
+ 	ctl_setcsctx(sess, NULL);
+ }
+ 
+ static void
+ verb_args(struct ctl_sctx *ctl, struct ctl_sess *sess,
+ 	  const struct ctl_verb *verb, const char *rest,
+ 	  u_int respflags, const void *respctx, void *uctx)
+ {
+ 	struct pvt_args *pvt = ctl_getcsctx(sess);
+ 	char *cp, *tp;
+ 
+ 	UNUSED(ctl);
+ 	UNUSED(verb);
+ 	UNUSED(rest);
+ 	UNUSED(respflags);
+ 	UNUSED(respctx);
+ 	UNUSED(uctx);
+ 
+ 	if (pvt == NULL) {
+ 		unsigned int i = 0;
+ 		pvt = memget(sizeof *pvt);
+ 		if (pvt == NULL) {
+ 			ctl_response(sess, 505, "(out of memory)",
+ 				     0, NULL, NULL, NULL, NULL, 0);
+ 			return;
+ 		}
+ 		pvt->argc = 0;
+ 		ctl_setcsctx(sess, pvt);
+ 
+ 		/* Send the arguement count. */
+ 		while (saved_argv[i] != NULL)
+ 			i++;
+ 		sprintf(pvt->text, "%u", i);
+ 		ctl_response(sess, 250, pvt->text, CTL_MORE,
+ 			     NULL, args_closure, NULL, NULL, 0);
+ 		return;
+ 	}
+ 
+ 	/*
+ 	 * Percent escape arguement.
+ 	 */
+ 	cp = saved_argv[pvt->argc++];
+ 	tp = pvt->text;
+ 	while (cp && *cp != NULL)
+ 		if (*cp == '%' || *cp == ' ' ||
+ 		    !isprint((unsigned char)*cp)) {
+ 			if (tp >= pvt->text + sizeof(pvt->text) - 4)
+ 				break;
+ 			*tp++ = '%';
+ 			*tp++ = hex[(*cp>>4)&0xf];
+ 			*tp++ = hex[(*cp++)&0xf];
+ 		} else {
+ 			if (tp >= pvt->text + sizeof(pvt->text) - 2)
+ 				break;
+ 			*tp++ = *cp++;
+ 		}
+ 	*tp = '\0';
+ 	
+ 	ctl_response(sess, 250, pvt->text, 
+ 		     saved_argv[pvt->argc] == NULL ? 0 : CTL_MORE,
+ 		     NULL, args_closure, NULL, NULL, 0);
  }
Index: bind8/src/bin/named/ns_defs.h
diff -c bind8/src/bin/named/ns_defs.h:8.120 bind8/src/bin/named/ns_defs.h:8.121
*** bind8/src/bin/named/ns_defs.h:8.120	Thu May 23 20:04:56 2002
--- bind8/src/bin/named/ns_defs.h	Tue Jun 25 20:27:19 2002
***************
*** 437,442 ****
--- 437,443 ----
  #define XFER_SUCCESSAXFR 4              /* named-xfr recived a xfr */
  #define XFER_SUCCESSIXFR 5              /* named-xfr recived a ixfr */
  #define XFER_SUCCESSAXFRIXFRFILE 6      /* named-xfr received AXFR for IXFR */
+ #define XFER_REFUSED 7      		/* one master returned REFUSED */
  #define XFER_ISAXFR     -1              /* the last XFR is AXFR */
  #define XFER_ISIXFR     -2              /* the last XFR is IXFR */
  #define XFER_ISAXFRIXFR	-3		/* the last XFR is AXFR but we must create IXFR base */
Index: bind8/src/bin/named/ns_main.c
diff -c bind8/src/bin/named/ns_main.c:8.159 bind8/src/bin/named/ns_main.c:8.160
*** bind8/src/bin/named/ns_main.c:8.159	Tue Jun  4 21:53:48 2002
--- bind8/src/bin/named/ns_main.c	Mon Jun 24 00:06:55 2002
***************
*** 176,182 ****
  static	u_int16_t               nsid_state2;
  static	int                     nsid_algorithm;
  
! static	int			needs = 0, needs_exit = 0;
  static	handler			handlers[main_need_num];
  static	void			savedg_waitfunc(evContext, void*, const void*);
  static	void			need_waitfunc(evContext, void *, const void *);
--- 176,182 ----
  static	u_int16_t               nsid_state2;
  static	int                     nsid_algorithm;
  
! static	int			needs = 0, needs_exit = 0, needs_restart = 0;
  static	handler			handlers[main_need_num];
  static	void			savedg_waitfunc(evContext, void*, const void*);
  static	void			need_waitfunc(evContext, void *, const void *);
***************
*** 558,564 ****
  		else
  			INSIST_ERR(errno == EINTR);
  	}
! 	ns_info(ns_log_default, "named shutting down");
  #ifdef BIND_UPDATE
  	dynamic_about_to_exit();
  #endif
--- 558,567 ----
  		else
  			INSIST_ERR(errno == EINTR);
  	}
! 	if (needs_restart)
! 		ns_info(ns_log_default, "named restarting");
! 	else
! 		ns_info(ns_log_default, "named shutting down");
  #ifdef BIND_UPDATE
  	dynamic_about_to_exit();
  #endif
***************
*** 571,578 ****
  	else
  		shutdown_configuration();
  
! 	/* Cleanup for system-dependent stuff */
! 	custom_shutdown();
  	
  	return (0);
  }
--- 574,584 ----
  	else
  		shutdown_configuration();
  
! 	if (needs_restart)
! 		execvp(saved_argv[0], saved_argv);
! 	else
! 		/* Cleanup for system-dependent stuff */
! 		custom_shutdown();
  	
  	return (0);
  }
***************
*** 2775,2793 ****
  	
  static void
  ns_restart(void) {
! 	ns_info(ns_log_default, "named restarting");
! #ifdef BIND_UPDATE
! 	dynamic_about_to_exit();
! #endif
! 	if (server_options && server_options->pid_filename)
! 		(void)unlink(server_options->pid_filename);
! 	ns_logstats(ev, NULL, evNowTime(), evConsTime(0, 0));
! 	if (NS_OPTION_P(OPTION_DEALLOC_ON_EXIT))
! 		deallocate_everything();
! 	else
! 		shutdown_configuration();
! 	execvp(saved_argv[0], saved_argv);
! 	abort();
  }
  
  static void
--- 2781,2788 ----
  	
  static void
  ns_restart(void) {
! 	needs_restart = 1;
! 	needs_exit = 1;
  }
  
  static void
Index: bind8/src/bin/named/ns_maint.c
diff -c bind8/src/bin/named/ns_maint.c:8.135 bind8/src/bin/named/ns_maint.c:8.136
*** bind8/src/bin/named/ns_maint.c:8.135	Wed Apr 24 22:27:10 2002
--- bind8/src/bin/named/ns_maint.c	Tue Jun 25 20:27:20 2002
***************
*** 1681,1686 ****
--- 1681,1697 ----
  					sched_zone_maint(zp);
  					break;
  
+ 				case XFER_REFUSED:
+ 					if (!(zp->z_flags & Z_SYSLOGGED)) {
+ 						zp->z_flags |= Z_SYSLOGGED;
+ 						ns_error(ns_log_xfer_in,
+ 		      "zoneref: Masters for slave zone \"%s\" REFUSED transfer",
+ 							  zp->z_origin);
+ 					}
+ 					ns_retrytime(zp, tt.tv_sec);
+ 					sched_zone_maint(zp);
+ 					break;
+ 
  				default:
  					if (!(zp->z_flags & Z_SYSLOGGED)) {
  						zp->z_flags |= Z_SYSLOGGED;
Index: bind8/src/bin/named/ns_resp.c
diff -c bind8/src/bin/named/ns_resp.c:8.176 bind8/src/bin/named/ns_resp.c:8.178
*** bind8/src/bin/named/ns_resp.c:8.176	Wed Apr 17 00:10:10 2002
--- bind8/src/bin/named/ns_resp.c	Wed Jun 26 20:09:19 2002
***************
*** 288,294 ****
  	struct namebuf *np;
  	struct fwdinfo *fwd;
  	struct databuf *dp;
- 	int forcecmsg = 0;
  	char *tname = NULL;
  	int sendto_errno = 0;
  	int has_tsig, oldqlen = 0;
--- 288,293 ----
***************
*** 298,303 ****
--- 297,303 ----
  	u_char sig[TSIG_SIG_SIZE];
  	time_t tsig_time;
  	DST_KEY *key;
+ 	int expect_cname;
  
  	nameserIncr(from.sin_addr, nssRcvdR);
  	nsp[0] = NULL;
***************
*** 924,929 ****
--- 924,930 ----
  	} else
  		flushset = NULL;
  
+ 	expect_cname = 1;
  	for (i = 0; i < count; i++) {
  		struct databuf *dp;
  		int type;
***************
*** 955,960 ****
--- 956,974 ----
  		type = dp->d_type;
  		if (i < ancount) {
  			/* Answer section. */
+ 			/*
+ 			 * Check for attempts to overflow the buffer in
+ 			 * getnameanswer.
+ 			 */
+ 			if (type == ns_t_cname && !expect_cname) {
+ 				ns_warning(ns_log_security,
+ 			     "late CNAME in answer section for %s %s from %s",
+ 					   *qname ? qname : ".", p_type(qtype),
+ 					   sin_ntoa(from));
+ 					   
+ 			} else if (type != ns_t_cname && type != ns_t_dname &&
+ 				   type != ns_t_sig)
+ 				expect_cname = 0;
  			if (externalcname || ns_samename(name, aname) != 1) {
  				if (!externalcname)
  					ns_info(ns_log_resp_checks,
***************
*** 1220,1231 ****
  		cache_n_resp(msg, msglen, from, qp->q_name,
  			     qp->q_class, qp->q_type);
  
! 		if (!qp->q_cmsglen) {
  			ns_debug(ns_log_default, 3,
  				 "resp: leaving NO: auth = %d", hp->aa);
  			goto return_msg;
  		}
- 		forcecmsg = 1;
  	}
  
  	/*
--- 1234,1244 ----
  		cache_n_resp(msg, msglen, from, qp->q_name,
  			     qp->q_class, qp->q_type);
  
! 		if (!qp->q_cmsglen && validanswer) {
  			ns_debug(ns_log_default, 3,
  				 "resp: leaving NO: auth = %d", hp->aa);
  			goto return_msg;
  		}
  	}
  
  	/*
Index: bind8/src/bin/named-xfer/named-xfer.c
diff -c bind8/src/bin/named-xfer/named-xfer.c:8.120 bind8/src/bin/named-xfer/named-xfer.c:8.121
*** bind8/src/bin/named-xfer/named-xfer.c:8.120	Mon Jan 28 22:54:52 2002
--- bind8/src/bin/named-xfer/named-xfer.c	Tue Jun 25 20:27:22 2002
***************
*** 750,755 ****
--- 750,756 ----
  	default:
  		result = XFER_FAIL;
  		/* fall through */
+ 	case XFER_REFUSED:
  	case XFER_TIMEOUT:
  	case XFER_FAIL:
  		(void) unlink(tmpname);
***************
*** 1067,1072 ****
--- 1068,1074 ----
  	u_int32_t query_serial = serial_no;
  	int first_soa_printed;
  	struct in_addr z_axfr_src;
+ 	int refused = 0;
  
  #ifdef DEBUG
  	if (debug) {
***************
*** 1630,1635 ****
--- 1632,1638 ----
  						       my_addr_text,
  						       inet_ntoa(sin.sin_addr),
  						       zp->z_origin);
+ 						refused = 1;
  					} else {
  						syslog(LOG_INFO,
  				  "[%s] record too short from [%s], zone %s\n",
***************
*** 1912,1917 ****
--- 1915,1921 ----
  						       my_addr_text,
  						       inet_ntoa(sin.sin_addr),
  						       zp->z_origin);
+ 						refused = 1;
  					} else {
  						syslog(LOG_INFO,
  				  "[%s] record too short from [%s], zone %s\n",
***************
*** 1951,1956 ****
--- 1955,1962 ----
  	}
  	if (!error)
  		return (XFER_TIMEOUT);
+ 	if (refused)
+ 		return (XFER_REFUSED);
  	return (XFER_FAIL);
  }
  
Index: bind8/src/bin/ndc/ndc.c
diff -c bind8/src/bin/ndc/ndc.c:1.21 bind8/src/bin/ndc/ndc.c:1.22
*** bind8/src/bin/ndc/ndc.c:1.21	Wed Dec 19 15:16:23 2001
--- bind8/src/bin/ndc/ndc.c	Mon Jun 24 00:28:55 2002
***************
*** 250,270 ****
  	       "toggle silence (suppresses nonfatal errors)");
  }
  
  static int
  builtincmd(void) {
  	static const char spaces[] = " \t";
  	char *rest, *syscmd;
  	pid_t pid;
  	int save_quiet = quiet;
  	int len;
  
  	quiet = 1;
  
  	len = strcspn(cmd, spaces);
  	rest = cmd + len;
! 	if (*rest != '\0') {
! 		rest++;
  		rest += strspn(rest, spaces);
  	}
  	syscmd = malloc(strlen(named_path) + sizeof " " + strlen(rest));
  	if (syscmd == NULL)
--- 250,447 ----
  	       "toggle silence (suppresses nonfatal errors)");
  }
  
+ struct argv {
+ 	int argc;
+ 	char **argv;
+ 	int error;
+ };
+ 
+ static char hexdigits[] = "0123456789abcdef";
+ 
+ static void
+ getargs_closure(void *arg, const char *msg, int flags) {
+ 	struct argv *argv = arg;
+ 	int len;
+ 	int i;
+ 	const char *cp, *cp2;
+ 	char *tp, c;
+ 
+ 	UNUSED(flags);
+ 
+ 	if (argv->error)
+ 		return;
+ 
+ 	if (argv->argc == -1) {
+ 		i = atoi(msg + 4);
+ 		if (i < 1) {
+ 			argv->error = 1;
+ 			return;
+ 		}
+ 		argv->argc = i;
+ 		argv->argv = calloc((i+1), sizeof(char*));
+ 		return;
+ 	}
+ 	len = 0;
+ 	cp = msg + 4;
+ 	while (*cp != NULL) {
+ 		c = *cp;
+ 		if (c == '%') {
+ 			cp2 = strchr(hexdigits, cp[1]);
+ 			if (cp2 == NULL) {
+ 				argv->error = 1;
+ 				return;
+ 			}
+ 			c = (cp2-hexdigits) << 4;
+ 			cp2 = strchr(hexdigits, cp[2]);
+ 			if (cp2 == NULL) {
+ 				argv->error = 1;
+ 				return;
+ 			}
+ 			c += (cp2-hexdigits);
+ 			cp += 2;
+ 		}
+ 		if (!isalnum((unsigned)c)) {
+ 			switch (c) {
+ 			case '+': case '-': case '=': case '/': case '.':
+ 				break;
+ 			default:
+ 				len++;
+ 			}
+ 		}
+ 		len++;
+ 		cp++;
+ 	}
+ 	i = 0;
+ 	while (argv->argv[i] != NULL)
+ 		i++;
+ 	if (i >= argv->argc) {
+ 		argv->error = 1;
+ 		return;
+ 	}
+ 	argv->argv[i] = malloc(len + 1);
+ 	if (argv->argv[i] == NULL) {
+ 		argv->error = 1;
+ 		return;
+ 	}
+ 	cp = msg + 4;
+ 	tp = argv->argv[i];
+ 	while (*cp != NULL) {
+ 		c = *cp;
+ 		if (c == '%') {
+ 			cp2 = strchr(hexdigits, cp[1]);
+ 			if (cp2 == NULL) {
+ 				argv->error = 1;
+ 				return;
+ 			}
+ 			c = (cp2-hexdigits) << 4;
+ 			cp2 = strchr(hexdigits, cp[2]);
+ 			if (cp2 == NULL) {
+ 				argv->error = 1;
+ 				return;
+ 			}
+ 			c += (cp2-hexdigits);
+ 			cp += 2;
+ 		}
+ 		if (!isalnum((unsigned)c)) {
+ 			switch (c) {
+ 			case '+': case '-': case '=': case '/': case '.':
+ 				break;
+ 			default:
+ 				*tp = '\\';
+ 			}
+ 		}
+ 		*tp++ = c;
+ 		cp++;
+ 	}
+ }
+ 
  static int
+ get_args(char **restp) {
+ 	struct argv argv;
+ 	int len, i;
+ 	char *rest, *p;
+ 	int result = 1;
+ 
+ 	argv.argc = -1;
+ 	argv.argv = NULL;
+ 	argv.error = 0;
+ 
+ 	channel_loop("args", 1, getargs_closure, &argv);
+ 	if (argv.error) {
+ 		result = 0;
+ 		goto err;
+ 	}
+ 	len = 0;
+ 	for (i = 1 ; i < argv.argc && argv.argv[i] != NULL; i++)
+ 		len += strlen(argv.argv[i]) + 1;
+ 	rest = malloc(len);
+ 	if (rest == NULL) {
+ 		result = 0;
+ 		goto err;
+ 	}
+ 	p = rest;
+ 	for (i = 1 ; i < argv.argc && argv.argv[i] != NULL; i++) {
+ 		strcpy(p, argv.argv[i]);
+ 		p += strlen(argv.argv[i]);
+ 		*p++ = ' ';
+ 	}
+ 	if (p != rest)
+ 		p[-1] = '\0';
+ 	*restp = rest;
+ 
+  err:
+ 	if (argv.argv) {
+ 		for (i = 0 ; i < argv.argc && argv.argv[i] != NULL; i++)
+ 			free(argv.argv[i]);
+ 		free(argv.argv);
+ 	}
+ 	return (result);
+ }
+ 
+ static void
+ exec_closure(void *arg, const char *msg, int flags) {
+ 	int *result = arg;
+ 	UNUSED(flags);
+ 	if (atoi(msg) == 250)
+ 		*result = 1;
+ }
+ 
+ static int
+ try_exec(int local_quiet) {
+ 	int good = 0;
+ 	pid_t pid;
+ 
+ 	channel_loop("exec", 1, exec_closure, &good);
+ 
+ 	if (good) {
+ 		sleep(3);
+ 		if (!running(0, &pid))
+ 			error("name server has not restarted (yet?)");
+ 		else if (!local_quiet)
+ 			result("new pid is %ld", (long)pid);
+ 	}
+ 	return (good);
+ }
+ 
+ static int
  builtincmd(void) {
  	static const char spaces[] = " \t";
  	char *rest, *syscmd;
  	pid_t pid;
  	int save_quiet = quiet;
  	int len;
+ 	int freerest = 0;
  
  	quiet = 1;
  
  	len = strcspn(cmd, spaces);
  	rest = cmd + len;
! 	if (*rest != '\0')
  		rest += strspn(rest, spaces);
+ 	if (*rest == '\0' && !strncasecmp(cmd, "restart", len)) {
+ 		if (try_exec(save_quiet))
+ 			return (1);
+ 		freerest = get_args(&rest);
  	}
  	syscmd = malloc(strlen(named_path) + sizeof " " + strlen(rest));
  	if (syscmd == NULL)
***************
*** 274,279 ****
--- 451,458 ----
  		strcat(syscmd, " ");
  		strcat(syscmd, rest);
  	}
+ 	if (freerest)
+ 		free(rest);
  	if (strncasecmp(cmd, "start", len) == 0) {
  		if (running(debug, &pid))
  			error("name server already running? (pid %ld)",
***************
*** 417,422 ****
--- 596,602 ----
  	a.cl = cl;
  	a.ua = ua;
  	logger_show = show;
+ 	trace("command '%s'", cmdtext);
  	ctl = ctl_client(ev, client_addr, impute_addrlen(client_addr),
  			 (struct sockaddr *)&server,
  			 impute_addrlen((struct sockaddr *)&server),
Index: bind8/src/lib/irs/dns_ho.c
diff -c bind8/src/lib/irs/dns_ho.c:1.36 bind8/src/lib/irs/dns_ho.c:1.39
*** bind8/src/lib/irs/dns_ho.c:1.36	Thu May 30 23:05:30 2002
--- bind8/src/lib/irs/dns_ho.c	Wed Jun 26 20:56:32 2002
***************
*** 74,79 ****
--- 74,80 ----
  #include <resolv.h>
  #include <stdio.h>
  #include <string.h>
+ #include <syslog.h>
  
  #include <isc/memcluster.h>
  #include <irs.h>
***************
*** 161,167 ****
  				     const struct addrinfo *pai);
  
  static void		map_v4v6_hostent(struct hostent *hp, char **bp,
! 					 int *len);
  static void		addrsort(res_state, char **, int);
  static struct hostent *	gethostans(struct irs_ho *this,
  				   const u_char *ansbuf, int anslen,
--- 162,168 ----
  				     const struct addrinfo *pai);
  
  static void		map_v4v6_hostent(struct hostent *hp, char **bp,
! 					 char *ep);
  static void		addrsort(res_state, char **, int);
  static struct hostent *	gethostans(struct irs_ho *this,
  				   const u_char *ansbuf, int anslen,
***************
*** 1079,1085 ****
  	   struct addrinfo **ret_aip, const struct addrinfo *pai)
  {
  	struct pvt *pvt = (struct pvt *)this->private;
! 	int type, class, buflen, ancount, qdcount, n, haveanswer, had_error;
  	int error = NETDB_SUCCESS, arcount;
  	int (*name_ok)(const char *);
  	const HEADER *hp;
--- 1080,1086 ----
  	   struct addrinfo **ret_aip, const struct addrinfo *pai)
  {
  	struct pvt *pvt = (struct pvt *)this->private;
! 	int type, class, ancount, qdcount, n, haveanswer, had_error;
  	int error = NETDB_SUCCESS, arcount;
  	int (*name_ok)(const char *);
  	const HEADER *hp;
***************
*** 1088,1094 ****
  	const u_char *cp;
  	const char *tname;
  	const char *hname;
! 	char *bp, **ap, **hap;
  	char tbuf[MAXDNAME+1];
  	struct addrinfo sentinel, *cur, ai;
  	const u_char *arp = NULL;
--- 1089,1095 ----
  	const u_char *cp;
  	const char *tname;
  	const char *hname;
! 	char *bp, *ep, **ap, **hap;
  	char tbuf[MAXDNAME+1];
  	struct addrinfo sentinel, *cur, ai;
  	const u_char *arp = NULL;
***************
*** 1131,1143 ****
  	qdcount = ntohs(hp->qdcount);
  	arcount = ntohs(hp->arcount);
  	bp = pvt->hostbuf;
! 	buflen = sizeof pvt->hostbuf;
  	cp = ansbuf + HFIXEDSZ;
  	if (qdcount != 1) {
  		RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  		return (NULL);
  	}
! 	n = dn_expand(ansbuf, eom, cp, bp, buflen);
  	if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
  		RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  		return (NULL);
--- 1132,1144 ----
  	qdcount = ntohs(hp->qdcount);
  	arcount = ntohs(hp->arcount);
  	bp = pvt->hostbuf;
! 	ep = pvt->hostbuf + sizeof(pvt->hostbuf);
  	cp = ansbuf + HFIXEDSZ;
  	if (qdcount != 1) {
  		RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  		return (NULL);
  	}
! 	n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
  	if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
  		RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  		return (NULL);
***************
*** 1161,1167 ****
  		pvt->host.h_name = bp;
  		hname = bp;
  		bp += n;
- 		buflen -= n;
  		/* The qname can be abbreviated, but hname is now absolute. */
  		qname = pvt->host.h_name;
  	}
--- 1162,1167 ----
***************
*** 1174,1180 ****
  	haveanswer = 0;
  	had_error = 0;
  	while (ancount-- > 0 && cp < eom && !had_error) {
! 		n = dn_expand(ansbuf, eom, cp, bp, buflen);
  		if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
  			had_error++;
  			continue;
--- 1174,1180 ----
  	haveanswer = 0;
  	had_error = 0;
  	while (ancount-- > 0 && cp < eom && !had_error) {
! 		n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
  		if (n < 0 || !maybe_ok(pvt->res, bp, name_ok)) {
  			had_error++;
  			continue;
***************
*** 1195,1200 ****
--- 1195,1209 ----
  		eor = cp + n;
  		if ((qtype == T_A || qtype == T_AAAA || qtype == ns_t_a6 ||
  		     qtype == T_ANY) && type == T_CNAME) {
+ 			if (haveanswer) {
+ 				int level = LOG_CRIT;
+ #ifdef LOG_SECURITY
+ 				level |= LOG_SECURITY;
+ #endif
+ 				syslog(level,
+  "gethostans: possible attempt to exploit buffer overflow while looking up %s",
+ 					*qname ? qname : ".");
+ 			}
  			n = dn_expand(ansbuf, eor, cp, tbuf, sizeof tbuf);
  			if (n < 0 || !maybe_ok(pvt->res, tbuf, name_ok)) {
  				had_error++;
***************
*** 1207,1216 ****
  			*ap++ = bp;
  			n = strlen(bp) + 1;	/* for the \0 */
  			bp += n;
- 			buflen -= n;
  			/* Get canonical name. */
  			n = strlen(tbuf) + 1;	/* for the \0 */
! 			if (n > buflen || n > MAXHOSTNAMELEN) {
  				had_error++;
  				continue;
  			}
--- 1216,1224 ----
  			*ap++ = bp;
  			n = strlen(bp) + 1;	/* for the \0 */
  			bp += n;
  			/* Get canonical name. */
  			n = strlen(tbuf) + 1;	/* for the \0 */
! 			if (n > (ep - bp) || n > MAXHOSTNAMELEN) {
  				had_error++;
  				continue;
  			}
***************
*** 1218,1224 ****
  			pvt->host.h_name = bp;
  			hname = bp;
  			bp += n;
- 			buflen -= n;
  			continue;
  		}
  		if (type == ns_t_dname) {
--- 1226,1231 ----
***************
*** 1254,1260 ****
  			cp += n;
  
  			n = strlen(t) + 1; /* for the \0 */
! 			if (n > buflen) {
  				had_error++;
  				continue;
  			}
--- 1261,1267 ----
  			cp += n;
  
  			n = strlen(t) + 1; /* for the \0 */
! 			if (n > (ep - bp)) {
  				had_error++;
  				continue;
  			}
***************
*** 1264,1270 ****
  			else
  				hname = bp;
  			bp += n;
- 			buflen -= n;
  
  			continue;
  		}
--- 1271,1276 ----
***************
*** 1290,1303 ****
  			}
  			/* Get canonical name. */
  			n = strlen(tbuf) + 1;	/* for the \0 */
! 			if (n > buflen) {
  				had_error++;
  				continue;
  			}
  			strcpy(bp, tbuf);
  			tname = bp;
  			bp += n;
- 			buflen -= n;
  			continue;
  		}
  		if (qtype == T_ANY) {
--- 1296,1308 ----
  			}
  			/* Get canonical name. */
  			n = strlen(tbuf) + 1;	/* for the \0 */
! 			if (n > (ep - bp)) {
  				had_error++;
  				continue;
  			}
  			strcpy(bp, tbuf);
  			tname = bp;
  			bp += n;
  			continue;
  		}
  		if (qtype == T_ANY) {
***************
*** 1321,1327 ****
  				cp += n;
  				continue;
  			}
! 			n = dn_expand(ansbuf, eor, cp, bp, buflen);
  			if (n < 0 || !maybe_hnok(pvt->res, bp) ||
  			    n >= MAXHOSTNAMELEN) {
  				had_error++;
--- 1326,1332 ----
  				cp += n;
  				continue;
  			}
! 			n = dn_expand(ansbuf, eor, cp, bp, ep - bp);
  			if (n < 0 || !maybe_hnok(pvt->res, bp) ||
  			    n >= MAXHOSTNAMELEN) {
  				had_error++;
***************
*** 1339,1345 ****
  			if (n != -1) {
  				n = strlen(bp) + 1;	/* for the \0 */
  				bp += n;
- 				buflen -= n;
  			}
  			break;
  		case ns_t_a6: {
--- 1344,1349 ----
***************
*** 1439,1445 ****
  				pvt->host.h_name = bp;
  				hname = bp;
  				bp += nn;
- 				buflen -= nn;
  			}
  			/* Ensure alignment. */
  			bp = (char *)(((u_long)bp + (sizeof(align) - 1)) &
--- 1443,1448 ----
***************
*** 1493,1507 ****
  					 haveanswer);
  			if (pvt->host.h_name == NULL) {
  				n = strlen(qname) + 1;	/* for the \0 */
! 				if (n > buflen || n >= MAXHOSTNAMELEN)
  					goto no_recovery;
  				strcpy(bp, qname);
  				pvt->host.h_name = bp;
  				bp += n;
- 				buflen -= n;
  			}
  			if (pvt->res->options & RES_USE_INET6)
! 				map_v4v6_hostent(&pvt->host, &bp, &buflen);
  			RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
  			return (&pvt->host);
  		} else {
--- 1496,1509 ----
  					 haveanswer);
  			if (pvt->host.h_name == NULL) {
  				n = strlen(qname) + 1;	/* for the \0 */
! 				if (n > (ep - bp) || n >= MAXHOSTNAMELEN)
  					goto no_recovery;
  				strcpy(bp, qname);
  				pvt->host.h_name = bp;
  				bp += n;
  			}
  			if (pvt->res->options & RES_USE_INET6)
! 				map_v4v6_hostent(&pvt->host, &bp, ep);
  			RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);
  			return (&pvt->host);
  		} else {
***************
*** 1575,1581 ****
  }
  
  static void
! map_v4v6_hostent(struct hostent *hp, char **bpp, int *lenp) {
  	char **ap;
  
  	if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
--- 1577,1583 ----
  }
  
  static void
! map_v4v6_hostent(struct hostent *hp, char **bpp, char *ep) {
  	char **ap;
  
  	if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
***************
*** 1588,1604 ****
  		if (i != 0)
  			i = sizeof(align) - i;
  
! 		if (*lenp < (i + IN6ADDRSZ)) {
  			/* Out of memory.  Truncate address list here. */
  			*ap = NULL;
  			return;
  		}
  		*bpp += i;
- 		*lenp -= i;
  		map_v4v6_address(*ap, *bpp);
  		*ap = *bpp;
  		*bpp += IN6ADDRSZ;
- 		*lenp -= IN6ADDRSZ;
  	}
  }
  
--- 1590,1604 ----
  		if (i != 0)
  			i = sizeof(align) - i;
  
! 		if ((ep - *bpp) < (i + IN6ADDRSZ)) {
  			/* Out of memory.  Truncate address list here. */
  			*ap = NULL;
  			return;
  		}
  		*bpp += i;
  		map_v4v6_address(*ap, *bpp);
  		*ap = *bpp;
  		*bpp += IN6ADDRSZ;
  	}
  }
  
Index: bind8/src/lib/irs/dns_nw.c
diff -c bind8/src/lib/irs/dns_nw.c:1.22 bind8/src/lib/irs/dns_nw.c:1.23
*** bind8/src/lib/irs/dns_nw.c:1.22	Tue Feb 26 19:50:10 2002
--- bind8/src/lib/irs/dns_nw.c	Wed Jun 26 00:42:06 2002
***************
*** 299,306 ****
  	      int af, const char *name, const u_char *addr, int addrlen)
  {
  	struct pvt *pvt = (struct pvt *)this->private;
! 	int type, class, buflen, ancount, qdcount, haveanswer;
! 	char *bp, **ap;
  	u_char *cp, *eom;
  	HEADER *hp;
  
--- 299,306 ----
  	      int af, const char *name, const u_char *addr, int addrlen)
  {
  	struct pvt *pvt = (struct pvt *)this->private;
! 	int type, class, ancount, qdcount, haveanswer;
! 	char *bp, *ep, **ap;
  	u_char *cp, *eom;
  	HEADER *hp;
  
***************
*** 332,338 ****
  
  	/* Prepare a return structure. */
  	bp = pvt->buf;
! 	buflen = sizeof pvt->buf;
  	pvt->net.n_name = NULL;
  	pvt->net.n_aliases = pvt->ali;
  	pvt->net.n_addrtype = af;
--- 332,338 ----
  
  	/* Prepare a return structure. */
  	bp = pvt->buf;
! 	ep = pvt->buf + sizeof(pvt->buf);
  	pvt->net.n_name = NULL;
  	pvt->net.n_aliases = pvt->ali;
  	pvt->net.n_addrtype = af;
***************
*** 345,364 ****
  		if (name != NULL) {
  			int n = strlen(name) + 1;
  
! 			if (n > buflen) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
  			}
  			pvt->net.n_name = strcpy(bp, name);
  			bp += n;
- 			buflen -= n;
  		}
  		break;
  	case by_addr:
  		if (addr != NULL && addrlen != 0) {
  			int n = addrlen / 8 + ((addrlen % 8) != 0);
  
! 			if (INADDRSZ > buflen) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
  			}
--- 345,363 ----
  		if (name != NULL) {
  			int n = strlen(name) + 1;
  
! 			if (n > (ep - bp)) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
  			}
  			pvt->net.n_name = strcpy(bp, name);
  			bp += n;
  		}
  		break;
  	case by_addr:
  		if (addr != NULL && addrlen != 0) {
  			int n = addrlen / 8 + ((addrlen % 8) != 0);
  
! 			if (INADDRSZ > (ep - bp)) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
  			}
***************
*** 366,372 ****
  			memcpy(bp, addr, n);
  			pvt->net.n_addr = bp;
  			bp += INADDRSZ;
- 			buflen -= INADDRSZ;
  		}
  		break;
  	default:
--- 365,370 ----
***************
*** 377,383 ****
  	ap = pvt->ali;
  	haveanswer = 0;
  	while (--ancount >= 0 && cp < eom) {
! 		int n = dn_expand(ansbuf, eom, cp, bp, buflen);
  
  		cp += n;		/* Owner */
  		if (n < 0 || !maybe_dnok(pvt->res, bp) ||
--- 375,381 ----
  	ap = pvt->ali;
  	haveanswer = 0;
  	while (--ancount >= 0 && cp < eom) {
! 		int n = dn_expand(ansbuf, eom, cp, bp, ep - bp);
  
  		cp += n;		/* Owner */
  		if (n < 0 || !maybe_dnok(pvt->res, bp) ||
***************
*** 392,398 ****
  		if (class == C_IN && type == T_PTR) {
  			int nn;
  
! 			nn = dn_expand(ansbuf, eom, cp, bp, buflen);
  			if (nn < 0 || !maybe_hnok(pvt->res, bp) || nn != n) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
--- 390,396 ----
  		if (class == C_IN && type == T_PTR) {
  			int nn;
  
! 			nn = dn_expand(ansbuf, eom, cp, bp, ep - bp);
  			if (nn < 0 || !maybe_hnok(pvt->res, bp) || nn != n) {
  				RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  				return (NULL);
***************
*** 408,414 ****
  					*ap++ = bp;
  				nn = strlen(bp) + 1;
  				bp += nn;
- 				buflen -= nn;
  				haveanswer++;
  				break;
  			    }
--- 406,411 ----
***************
*** 419,425 ****
  				    sscanf(bp, "%u.%u.%u.%u.in-addr.arpa",
  					   &b1, &b2, &b3, &b4) != 4)
  					break;
! 				if (buflen < INADDRSZ) {
  					RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  					return (NULL);
  				}
--- 416,422 ----
  				    sscanf(bp, "%u.%u.%u.%u.in-addr.arpa",
  					   &b1, &b2, &b3, &b4) != 4)
  					break;
! 				if ((ep - bp) < INADDRSZ) {
  					RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);
  					return (NULL);
  				}
***************
*** 428,434 ****
  				*bp++ = b3;
  				*bp++ = b2;
  				*bp++ = b1;
- 				buflen -= INADDRSZ;
  				pvt->net.n_length = INADDRSZ * 8;
  				haveanswer++;
  			    }
--- 425,430 ----
Index: bind8/src/port/aix32/Makefile.set
diff -c bind8/src/port/aix32/Makefile.set:1.2 bind8/src/port/aix32/Makefile.set:1.3
*** bind8/src/port/aix32/Makefile.set:1.2	Sun Aug  8 10:13:24 1999
--- bind8/src/port/aix32/Makefile.set	Sun Jun 23 17:32:31 2002
***************
*** 9,15 ****
  'DESTRUN=/usr/local/var/run'
  'LDS=:'
  'LEX=flex -Ce -v'
! 'SYSLIBS=-L/usr/local/lib -lfl'
  'YACC=bison -yd'
  'INSTALL=/usr/ucb/install -c'
  'MANDIR=man'
--- 9,16 ----
  'DESTRUN=/usr/local/var/run'
  'LDS=:'
  'LEX=flex -Ce -v'
! 'SYSLIBS=-L/usr/local/lib'
! 'LIBL=-lfl'
  'YACC=bison -yd'
  'INSTALL=/usr/ucb/install -c'
  'MANDIR=man'
Index: bind8/src/port/aix4/Makefile.set
diff -c bind8/src/port/aix4/Makefile.set:1.3 bind8/src/port/aix4/Makefile.set:1.4
*** bind8/src/port/aix4/Makefile.set:1.3	Mon Jun  8 11:04:30 1998
--- bind8/src/port/aix4/Makefile.set	Sun Jun 23 17:32:35 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/aix4/Makefile.set.gcc
diff -c bind8/src/port/aix4/Makefile.set.gcc:1.1 bind8/src/port/aix4/Makefile.set.gcc:1.2
*** bind8/src/port/aix4/Makefile.set.gcc:1.1	Thu Feb  3 23:46:02 2000
--- bind8/src/port/aix4/Makefile.set.gcc	Sun Jun 23 17:32:36 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=flex -v'
  'YACC=bison -y -d'
! 'SYSLIBS=-lfl'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=flex -v'
  'YACC=bison -y -d'
! 'SYSLIBS='
! 'LIBL=-lfl'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/aux3/Makefile.set
diff -c bind8/src/port/aux3/Makefile.set:1.5 bind8/src/port/aux3/Makefile.set:1.6
*** bind8/src/port/aux3/Makefile.set:1.5	Mon Nov  8 15:01:45 1999
--- bind8/src/port/aux3/Makefile.set	Sun Jun 23 17:32:38 2002
***************
*** 3,9 ****
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-lposix -lbsd -ll'
  'INSTALL=install'
  'STRIP=-s'
  'DESTSBIN=/usr/local/etc'
--- 3,10 ----
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-lposix -lbsd'
! 'LIBL=-ll'
  'INSTALL=install'
  'STRIP=-s'
  'DESTSBIN=/usr/local/etc'
Index: bind8/src/port/bsdos/Makefile.set
diff -c bind8/src/port/bsdos/Makefile.set:1.6 bind8/src/port/bsdos/Makefile.set:1.7
*** bind8/src/port/bsdos/Makefile.set:1.6	Tue Jun 19 17:27:06 2001
--- bind8/src/port/bsdos/Makefile.set	Sun Jun 23 17:32:39 2002
***************
*** 9,15 ****
  'DESTHELP=/usr/share/misc'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTHELP=/usr/share/misc'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/bsdos2/Makefile.set
diff -c bind8/src/port/bsdos2/Makefile.set:1.1 bind8/src/port/bsdos2/Makefile.set:1.2
*** bind8/src/port/bsdos2/Makefile.set:1.1	Wed Jan  6 13:56:24 1999
--- bind8/src/port/bsdos2/Makefile.set	Sun Jun 23 17:32:41 2002
***************
*** 9,15 ****
  'DESTHELP=/usr/share/misc'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTHELP=/usr/share/misc'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/cygwin/Makefile.set
diff -c bind8/src/port/cygwin/Makefile.set:1.2 bind8/src/port/cygwin/Makefile.set:1.3
*** bind8/src/port/cygwin/Makefile.set:1.2	Sun Apr  1 11:11:47 2001
--- bind8/src/port/cygwin/Makefile.set	Sun Jun 23 17:32:43 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=flex -8 -I'
  'YACC=byacc -d'
! 'SYSLIBS=-lfl'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=flex -8 -I'
  'YACC=byacc -d'
! 'SYSLIBS='
! 'LIBL=-lfl'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/darwin/Makefile.set
diff -c bind8/src/port/darwin/Makefile.set:1.1 bind8/src/port/darwin/Makefile.set:1.2
*** bind8/src/port/darwin/Makefile.set:1.1	Mon Jul 10 22:08:23 2000
--- bind8/src/port/darwin/Makefile.set	Sun Jun 23 17:32:44 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/decunix/Makefile.set
diff -c bind8/src/port/decunix/Makefile.set:1.5 bind8/src/port/decunix/Makefile.set:1.6
*** bind8/src/port/decunix/Makefile.set:1.5	Mon Nov  9 20:24:54 1998
--- bind8/src/port/decunix/Makefile.set	Sun Jun 23 17:32:48 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil -lmld'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=cat'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil -lmld'
! 'LIBL=-ll'
  'INSTALL=installbsd'
  'MANDIR=man'
  'MANROFF=cat'
Index: bind8/src/port/freebsd/Makefile.set
diff -c bind8/src/port/freebsd/Makefile.set:1.8 bind8/src/port/freebsd/Makefile.set:1.10
*** bind8/src/port/freebsd/Makefile.set:1.8	Mon Feb 25 18:56:32 2002
--- bind8/src/port/freebsd/Makefile.set	Sun Jun 23 17:32:49 2002
***************
*** 1,5 ****
  'CC=cc'
! 'CDEBUG=-O2 -g -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -DMEMCLUSTER_RECORD=1'
  'DESTBIN=/usr/bin'
  'DESTSBIN=/usr/sbin'
  'DESTEXEC=/usr/libexec'
--- 1,5 ----
  'CC=cc'
! 'CDEBUG=-O2 -g -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat'
  'DESTBIN=/usr/bin'
  'DESTSBIN=/usr/sbin'
  'DESTEXEC=/usr/libexec'
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/hpux10/Makefile.set
diff -c bind8/src/port/hpux10/Makefile.set:1.1 bind8/src/port/hpux10/Makefile.set:1.2
*** bind8/src/port/hpux10/Makefile.set:1.1	Sun Feb 21 19:35:17 1999
--- bind8/src/port/hpux10/Makefile.set	Sun Jun 23 17:32:51 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/hpux9/Makefile.set
diff -c bind8/src/port/hpux9/Makefile.set:1.4 bind8/src/port/hpux9/Makefile.set:1.5
*** bind8/src/port/hpux9/Makefile.set:1.4	Mon Jun  8 11:04:32 1998
--- bind8/src/port/hpux9/Makefile.set	Sun Jun 23 17:32:54 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/irix/Makefile.set
diff -c bind8/src/port/irix/Makefile.set:1.5 bind8/src/port/irix/Makefile.set:1.6
*** bind8/src/port/irix/Makefile.set:1.5	Thu Jun  3 14:16:09 1999
--- bind8/src/port/irix/Makefile.set	Sun Jun 23 17:32:55 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=bsdinst'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=bsdinst'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/linux/Makefile.set
diff -c bind8/src/port/linux/Makefile.set:1.6 bind8/src/port/linux/Makefile.set:1.7
*** bind8/src/port/linux/Makefile.set:1.6	Thu Jun 10 23:01:35 1999
--- bind8/src/port/linux/Makefile.set	Sun Jun 23 17:32:57 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=flex -8 -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lfl'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=cat'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=flex -8 -I'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-lfl'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=cat'
Index: bind8/src/port/lynxos/Makefile.set
diff -c bind8/src/port/lynxos/Makefile.set:1.3 bind8/src/port/lynxos/Makefile.set:1.4
*** bind8/src/port/lynxos/Makefile.set:1.3	Mon Jun  8 11:04:33 1998
--- bind8/src/port/lynxos/Makefile.set	Sun Jun 23 17:32:58 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=flex'
  'YACC=yacc -d'
! 'SYSLIBS=-lc -lbind /usr/lib/libfl.a'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=flex'
  'YACC=yacc -d'
! 'SYSLIBS=-lc -lbind'
! 'LIBL=/usr/lib/libfl.a'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/mpe/Makefile.set
diff -c bind8/src/port/mpe/Makefile.set:1.4 bind8/src/port/mpe/Makefile.set:1.5
*** bind8/src/port/mpe/Makefile.set:1.4	Sun Apr 22 20:04:01 2001
--- bind8/src/port/mpe/Makefile.set	Sun Jun 23 17:33:00 2002
***************
*** 13,19 ****
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lsocket -lcurses -L/SYSLOG/PUB -lsyslog'
  'INSTALL=install'
  'INSTALL_LIB=-o $(HPUSER).$(HPACCOUNT) -g $(HPACCOUNT)'
  'MANDIR=man'
--- 13,20 ----
  'LDS=:'
  'LEX=lex -v'
  'YACC=yacc -d'
! 'SYSLIBS=-lsocket -lcurses -L/SYSLOG/PUB -lsyslog'
! 'LIBL=-ll'
  'INSTALL=install'
  'INSTALL_LIB=-o $(HPUSER).$(HPACCOUNT) -g $(HPACCOUNT)'
  'MANDIR=man'
Index: bind8/src/port/netbsd/Makefile.set
diff -c bind8/src/port/netbsd/Makefile.set:1.5 bind8/src/port/netbsd/Makefile.set:1.6
*** bind8/src/port/netbsd/Makefile.set:1.5	Wed Jun 20 19:01:16 2001
--- bind8/src/port/netbsd/Makefile.set	Sun Jun 23 17:33:02 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/next/Makefile.set
diff -c bind8/src/port/next/Makefile.set:1.2 bind8/src/port/next/Makefile.set:1.3
*** bind8/src/port/next/Makefile.set:1.2	Mon Mar 15 16:28:12 1999
--- bind8/src/port/next/Makefile.set	Sun Jun 23 17:33:05 2002
***************
*** 11,17 ****
  'DESTHELP=/usr/local/lib'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'LD_LIBFLAGS=-r'
  'INSTALL=install'
  'MANDIR=man'
--- 11,18 ----
  'DESTHELP=/usr/local/lib'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'LD_LIBFLAGS=-r'
  'INSTALL=install'
  'MANDIR=man'
Index: bind8/src/port/openbsd/Makefile.set
diff -c bind8/src/port/openbsd/Makefile.set:1.2 bind8/src/port/openbsd/Makefile.set:1.3
*** bind8/src/port/openbsd/Makefile.set:1.2	Thu Mar 19 11:50:33 1998
--- bind8/src/port/openbsd/Makefile.set	Sun Jun 23 17:33:07 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lutil'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-lutil'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/qnx/Makefile.set
diff -c bind8/src/port/qnx/Makefile.set:1.1 bind8/src/port/qnx/Makefile.set:1.2
*** bind8/src/port/qnx/Makefile.set:1.1	Fri Mar 20 00:12:51 1998
--- bind8/src/port/qnx/Makefile.set	Sun Jun 23 17:33:08 2002
***************
*** 12,17 ****
--- 12,18 ----
  'LEX=lex -I'
  'YACC=yacc -d'
  'SYSLIBS=-lsocket -lunix'
+ 'LIBL='
  'INSTALL=/usr/local/bin/install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/rhapsody/Makefile.set
diff -c bind8/src/port/rhapsody/Makefile.set:1.2 bind8/src/port/rhapsody/Makefile.set:1.3
*** bind8/src/port/rhapsody/Makefile.set:1.2	Tue May 11 14:44:13 1999
--- bind8/src/port/rhapsody/Makefile.set	Sun Jun 23 17:33:11 2002
***************
*** 9,15 ****
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
--- 9,16 ----
  'DESTRUN=/var/run'
  'LEX=lex -I'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=cat'
  'MANROFF=(tbl|nroff -man)'
Index: bind8/src/port/sco42/Makefile.set
diff -c bind8/src/port/sco42/Makefile.set:1.4 bind8/src/port/sco42/Makefile.set:1.5
*** bind8/src/port/sco42/Makefile.set:1.4	Mon Jun  8 11:04:35 1998
--- bind8/src/port/sco42/Makefile.set	Sun Jun 23 17:33:13 2002
***************
*** 3,9 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lnsl_s -lsocket -lc_s'
  'INSTALL=/usr/local/bin/scoinst'
  'DESTDIR='
  'DESTBIN=/usr/bin'
--- 3,10 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lnsl_s -lsocket -lc_s'
! 'LIBL=-ll'
  'INSTALL=/usr/local/bin/scoinst'
  'DESTDIR='
  'DESTBIN=/usr/bin'
Index: bind8/src/port/sco50/Makefile.set
diff -c bind8/src/port/sco50/Makefile.set:1.7 bind8/src/port/sco50/Makefile.set:1.8
*** bind8/src/port/sco50/Makefile.set:1.7	Sat Aug  7 20:16:06 1999
--- bind8/src/port/sco50/Makefile.set	Sun Jun 23 17:33:14 2002
***************
*** 6,12 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lnsl -L/usr/local/lib -lsocket'
  'INSTALL=/usr/local/bin/install'
  'DESTDIR='
  'DESTBIN=/usr/local/bin'
--- 6,13 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lnsl -L/usr/local/lib -lsocket'
! 'LIBL=-ll'
  'INSTALL=/usr/local/bin/install'
  'DESTDIR='
  'DESTBIN=/usr/local/bin'
Index: bind8/src/port/solaris/Makefile.set
diff -c bind8/src/port/solaris/Makefile.set:1.13 bind8/src/port/solaris/Makefile.set:1.14
*** bind8/src/port/solaris/Makefile.set:1.13	Mon Oct 18 17:45:13 1999
--- bind8/src/port/solaris/Makefile.set	Sun Jun 23 17:33:16 2002
***************
*** 11,17 ****
  'AR=/usr/ccs/bin/ar cru'
  'LEX=/usr/ccs/bin/lex'
  'YACC=/usr/ccs/bin/yacc -d'
! 'SYSLIBS=-ll -lnsl -lsocket'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
--- 11,18 ----
  'AR=/usr/ccs/bin/ar cru'
  'LEX=/usr/ccs/bin/lex'
  'YACC=/usr/ccs/bin/yacc -d'
! 'SYSLIBS=-lnsl -lsocket'
! 'LIBL=-ll'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/sunos/Makefile.set
diff -c bind8/src/port/sunos/Makefile.set:1.5 bind8/src/port/sunos/Makefile.set:1.6
*** bind8/src/port/sunos/Makefile.set:1.5	Mon Jun  8 11:04:37 1998
--- bind8/src/port/sunos/Makefile.set	Sun Jun 23 17:33:17 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS='
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/ultrix/Makefile.set
diff -c bind8/src/port/ultrix/Makefile.set:1.6 bind8/src/port/ultrix/Makefile.set:1.7
*** bind8/src/port/ultrix/Makefile.set:1.6	Mon Jul 10 23:41:43 2000
--- bind8/src/port/ultrix/Makefile.set	Sun Jun 23 17:33:19 2002
***************
*** 9,15 ****
  'DESTRUN=/etc'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lcP -ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=cat'
--- 9,16 ----
  'DESTRUN=/etc'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lcP'
! 'LIBL=-ll'
  'INSTALL=install'
  'MANDIR=man'
  'MANROFF=cat'
Index: bind8/src/port/unixware20/Makefile.set
diff -c bind8/src/port/unixware20/Makefile.set:1.3 bind8/src/port/unixware20/Makefile.set:1.4
*** bind8/src/port/unixware20/Makefile.set:1.3	Mon Jun  8 11:04:37 1998
--- bind8/src/port/unixware20/Makefile.set	Sun Jun 23 17:33:20 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-ll -lnsl -lsocket -lgen -L/usr/ucblib -lucb'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lnsl -lsocket -lgen -L/usr/ucblib -lucb'
! 'LIBL=-ll'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/unixware212/Makefile.set
diff -c bind8/src/port/unixware212/Makefile.set:1.3 bind8/src/port/unixware212/Makefile.set:1.4
*** bind8/src/port/unixware212/Makefile.set:1.3	Mon Jun  8 11:04:38 1998
--- bind8/src/port/unixware212/Makefile.set	Sun Jun 23 17:33:21 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lc89 -ll -lnsl -lsocket'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lc89 -lnsl -lsocket'
! 'LIBL=-ll'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
Index: bind8/src/port/unixware7/Makefile.set
diff -c bind8/src/port/unixware7/Makefile.set:1.1 bind8/src/port/unixware7/Makefile.set:1.2
*** bind8/src/port/unixware7/Makefile.set:1.1	Sun Feb 21 23:46:58 1999
--- bind8/src/port/unixware7/Makefile.set	Sun Jun 23 17:33:22 2002
***************
*** 10,16 ****
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS= -ll -lnsl -lsocket'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
--- 10,17 ----
  'LDS=:'
  'LEX=lex'
  'YACC=yacc -d'
! 'SYSLIBS=-lnsl -lsocket'
! 'LIBL=-ll'
  'INSTALL=/usr/ucb/install'
  'MANDIR=man'
  'MANROFF=man'
