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



details:   https://anonhg.NetBSD.org/src/rev/ce6946cc2b9a
branches:  netbsd-1-6
changeset: 528147:ce6946cc2b9a
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:33:56 2002 +0000

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

diffstat:

 dist/bind/bin/named/ns_notify.c |   87 +++++++++++-----
 dist/bind/bin/named/ns_parser.y |  203 ++++++++++++++++++++++++++-------------
 2 files changed, 192 insertions(+), 98 deletions(-)

diffs (truncated from 845 to 300 lines):

diff -r e974b5767b00 -r ce6946cc2b9a dist/bind/bin/named/ns_notify.c
--- a/dist/bind/bin/named/ns_notify.c   Fri Jun 28 11:33:47 2002 +0000
+++ b/dist/bind/bin/named/ns_notify.c   Fri Jun 28 11:33:56 2002 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ns_notify.c,v 1.4 2001/05/17 22:59:40 itojun Exp $     */
+/*     $NetBSD: ns_notify.c,v 1.4.2.1 2002/06/28 11:33:56 lukem Exp $  */
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ns_notify.c,v 8.14 2001/04/01 18:38:36 vixie Exp";
+static const char rcsid[] = "Id: ns_notify.c,v 8.20 2002/04/25 05:27:12 marka Exp";
 #endif /* not lint */
 
 /*
@@ -58,12 +58,12 @@
 
 /* Types. */
 
-struct notify {
+struct pnotify {
        char *                  name;
        ns_class                class;
        ns_type                 type;
        evTimerID               timer;
-       LINK(struct notify)     link;
+       LINK(struct pnotify)    link;
 };
 
 /* Forward. */
@@ -73,14 +73,14 @@
                                         ns_class, ns_type, int, int *, int *);
 static void            sysnotify_ns(const char *, const char *,
                                     ns_class, ns_type, int, int *, int *);
-static void            free_notify(struct notify *);
+static void            free_notify(struct pnotify *);
 static void            notify_timer(evContext, void *,
                                     struct timespec, struct timespec);
 
 /* Local. */
 
-static LIST(struct notify) pending_notifies;
-static LIST(struct notify) loading_notifies;
+static LIST(struct pnotify) pending_notifies;
+static LIST(struct pnotify) loading_notifies;
 
 /* Public. */
 
@@ -93,7 +93,7 @@
        static const char no_room[] = "%s failed, cannot notify for zone %s";
        int delay, max_delay;
        struct zoneinfo *zp;
-       struct notify *ni;
+       struct pnotify *ni;
 
        zp = find_auth_zone(dname, class);
        if (zp == NULL) {
@@ -148,7 +148,7 @@
                       evConsTime(0, 0), &ni->timer) < 0) {
                ns_error(ns_log_notify, "evSetTimer() failed: %s",
                         strerror(errno));
-               freestr(ni->name);
+               ni->name = freestr(ni->name);
                memput(ni, sizeof *ni);
                return;
        }
@@ -164,13 +164,13 @@
 
 void
 notify_afterload() {
-       struct notify *ni;
+       struct pnotify *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);
+               ni->name = freestr(ni->name);
                memput(ni, sizeof *ni);
        }
 }
