]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1623. [bug] A serial number of zero was being displayed in the
authorMark Andrews <marka@isc.org>
Wed, 28 Apr 2004 04:23:34 +0000 (04:23 +0000)
committerMark Andrews <marka@isc.org>
Wed, 28 Apr 2004 04:23:34 +0000 (04:23 +0000)
                        "sending notifies" log message when also-notify was
                        used. [RT #11177]

CHANGES
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index fa98865d5b8e666db4f41c00a9178eb02dfcbe33..2981ff71cce1dcf61618bc1e92e9c952a11966b1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+1623.  [bug]           A serial number of zero was being displayed in the
+                       "sending notifies" log message when also-notify was
+                       used. [RT #11177]
+
 1619.  [bug]           Missing ISC_LIST_UNLINK in end_reserved_dispatches().
                        [RT# 11118]
 
index 51d6cb92a921b8ea393bf2f4a3611ef39c1990b5..35a1e43c26d760881606723a5540be9883ea4d9d 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zone.c,v 1.333.2.31 2004/03/09 06:11:11 marka Exp $ */
+/* $Id: zone.c,v 1.333.2.32 2004/04/28 04:23:34 marka Exp $ */
 
 #include <config.h>
 
@@ -2643,7 +2643,7 @@ zone_notify(dns_zone_t *zone) {
        dns_name_t master;
        dns_rdata_ns_t ns;
        dns_rdata_soa_t soa;
-       isc_uint32_t serial = 0;
+       isc_uint32_t serial;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        dns_rdataset_t nsrdset;
        dns_rdataset_t soardset;
@@ -2678,6 +2678,38 @@ zone_notify(dns_zone_t *zone) {
        if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DIALNOTIFY))
                flags |= DNS_NOTIFY_NOSOA;
 
+       /*
+        * Get SOA RRset.
+        */
+       dns_db_currentversion(zone->db, &version);
+       result = dns_db_findnode(zone->db, origin, ISC_FALSE, &node);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup1;
+
+       dns_rdataset_init(&soardset);
+       result = dns_db_findrdataset(zone->db, node, version,
+                                    dns_rdatatype_soa,
+                                    dns_rdatatype_none, 0, &soardset, NULL);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup2;
+
+       /*
+        * Find serial and master server's name.
+        */
+       dns_name_init(&master, NULL);
+       result = dns_rdataset_first(&soardset);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup3;
+       dns_rdataset_current(&soardset, &rdata);
+       result = dns_rdata_tostruct(&rdata, &soa, NULL);
+       RUNTIME_CHECK(result == ISC_R_SUCCESS);
+       dns_rdata_reset(&rdata);
+       result = dns_name_dup(&soa.origin, zone->mctx, &master);
+       serial = soa.serial;
+       dns_rdataset_disassociate(&soardset);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup3;
+
        /*
         * Enqueue notify requests for 'also-notify' servers.
         */
@@ -2687,19 +2719,14 @@ zone_notify(dns_zone_t *zone) {
                if (notify_isqueued(zone, NULL, &dst))
                        continue;
                result = notify_create(zone->mctx, flags, &notify);
-               if (result != ISC_R_SUCCESS) {
-                       UNLOCK_ZONE(zone);
-                       return;
-               }
+               if (result != ISC_R_SUCCESS)
+                       continue;
                zone_iattach(zone, &notify->zone);
                notify->dst = dst;
                ISC_LIST_APPEND(zone->notifies, notify, link);
                result = notify_send_queue(notify);
-               if (result != ISC_R_SUCCESS) {
+               if (result != ISC_R_SUCCESS)
                        notify_destroy(notify, ISC_TRUE);
-                       UNLOCK_ZONE(zone);
-                       return;
-               }
                if (!loggednotify) {
                        notify_log(zone, ISC_LOG_INFO,
                                   "sending notifies (serial %u)",
@@ -2711,43 +2738,12 @@ zone_notify(dns_zone_t *zone) {
        UNLOCK_ZONE(zone);
 
        if (notifytype == dns_notifytype_explicit)
-               return;
-
+               goto cleanup3;
+  
        /*
         * Process NS RRset to generate notifies.
         */
 
-       dns_db_currentversion(zone->db, &version);
-       result = dns_db_findnode(zone->db, origin, ISC_FALSE, &node);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup1;
-
-       dns_rdataset_init(&soardset);
-       result = dns_db_findrdataset(zone->db, node, version,
-                                    dns_rdatatype_soa,
-                                    dns_rdatatype_none, 0, &soardset, NULL);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup2;
-
-       /*
-        * Find master server's name.
-        */
-       dns_name_init(&master, NULL);
-       result = dns_rdataset_first(&soardset);
-       if (result == ISC_R_SUCCESS) {
-               dns_rdataset_current(&soardset, &rdata);
-               result = dns_rdata_tostruct(&rdata, &soa, NULL);
-               dns_rdata_reset(&rdata);
-               if (result == ISC_R_SUCCESS) {
-                       result = dns_name_dup(&soa.origin, zone->mctx,
-                                             &master);
-                       serial = soa.serial;
-               }
-               dns_rdataset_disassociate(&soardset);
-       }
-       if (result != ISC_R_SUCCESS)
-               goto cleanup3;
-
        dns_rdataset_init(&nsrdset);
        result = dns_db_findrdataset(zone->db, node, version,
                                     dns_rdatatype_ns,