Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/dist/bind/bin/named Pull up revisions 1.5-1.6 (requeste...
details: https://anonhg.NetBSD.org/src/rev/f07b2d0c831e
branches: netbsd-1-6
changeset: 528145:f07b2d0c831e
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Jun 28 11:33:38 2002 +0000
description:
Pull up revisions 1.5-1.6 (requested by itojun in ticket #387):
Update to BIND 8.3.3. Fixes buffer overrun in resolver code.
diffstat:
dist/bind/bin/named/ns_maint.c | 144 +++++++++++++++++++++++++++-------------
1 files changed, 96 insertions(+), 48 deletions(-)
diffs (truncated from 332 to 300 lines):
diff -r 946560d4d036 -r f07b2d0c831e dist/bind/bin/named/ns_maint.c
--- a/dist/bind/bin/named/ns_maint.c Fri Jun 28 11:33:26 2002 +0000
+++ b/dist/bind/bin/named/ns_maint.c Fri Jun 28 11:33:38 2002 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: ns_maint.c,v 1.4 2001/05/17 22:59:40 itojun Exp $ */
+/* $NetBSD: ns_maint.c,v 1.4.2.1 2002/06/28 11:33:38 lukem Exp $ */
#if !defined(lint) && !defined(SABER)
static const char sccsid[] = "@(#)ns_maint.c 4.39 (Berkeley) 3/2/91";
-static const char rcsid[] = "Id: ns_maint.c,v 8.122 2001/03/01 06:26:31 marka Exp";
+static const char rcsid[] = "Id: ns_maint.c,v 8.136 2002/06/26 03:27:20 marka Exp";
#endif /* not lint */
/*
@@ -134,7 +134,6 @@
static void startxfer(struct zoneinfo *),
abortxfer(struct zoneinfo *),
- tryxfer(void),
purge_z_2(struct hashbuf *, int);
static int purge_nonglue_2(const char *, struct hashbuf *,
int, int, int);
@@ -269,11 +268,8 @@
break;
}
- /*
- * It is essential that we never try to set a timer in the past
- * or for now because doing so could cause an infinite loop.
- */
- INSIST(zp->z_time == 0 || zp->z_time > tt.tv_sec);
+ if (zp->z_time != 0 && zp->z_time < tt.tv_sec)
+ zp->z_time = tt.tv_sec;
sched_zone_maint(zp);
}
@@ -284,6 +280,10 @@
ztimer_info zti = uap;
struct zoneinfo *zp;
+ UNUSED(ctx);
+ UNUSED(due);
+ UNUSED(inter);
+
INSIST(zti != NULL);
ns_debug(ns_log_maint, 1, "do_zone_maint for zone %s (class %s)",
@@ -405,6 +405,10 @@
{
int deleted;
+ UNUSED(ctx);
+ UNUSED(due);
+ UNUSED(inter);
+
gettime(&tt);
INSIST(uap == NULL);
deleted = clean_cache(hashtab, 0);
@@ -418,6 +422,10 @@
{
struct zoneinfo *zp;
+ UNUSED(ctx);
+ UNUSED(due);
+ UNUSED(inter);
+
gettime(&tt);
INSIST(uap == NULL);
@@ -446,9 +454,10 @@
* Trigger a refresh query while the link is up by
* sending a notify.
*/
- if (((zp->z_notify == znotify_yes) ||
- ((zp->z_notify == znotify_use_default) &&
- !NS_OPTION_P(OPTION_NONOTIFY))) &&
+ if (((zp->z_notify == notify_yes) ||
+ (zp->z_notify == notify_explicit) ||
+ ((zp->z_notify == notify_use_default) &&
+ server_options->notify != notify_no)) &&
(zt == z_master || zt == z_slave) && !loading &&
((zp->z_flags & Z_AUTH) != 0))
ns_notify(zp->z_origin, zp->z_class, ns_t_soa);
@@ -517,9 +526,9 @@
}
qp = sysquery(zp->z_origin, zp->z_class, T_SOA,
- zp->z_addr, zp->z_addrcnt,
+ zp->z_addr, zp->z_keys, zp->z_addrcnt,
ntohs(zp->z_port) ? zp->z_port : ns_port,
- QUERY);
+ QUERY, 0);
if (qp == NULL) {
ns_debug(ns_log_default, 1,
"qserial_query(%s): sysquery FAILED",
@@ -649,18 +658,28 @@
* 1: Tsig info successfully written.
*/
static int
-write_tsig_info(struct in_addr addr, char *name, int *fd) {
+write_tsig_info(struct zoneinfo *zp, struct in_addr addr, char *name, int *fd) {
server_info si;
- DST_KEY *dst_key;
+ DST_KEY *dst_key = NULL;
int tsig_fd = *fd;
char tsig_str[1024], secret_buf64[172];
u_char secret_buf[128];
int secret_len, len;
+ int i;
- si = find_server(addr);
- if (si == NULL || si->key_list == NULL || si->key_list->first == NULL)
- return(0);
- dst_key = si->key_list->first->key;
+ for (i = 0; i < zp->z_addrcnt ; i++)
+ if (memcmp(&addr, &zp->z_addr[i], sizeof(addr)) == 0) {
+ dst_key = zp->z_keys[i];
+ break;
+ }
+
+ if (dst_key == NULL) {
+ si = find_server(addr);
+ if (si == NULL || si->key_list == NULL ||
+ si->key_list->first == NULL)
+ return(0);
+ dst_key = si->key_list->first->key;
+ }
if (tsig_fd == -1) {
*fd = tsig_fd = mkstemp(name);
if (tsig_fd < 0) {
@@ -681,7 +700,7 @@
if (len == -1)
return (-1);
/* We need snprintf! */
- if (strlen(dst_key->dk_key_name) + len + sizeof("XXX.XXX.XXX.XXX"),
+ if (strlen(dst_key->dk_key_name) + len + sizeof("XXX.XXX.XXX.XXX") +
sizeof("123") + 5 > sizeof(tsig_str))
return (-1);
sprintf(tsig_str, "%s\n%s\n%d\n%s\n",
@@ -709,7 +728,7 @@
if (aIsUs(a) && ns_port == zp->z_port)
continue;
- tsig_ret = write_tsig_info(a, tsig_name, &tsig_fd);
+ tsig_ret = write_tsig_info(zp, a, tsig_name, &tsig_fd);
switch (tsig_ret) {
case -1:
goto error;
@@ -759,7 +778,8 @@
*/
static void
startxfer(struct zoneinfo *zp) {
- char *argv[NSMAX*2 + 20], argv_ns[NSMAX][MAXDNAME];
+ char *argv[NSMAX*2 + 20];
+ char argv_ns[NSMAX][MAXDNAME];
int argc = 0, argc_ns = 0, i;
pid_t pid;
u_int cnt;
@@ -775,50 +795,50 @@
zp->z_origin[0] != '\0' ? zp->z_origin : ".");
argv[argc++] = server_options->named_xfer;
- argv[argc++] = "-z";
- argv[argc++] = zp->z_origin;
- argv[argc++] = "-f";
+ DE_CONST("-z", argv[argc++]);
+ DE_CONST(*zp->z_origin ? zp->z_origin : ".", argv[argc++]);
+ DE_CONST("-f", argv[argc++]);
argv[argc++] = zp->z_source;
#ifdef BIND_IXFR
if (supports_ixfr(zp) && zp->z_ixfr_tmp != NULL) {
- argv[argc++] = "-i";
+ DE_CONST("-i", argv[argc++]);
argv[argc++] = zp->z_ixfr_tmp;
}
#endif
if (zp->z_serial != 0) {
- argv[argc++] = "-s";
+ DE_CONST("-s", argv[argc++]);
sprintf(serial_str, "%u", zp->z_serial);
argv[argc++] = serial_str;
}
if (zp->z_axfr_src.s_addr != 0 ||
server_options->axfr_src.s_addr != 0) {
- argv[argc++] = "-x";
+ DE_CONST("-x", argv[argc++]);
argv[argc++] = strcpy(src_str, inet_ntoa(
(zp->z_axfr_src.s_addr != 0) ? zp->z_axfr_src :
server_options->axfr_src));
}
- argv[argc++] = "-C";
+ DE_CONST("-C", argv[argc++]);
sprintf(class_str, "%d", zp->z_class);
argv[argc++] = class_str;
if (zp->z_flags & Z_SYSLOGGED)
- argv[argc++] = "-q";
- argv[argc++] = "-P";
+ DE_CONST("-q", argv[argc++]);
+ DE_CONST("-P", argv[argc++]);
sprintf(port_str, "%d", ntohs(zp->z_port) != 0 ? zp->z_port : ns_port);
argv[argc++] = port_str;
#ifdef STUBS
if (zp->z_type == Z_STUB)
- argv[argc++] = "-S";
+ DE_CONST("-S", argv[argc++]);
#endif
#ifdef DEBUG
if (debug) {
- argv[argc++] = "-d";
+ DE_CONST("-d", argv[argc++]);
sprintf(debug_str, "%d", debug);
argv[argc++] = debug_str;
- argv[argc++] = "-l";
- argv[argc++] = _PATH_XFERDDT;
+ DE_CONST("-l", argv[argc++]);
+ DE_CONST(_PATH_XFERDDT, argv[argc++]);
if (debug > 5) {
- argv[argc++] = "-t";
- argv[argc++] = _PATH_XFERTRACE;
+ DE_CONST("-t", argv[argc++]);
+ DE_CONST(_PATH_XFERTRACE, argv[argc++]);
}
}
#endif
@@ -842,7 +862,7 @@
return;
}
if (tsig_ret != 0) {
- argv[argc++] = "-T";
+ DE_CONST("-T", argv[argc++]);
argv[argc++] = tsig_name;
}
@@ -869,9 +889,9 @@
if (si != NULL &&
(si->flags & SERVER_INFO_SUPPORT_IXFR) != 0)
- argv[argc++] = "ixfr";
+ DE_CONST("ixfr", argv[argc++]);
else
- argv[argc++] = "axfr";
+ DE_CONST("axfr", argv[argc++]);
}
#endif
}
@@ -987,7 +1007,8 @@
if (zp->z_type == z_master && (zp->z_flags & Z_DYNAMIC) != 0) {
ns_debug(category, level,
"\tdumpintvl %lu, soaincrintvl %lu deferupdcnt %lu",
- (unsigned long)zp->z_dumpintvl, zp->z_soaincrintvl,
+ (unsigned long)zp->z_dumpintvl,
+ (unsigned long)zp->z_soaincrintvl,
(unsigned long)zp->z_deferupdcnt);
if (zp->z_soaincrtime)
ns_debug(category, level,
@@ -1180,6 +1201,22 @@
xfers_deferred--;
}
ns_stopxfrs(zp);
+ if ((zp->z_flags & Z_XFER_RUNNING) != 0) {
+ int i;
+ /* Kill and abandon the current transfer. */
+ for (i = 0; i < MAX_XFERS_RUNNING; i++) {
+ if (xferstatus[i].xfer_pid == zp->z_xferpid) {
+ xferstatus[i].xfer_pid = 0;
+ xferstatus[i].xfer_state = XFER_IDLE;
+ xfers_running--;
+ break;
+ }
+ }
+ (void)kill(zp->z_xferpid, SIGTERM);
+ zp->z_flags &= ~(Z_XFER_RUNNING|Z_XFER_ABORTED|Z_XFER_GONE);
+ zp->z_xferpid = 0;
+ ns_need(main_need_tryxfer);
+ }
do_reload(zp->z_origin, zp->z_type, zp->z_class, 1);
ns_notice(ns_log_config, "%s zone \"%s\" (%s) %s",
zoneTypeString(zp->z_type), zp->z_origin,
@@ -1242,9 +1279,8 @@
ns_samedomain((char*)dp->d_data, zones[dp->d_zone].z_origin))
return (1);
- /* NOKEY is in parent zone otherwise child zone */
- if (dp->d_type == T_KEY && dp->d_size == 4 &&
- (dp->d_data[0] & 0xc3) == 0xc1)
+ /* KEY RRset may be in the parent */
+ if (dp->d_type == T_KEY)
return (1);
/* NXT & KEY records may be signed */
@@ -1595,10 +1631,11 @@
zp->z_xferpid = XFER_ISAXFR;
if (exitstatus == XFER_SUCCESSAXFRIXFRFILE) {
zp->z_xferpid = XFER_ISAXFRIXFR;
+ if (zp->z_ixfr_tmp != NULL)
+ isc_movefile(
+ zp->z_ixfr_tmp,
+ zp->z_source);
}
- if (zp->z_ixfr_tmp != NULL)
Home |
Main Index |
Thread Index |
Old Index