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 revision 1.7 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/26288c83bbb2
branches:  netbsd-1-6
changeset: 528135:26288c83bbb2
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:31:41 2002 +0000

description:
Pull up revision 1.7 (requested by itojun in ticket #387):
Update to BIND 8.3.3.  Fixes buffer overrun in resolver code.

diffstat:

 dist/bind/bin/named/ns_config.c |  199 +++++++++++++++++++++------------------
 1 files changed, 109 insertions(+), 90 deletions(-)

diffs (truncated from 606 to 300 lines):

diff -r 96b9eb523f90 -r 26288c83bbb2 dist/bind/bin/named/ns_config.c
--- a/dist/bind/bin/named/ns_config.c   Fri Jun 28 11:31:21 2002 +0000
+++ b/dist/bind/bin/named/ns_config.c   Fri Jun 28 11:31:41 2002 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ns_config.c,v 1.6 2001/05/17 22:59:39 itojun Exp $     */
+/*     $NetBSD: ns_config.c,v 1.6.2.1 2002/06/28 11:31:41 lukem Exp $  */
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_config.c,v 8.121 2001/02/08 02:05:53 marka Exp";
+static const char rcsid[] = "Id: ns_config.c,v 8.135 2002/05/24 03:04:59 marka Exp";
 #endif /* not lint */
 
 /*
@@ -91,7 +91,6 @@
 static int options_installed = 0;
 static int logging_installed = 0;
 static int default_options_installed;
-static int initial_configuration = 1;
 
 static char **logging_categories;
 static char *current_pid_filename = NULL;
@@ -104,7 +103,7 @@
 void
 free_zone_timerinfo(struct zoneinfo *zp) {
        if (zp->z_timerinfo != NULL) {
-               freestr(zp->z_timerinfo->name);
+               zp->z_timerinfo->name = freestr(zp->z_timerinfo->name);
                memput(zp->z_timerinfo, sizeof *zp->z_timerinfo);
                zp->z_timerinfo = NULL;
        } else
@@ -127,17 +126,13 @@
                                 strerror(errno));
        }
        if (zp->z_origin != NULL)
-               freestr(zp->z_origin);
-       zp->z_origin = NULL;
+               zp->z_origin = freestr(zp->z_origin);
        if (zp->z_source != NULL)
-               freestr(zp->z_source);
-       zp->z_source = NULL;
+               zp->z_source = freestr(zp->z_source);
        if (zp->z_ixfr_base != NULL)
-               freestr(zp->z_ixfr_base);
-       zp->z_ixfr_base = NULL;
+               zp->z_ixfr_base = freestr(zp->z_ixfr_base);
        if (zp->z_ixfr_tmp != NULL)
-               freestr(zp->z_ixfr_tmp);
-       zp->z_ixfr_tmp = NULL;
+               zp->z_ixfr_tmp = freestr(zp->z_ixfr_tmp);
        if (zp->z_update_acl != NULL)
                free_ip_match_list(zp->z_update_acl);
        zp->z_update_acl = NULL;
@@ -149,8 +144,7 @@
        zp->z_transfer_acl = NULL;
 #ifdef BIND_UPDATE
        if (zp->z_updatelog != NULL)
-               freestr(zp->z_updatelog);
-       zp->z_updatelog = NULL;
+               zp->z_updatelog = freestr(zp->z_updatelog);
 #endif /* BIND_UPDATE */
 #ifdef BIND_NOTIFY
        if (zp->z_also_notify != NULL)
@@ -158,6 +152,9 @@
                       zp->z_notify_count * sizeof *zp->z_also_notify);
        zp->z_also_notify = NULL;
 #endif
+       if (zp->z_fwdtab != NULL)
+               free_forwarders(zp->z_fwdtab);
+       zp->z_fwdtab = NULL;
        block_signals();
        if (LINKED(zp, z_reloadlink))
                UNLINK(reloadingzones, zp, z_reloadlink);
@@ -191,7 +188,7 @@
 }
 
 static struct zoneinfo *
