From: Mark Andrews Date: Wed, 28 Apr 2004 04:23:24 +0000 (+0000) Subject: 1623. [bug] A serial number of zero was being displayed in the X-Git-Tag: v9.2.3rc4^3~42 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=08b40678f36df355db8e7b84fa4e74f726dd2b3e;p=thirdparty%2Fbind9.git 1623. [bug] A serial number of zero was being displayed in the "sending notifies" log message when also-notify was used. [RT #11177] --- diff --git a/CHANGES b/CHANGES index 7bf9ba73a22..b74d00be3c6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ -1623. [placeholder] rt11177 +1623. [bug] A serial number of zero was being displayed in the + "sending notifies" log message when also-notify was + used. [RT #11177] 1622. [placeholder] rt11156 diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 206fd4566f1..85031b19dd3 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.412 2004/04/28 04:07:28 marka Exp $ */ +/* $Id: zone.c,v 1.413 2004/04/28 04:23:24 marka Exp $ */ #include @@ -2893,7 +2893,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; @@ -2932,6 +2932,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. */ @@ -2941,19 +2973,14 @@ zone_notify(dns_zone_t *zone) { if (notify_isqueued(zone, NULL, &dst)) continue; result = notify_create(zone->mctx, flags, ¬ify); - if (result != ISC_R_SUCCESS) { - UNLOCK_ZONE(zone); - return; - } + if (result != ISC_R_SUCCESS) + continue; zone_iattach(zone, ¬ify->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)", @@ -2965,41 +2992,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); - 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; - dns_rdataset_init(&nsrdset); result = dns_db_findrdataset(zone->db, node, version, dns_rdatatype_ns,