]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1439. [bug] Named could return NOERROR with certian NOTIFY
authorMark Andrews <marka@isc.org>
Wed, 26 Feb 2003 04:16:27 +0000 (04:16 +0000)
committerMark Andrews <marka@isc.org>
Wed, 26 Feb 2003 04:16:27 +0000 (04:16 +0000)
                        failures.  Return NOTAUTH is the NOTIFY zone is
                        not being served.

1438.   [func]          Log TSIG (if any) when logging NOTIFY requests.
developer: marka
reviewer: explorer

CHANGES
bin/named/notify.c

diff --git a/CHANGES b/CHANGES
index de5093dbd07cc341462df4d8f6e4a7edc729e14e..8fc0bbccf9396218bfc9c1c1caa4af2e25ae4ed7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+1439.  [bug]           Named could return NOERROR with certian NOTIFY
+                       failures.  Return NOTAUTH is the NOTIFY zone is
+                       not being served.
+
+1438.  [func]          Log TSIG (if any) when logging NOTIFY requests.
+
 1437.  [bug]           Leave space for stdio to work in. [RT #5033]
 
 1436.  [func]          dns_zonemgr_resumexfrs() can be used to restart
index b218b94bf9979bfd3c2d594b59452ab088992dd7..ea0eb01c166258572e7980ecbf664c1bbf6d8e4f 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: notify.c,v 1.28 2002/08/01 06:51:32 marka Exp $ */
+/* $Id: notify.c,v 1.29 2003/02/26 04:16:27 marka Exp $ */
 
 #include <config.h>
 
@@ -76,15 +76,18 @@ ns_notify_start(ns_client_t *client) {
        dns_name_t *zonename;
        dns_rdataset_t *zone_rdataset;
        dns_zone_t *zone = NULL;
-       char str[DNS_NAME_FORMATSIZE];
+       char namebuf[DNS_NAME_FORMATSIZE];
+       char tsigbuf[DNS_NAME_FORMATSIZE + sizeof(": TSIG ''")];
+       dns_name_t *tsigname;
 
        /*
         * Interpret the question section.
         */
        result = dns_message_firstname(request, DNS_SECTION_QUESTION);
        if (result != ISC_R_SUCCESS) {
-               notify_log(client, ISC_LOG_NOTICE, "notify question section empty");
-               goto failure;
+               notify_log(client, ISC_LOG_NOTICE,
+                          "notify question section empty");
+               goto formerr;
        }
 
        /*
@@ -96,7 +99,7 @@ ns_notify_start(ns_client_t *client) {
        if (ISC_LIST_NEXT(zone_rdataset, link) != NULL) {
                notify_log(client, ISC_LOG_NOTICE,
                           "notify question section contains multiple RRs");
-               goto failure;
+               goto formerr;
        }
 
        /* The zone section must have exactly one name. */
@@ -104,46 +107,53 @@ ns_notify_start(ns_client_t *client) {
        if (result != ISC_R_NOMORE) {
                notify_log(client, ISC_LOG_NOTICE,
                           "notify question section contains multiple RRs");
-               goto failure;
+               goto formerr;
        }
 
        /* The one rdataset must be an SOA. */
        if (zone_rdataset->type != dns_rdatatype_soa) {
                notify_log(client, ISC_LOG_NOTICE,
                           "notify question section contains no SOA");
-               goto failure;
+               goto formerr;
        }
 
+       tsigname = NULL;
+       if (dns_message_gettsig(request, &tsigname) != NULL) {
+               dns_name_format(tsigname, namebuf, sizeof(namebuf));
+               snprintf(tsigbuf, sizeof(tsigbuf), ": TSIG '%s'", namebuf);
+       } else
+               tsigbuf[0] = '\0';
+       dns_name_format(zonename, namebuf, sizeof(namebuf));
        result = dns_zt_find(client->view->zonetable, zonename, 0, NULL,
                             &zone);
-       if (result != ISC_R_SUCCESS) {
-               dns_name_format(zonename, str, sizeof(str));
-               notify_log(client, ISC_LOG_NOTICE,
-                          "received notify for zone '%s': not authoritative",
-                          str);
-               goto failure;
-       }
+       if (result != ISC_R_SUCCESS)
+               goto notauth;
 
        switch (dns_zone_gettype(zone)) {
        case dns_zone_master:
        case dns_zone_slave:
        case dns_zone_stub:     /* Allow dialup passive to work. */
-               dns_name_format(zonename, str, sizeof(str));
                notify_log(client, ISC_LOG_INFO,
-                          "received notify for zone '%s'", str);
+                          "received notify for zone '%s'%s", namebuf, tsigbuf);
                respond(client, dns_zone_notifyreceive(zone,
                        ns_client_getsockaddr(client), request));
                break;
        default:
-               dns_name_format(zonename, str, sizeof(str));
-               notify_log(client, ISC_LOG_NOTICE,
-                          "received notify for zone '%s': not authoritative",
-                          str);
-               goto failure;
+               goto notauth;
        }
        dns_zone_detach(&zone);
        return;
 
+ notauth:
+       notify_log(client, ISC_LOG_NOTICE,
+                  "received notify for zone '%s'%s: not authoritative",
+                  namebuf, tsigbuf);
+       result = DNS_R_NOTAUTH;
+       goto failure;
+
+ formerr:
+       result = DNS_R_FORMERR;
+
  failure:
        if (zone != NULL)
                dns_zone_detach(&zone);