@@ -182,7 +182,7 @@
 void
 ns_unnotify(void) {
        while (!EMPTY(pending_notifies)) {
-               struct notify *ni = HEAD(pending_notifies);
+               struct pnotify *ni = HEAD(pending_notifies);
 
                INSIST(LINKED(ni, link));
                UNLINK(pending_notifies, ni, link);
@@ -196,7 +196,7 @@
  */
 void
 ns_stopnotify(const char *dname, ns_class class) {
-       struct notify *ni;
+       struct pnotify *ni;
 
        ni = HEAD(pending_notifies);
        while (ni != NULL &&
@@ -237,9 +237,9 @@
                           dname);
                return;
        }
-       if (zp->z_notify == znotify_no ||
-           (zp->z_notify == znotify_use_default &&    
-            NS_OPTION_P(OPTION_NONOTIFY)))
+       if (zp->z_notify == notify_no ||
+           (zp->z_notify == notify_use_default &&    
+            server_options->notify == notify_no))
                return;
        if (zp->z_type != z_master && zp->z_type != z_slave) {
                ns_warning(ns_log_notify, "sysnotify: %s not master or slave",
@@ -249,7 +249,11 @@
        zname = zp->z_origin;
        zserial = zp->z_serial;
        nns = na = 0;
-       sysnotify_slaves(dname, zname, class, type, zp - zones, &nns, &na);
+       if (zp->z_notify == notify_yes ||
+           (zp->z_notify == notify_use_default &&
+            server_options->notify == notify_yes))
+               sysnotify_slaves(dname, zname, class, type,
+                                zp - zones, &nns, &na);
 
        /*
         * Handle any global or zone-specific also-notify clauses
@@ -264,8 +268,8 @@
                for (i = 0; i < zp->z_notify_count; i++) {
                        ns_debug(ns_log_notify, 4, "notifying %s",
                                 inet_ntoa(*also_addr));
-                       sysquery(dname, class, type, also_addr, 1, ns_port,
-                                NS_NOTIFY_OP);
+                       sysquery(dname, class, type, also_addr, NULL, 1,
+                                ns_port, NS_NOTIFY_OP, 0);
                        also_addr++;
                }
                nns += zp->z_notify_count;
@@ -277,8 +281,8 @@
                for (i = 0; i < server_options->notify_count; i++) {
                        ns_debug(ns_log_notify, 3, "notifying %s",
                                 inet_ntoa(*also_addr));
-                       sysquery(dname, class, type, also_addr,
-                                1, ns_port, ns_o_notify);
+                       sysquery(dname, class, type, also_addr, NULL, 1,
+                                ns_port, ns_o_notify, 0);
                        also_addr++;
                }
                nns += server_options->notify_count;
@@ -353,18 +357,26 @@
        const char *fname;
        struct in_addr nss[NSMAX];
        struct hashbuf *htp;
-       int is_us, nsc;
+       int is_us, nsc, auth6, neg;
        int cname = 0;
 
        htp = hashtab;
        anp = nlookup(aname, &htp, &fname, 0);
        nsc = 0;
        is_us = 0;
+       auth6 = 0;
+       neg = 0;
        if (anp != NULL)
                for (adp = anp->n_data; adp; adp = adp->d_next) {
                        struct in_addr ina;
 
-                       if (match(adp, class, T_CNAME)) {
+                       if (adp->d_class != class)
+                               continue;
+                       if (adp->d_rcode == NXDOMAIN) {
+                               neg = 1;
+                               break;
+                       }
+                       if (adp->d_type == T_CNAME && adp->d_rcode == 0) {
                                cname = 1;
                                ns_error(ns_log_notify,
                                         "NS '%s' for '%s/%s' is a CNAME",
@@ -373,8 +385,18 @@
                                         p_class(class));
                                break;
                        }
+                       if ((adp->d_type == T_AAAA || adp->d_type == ns_t_a6) &&
+                           (zones[adp->d_class].z_type == z_master ||
+                            zones[adp->d_class].z_type == z_slave)) {
+                               auth6 = 1;
+                               continue;
+                       }
                        if (!match(adp, class, T_A))
                                continue;
+                       if (adp->d_rcode) {
+                               neg = 1;
+                               continue;
+                       }
                        if (adp->d_type == ns_t_sig)
                                continue;
                        ina = ina_get(adp->d_data);
@@ -386,23 +408,24 @@
                                nss[nsc++] = ina;
                } /*next A*/
        if (nsc == 0) {
-               if (!is_us && !cname && !NS_OPTION_P(OPTION_NOFETCHGLUE)) {
+               if (!is_us && !cname && !auth6 && !neg &&
+                   !NS_OPTION_P(OPTION_NOFETCHGLUE)) {
                        struct qinfo *qp;
 
-                       qp = sysquery(aname, class, ns_t_a, 0, 0, ns_port,
-                                     ns_o_query);
+                       qp = sysquery(aname, class, ns_t_a, NULL, NULL, 0,
+                                     ns_port, ns_o_query, 0);
                        if (qp != NULL)
                                qp->q_notifyzone = zn;
                }
                return;
        }
-       sysquery(dname, class, type, nss, nsc, ns_port, ns_o_notify);
+       sysquery(dname, class, type, nss, NULL, nsc, ns_port, ns_o_notify, 0);
        (*nns)++;
        *na += nsc;
 }
 
 static void
-free_notify(struct notify *ni) {
+free_notify(struct pnotify *ni) {
        struct zoneinfo *zp;
 
        INSIST(!LINKED(ni, link));
@@ -415,7 +438,7 @@
                evClearTimer(ev, ni->timer);
                evInitID(&ni->timer);
        }
-       freestr(ni->name);
+       ni->name = freestr(ni->name);
        memput(ni, sizeof *ni);
 }
 
@@ -424,7 +447,11 @@
             struct timespec due,
             struct timespec inter)
 {
-       struct notify *ni = uap;
+       struct pnotify *ni = uap;
+
+       UNUSED(ctx);
+       UNUSED(due);
+       UNUSED(inter);
 
        INSIST(evTestID(ni->timer));
        evInitID(&ni->timer);
diff -r e974b5767b00 -r ce6946cc2b9a dist/bind/bin/named/ns_parser.y
--- a/dist/bind/bin/named/ns_parser.y   Fri Jun 28 11:33:47 2002 +0000
+++ b/dist/bind/bin/named/ns_parser.y   Fri Jun 28 11:33:56 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ns_parser.y,v 1.4 2001/05/17 22:59:40 itojun Exp $     */
+/*     $NetBSD: ns_parser.y,v 1.4.2.1 2002/06/28 11:34:07 lukem Exp $  */
 
 %{
 #if !defined(lint) && !defined(SABER)
-static char rcsid[] = "Id: ns_parser.y,v 8.63.2.4 2001/04/30 08:03:02 marka Exp";
+static char rcsid[] = "Id: ns_parser.y,v 8.80 2002/05/24 03:05:01 marka Exp";
 #endif /* not lint */
 
 /*
@@ -67,6 +67,7 @@
 
 #define AUTH_TABLE_SIZE 397            /* should always be prime */
 static symbol_table authtab = NULL;
+static symbol_table channeltab = NULL;
 
 static zone_config current_zone;
 static int should_install;
@@ -96,7 +97,7 @@
 static u_long chan_max_size;
 
 static log_channel lookup_channel(char *);
-static void define_channel(char *, log_channel);
+static void define_channel(const char *, log_channel);
 static char *canonical_name(char *);
 
 extern const char *p_order(int order);
@@ -136,7 +137,7 @@
 %token                 T_DIRECTORY T_PIDFILE T_NAMED_XFER
 %token                 T_DUMP_FILE T_STATS_FILE T_MEMSTATS_FILE
 %token                 T_FAKE_IQUERY T_RECURSION T_FETCH_GLUE 
-%token                 T_HITCOUNT
+%token                 T_HITCOUNT T_PREFERRED_GLUE
 %token                 T_QUERY_SOURCE T_LISTEN_ON T_PORT T_ADDRESS
 %token                 T_RRSET_ORDER T_ORDER T_NAME T_CLASS
 %token                 T_CONTROLS T_INET T_UNIX T_PERM T_OWNER T_GROUP T_ALLOW
@@ -147,14 +148,16 @@
 %type  <ip_addr>       maybe_wild_addr
 %token                 T_DATASIZE T_STACKSIZE T_CORESIZE
 %token                 T_DEFAULT T_UNLIMITED
-%token                 T_FILES T_VERSION
+%token                 T_FILES T_VERSION T_HOSTNAME
 %token                 T_HOSTSTATS T_HOSTSTATSMAX T_DEALLOC_ON_EXIT
 %token                 T_TRANSFERS_IN T_TRANSFERS_OUT T_TRANSFERS_PER_NS
 %token                 T_TRANSFER_FORMAT T_MAX_TRANSFER_TIME_IN
 %token                 T_SERIAL_QUERIES T_ONE_ANSWER T_MANY_ANSWERS
 %type  <axfr_fmt>      transfer_format
-%token                 T_NOTIFY T_AUTH_NXDOMAIN T_MULTIPLE_CNAMES T_USE_IXFR T_MAINTAIN_IXFR_BASE
-%token                 T_CLEAN_INTERVAL T_INTERFACE_INTERVAL T_STATS_INTERVAL T_MAX_LOG_SIZE_IXFR
+%token                 T_NOTIFY T_EXPLICIT T_NOTIFY_INITIAL T_AUTH_NXDOMAIN



Home | Main Index | Thread Index | Old Index