-new_zone(int class, int type) {
+new_zone(void) {
        struct zoneinfo *zp;
 
        if (EMPTY(freezones))
@@ -305,9 +302,16 @@
        if (zp->z_query_acl) {
                if (zp->z_type != z_master &&
                    zp->z_type != z_slave &&
+#ifdef FORWARD_ALLOWS
+                   zp->z_type != z_forward &&
+#endif
                    zp->z_type != z_stub) {
                        ns_error(ns_log_config,
+#ifdef FORWARD_ALLOWS
+                 "'allow-query' option for hint zone '%s'",
+#else
                  "'allow-query' option for non-{master,slave,stub} zone '%s'",
+#endif
                                 zp->z_origin);
                        return (0);
                }
@@ -315,7 +319,7 @@
 
 #ifdef BIND_NOTIFY
        /* Check notify */
-       if (zp->z_notify != znotify_use_default) {
+       if (zp->z_notify != notify_use_default) {
                if (zp->z_type != z_master && zp->z_type != z_slave) {
                        ns_error(ns_log_config,
                        "'notify' given for non-master, non-slave zone '%s'",
@@ -474,7 +478,7 @@
         * any data that was dynamically allocated.
         */
        if (zp->z_origin != NULL)
-               freestr(zp->z_origin);
+               (void)freestr(zp->z_origin);
        zp->z_origin = new_zp->z_origin;
        new_zp->z_origin = NULL;
        zp->z_maintain_ixfr_base = new_zp->z_maintain_ixfr_base;
@@ -482,8 +486,10 @@
        zp->z_class = new_zp->z_class;
        zp->z_type = new_zp->z_type;
        zp->z_checknames = new_zp->z_checknames;
-       for (i = 0; i < new_zp->z_addrcnt; i++)
+       for (i = 0; i < new_zp->z_addrcnt; i++) {
                zp->z_addr[i] = new_zp->z_addr[i];
+               zp->z_keys[i] = new_zp->z_keys[i];
+       }
        zp->z_addrcnt = new_zp->z_addrcnt;
        if (zp->z_update_acl)
                free_ip_match_list(zp->z_update_acl);
@@ -531,7 +537,7 @@
        zp->z_dumpintvl = new_zp->z_dumpintvl;
        zp->z_deferupdcnt = new_zp->z_deferupdcnt;
        if (zp->z_updatelog)
-               freestr(zp->z_updatelog);
+               (void)freestr(zp->z_updatelog);
        zp->z_updatelog = new_zp->z_updatelog;
        new_zp->z_updatelog = NULL;
 #endif /* BIND_UPDATE */
@@ -556,7 +562,7 @@
 
                /* File has changed, or hasn't been loaded yet. */
                if (zp->z_source) {
-                       freestr(zp->z_source);
+                       zp->z_source = freestr(zp->z_source);
                        ns_stopxfrs(zp);
                        purge_zone(zp->z_origin, fcachetab, zp->z_class);
                }
@@ -564,12 +570,12 @@
                new_zp->z_source = NULL;
 
                if (zp->z_ixfr_base)
-                       freestr(zp->z_ixfr_base);
+                       (void)freestr(zp->z_ixfr_base);
                zp->z_ixfr_base = new_zp->z_ixfr_base;
                new_zp->z_ixfr_base = NULL;     
 
                if (zp->z_ixfr_tmp)
-                       freestr(zp->z_ixfr_tmp);
+                       (void)freestr(zp->z_ixfr_tmp);
                zp->z_ixfr_tmp = new_zp->z_ixfr_tmp;
                new_zp->z_ixfr_tmp = NULL;      
 
@@ -599,17 +605,17 @@
        primary_reload:
 #endif /* BIND_UPDATE */
                if (zp->z_source != NULL)
-                       freestr(zp->z_source);
+                       (void)freestr(zp->z_source);
                zp->z_source = new_zp->z_source;
                new_zp->z_source = NULL;
 
                if (zp->z_ixfr_base != NULL)
-                       freestr(zp->z_ixfr_base);
+                       (void)freestr(zp->z_ixfr_base);
                zp->z_ixfr_base = new_zp->z_ixfr_base;
                new_zp->z_ixfr_base = NULL;
 
                if (zp->z_ixfr_tmp != NULL)
-                       freestr(zp->z_ixfr_tmp);
+                       (void)freestr(zp->z_ixfr_tmp);
                zp->z_ixfr_tmp = new_zp->z_ixfr_tmp;
                new_zp->z_ixfr_tmp = NULL;
 
@@ -651,8 +657,7 @@
                     ((!reconfiging) && zonefile_changed_p(zp)))) {
                        ns_debug(ns_log_config, 1,
                                 "backup file changed or missing");
-                       freestr(zp->z_source);
-                       zp->z_source = NULL;
+                       zp->z_source = freestr(zp->z_source);
                        zp->z_serial = 0;       /* force xfer */
                        ns_stopxfrs(zp);
                        /*
@@ -676,7 +681,7 @@
                }
 
                if (zp->z_ixfr_base != NULL)
-                       freestr(zp->z_ixfr_base);
+                       (void)freestr(zp->z_ixfr_base);
                zp->z_ixfr_base = new_zp->z_ixfr_base;
                new_zp->z_ixfr_base = NULL;
 
@@ -729,7 +734,7 @@
 void
 end_zone(zone_config zh, int should_install) {
        struct zoneinfo *zp, *new_zp;
-       char *zname;
+       const char *zname;
        symbol_value value;
 
        new_zp = zh.opaque;
@@ -755,11 +760,11 @@
                zp = NULL;
        }
        if (zp == NULL) {
-               zp = new_zone(new_zp->z_class, new_zp->z_type);
+               zp = new_zone();
                INSIST(zp != NULL);
                value.integer = (zp - zones);
-               define_symbol(zone_symbol_table, savestr(new_zp->z_origin, 1),
-                             new_zp->z_class, value, SYMBOL_FREE_KEY);
+               define_symbol(zone_symbol_table, new_zp->z_origin,
+                             new_zp->z_class, value, 0);
        }
        ns_debug(ns_log_config, 5, "zone '%s', type = %d, class = %d", zname,
                 new_zp->z_type, new_zp->z_class);
@@ -869,7 +874,7 @@
        if (value) {
                zp->z_dialup = zdialup_yes;
 #ifdef BIND_NOTIFY
-               zp->z_notify = znotify_yes;
+               zp->z_notify = notify_yes;
 #endif
        } else
                zp->z_dialup = zdialup_no;
@@ -878,17 +883,14 @@
 }
 
 int
-set_zone_notify(zone_config zh, int value) {
+set_zone_notify(zone_config zh, enum notify value) {
 #ifdef BIND_NOTIFY
        struct zoneinfo *zp;
 
        zp = zh.opaque;
        INSIST(zp != NULL);
 
-       if (value)
-               zp->z_notify = znotify_yes;
-       else
-               zp->z_notify = znotify_no;
+       zp->z_notify = value;
 #endif
        return (1);
 }
@@ -932,7 +934,7 @@
        zp = zh.opaque;
        INSIST(zp != NULL);
 
-       /* Fail if checknames already set for this zone */
+       /* Fail if allow-query acl already set for this zone */
        if (zp->z_query_acl != NULL)
                return (0);
        zp->z_query_acl = iml;
@@ -962,7 +964,7 @@
        zp = zh.opaque;
        INSIST(zp != NULL);
 
-       /* Fail if checknames already set for this zone */
+       /* Fail if allow-transfer acl already set for this zone */
        if (zp->z_transfer_acl != NULL)
                return (0);
        zp->z_transfer_acl = iml;
@@ -976,7 +978,7 @@
        zp = zh.opaque;
        INSIST(zp != NULL);
 
-       /* Fail if checknames already set for this zone */
+       /* Fail if max-transfer-time-in already set for this zone */
        if (zp->z_max_transfer_time_in)
                return (0);
        zp->z_max_transfer_time_in = max_time;
@@ -1015,13 +1017,14 @@
 }
 
 int
-add_zone_master(zone_config zh, struct in_addr address) {
+add_zone_master(zone_config zh, struct in_addr address, struct dst_key * key) {
        struct zoneinfo *zp;
 
        zp = zh.opaque;
        INSIST(zp != NULL);
 
        zp->z_addr[zp->z_addrcnt] = address;
+       zp->z_keys[zp->z_addrcnt] = key;
        zp->z_addrcnt++;
        if (zp->z_addrcnt >= NSMAX) {
                ns_warning(ns_log_config, "NSMAX reached for zone '%s'",
@@ -1086,12 +1089,17 @@
 options
 new_options() {



Home | Main Index | Thread Index | Old Index