From ea544b0511a66bc5f3700d56a72dcd808fdf22e8 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Thu, 22 Feb 2001 19:15:01 +0000 Subject: [PATCH] 747. [bug] The code to determine whether an IXFR was possible did not properly check for a database that could not have a journal. [RT #908] --- CHANGES | 4 ++++ bin/named/update.c | 31 +++++++++++++++++-------------- bin/named/xfrout.c | 17 +++++++++++------ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/CHANGES b/CHANGES index 18759ec23b..d435d48ea3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ + 747. [bug] The code to determine whether an IXFR was possible + did not properly check for a database that could + not have a journal. [RT #908] + 746. [bug] The sdb didn't clone rdatasets properly, causing a crash when the server followed delegations. [RT #905] diff --git a/bin/named/update.c b/bin/named/update.c index 2d9629aa00..e469faa68b 100644 --- a/bin/named/update.c +++ b/bin/named/update.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: update.c,v 1.83 2001/02/15 19:38:09 gson Exp $ */ +/* $Id: update.c,v 1.84 2001/02/22 19:15:01 bwelling Exp $ */ #include @@ -2386,6 +2386,7 @@ update_action(isc_task_t *task, isc_event_t *event) { * to the journal. */ if (! ISC_LIST_EMPTY(diff.tuples)) { + char *journalfile; dns_journal_t *journal; /* @@ -2409,23 +2410,25 @@ update_action(isc_task_t *task, isc_event_t *event) { } } - update_log(client, zone, LOGLEVEL_DEBUG, - "writing journal %s", - dns_zone_getjournal(zone)); + journalfile = dns_zone_getjournal(zone); + if (journalfile != NULL) { + update_log(client, zone, LOGLEVEL_DEBUG, + "writing journal %s", journalfile); - journal = NULL; - result = dns_journal_open(mctx, dns_zone_getjournal(zone), - ISC_TRUE, &journal); - if (result != ISC_R_SUCCESS) - FAILS(result, "journal open failed"); + journal = NULL; + result = dns_journal_open(mctx, journalfile, + ISC_TRUE, &journal); + if (result != ISC_R_SUCCESS) + FAILS(result, "journal open failed"); + + result = dns_journal_write_transaction(journal, &diff); + if (result != ISC_R_SUCCESS) { + dns_journal_destroy(&journal); + FAILS(result, "journal write failed"); + } - result = dns_journal_write_transaction(journal, &diff); - if (result != ISC_R_SUCCESS) { dns_journal_destroy(&journal); - FAILS(result, "journal write failed"); } - - dns_journal_destroy(&journal); } /* diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c index 07bebb8f7b..1ff4643483 100644 --- a/bin/named/xfrout.c +++ b/bin/named/xfrout.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: xfrout.c,v 1.93 2001/01/12 19:01:39 gson Exp $ */ +/* $Id: xfrout.c,v 1.94 2001/02/22 19:15:00 bwelling Exp $ */ #include @@ -865,6 +865,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { isc_netaddr_t na; dns_peer_t *peer = NULL; isc_buffer_t *tsigbuf = NULL; + char *journalfile; switch (reqtype) { case dns_rdatatype_axfr: @@ -1048,11 +1049,15 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) { CHECK(soa_rrstream_create(mctx, db, ver, &stream)); goto have_stream; } - result = ixfr_rrstream_create(mctx, - dns_zone_getjournal(zone), - begin_serial, - current_serial, - &data_stream); + journalfile = dns_zone_getjournal(zone); + if (journalfile != NULL) + result = ixfr_rrstream_create(mctx, + journalfile, + begin_serial, + current_serial, + &data_stream); + else + result = ISC_R_NOTFOUND; if (result == ISC_R_NOTFOUND || result == ISC_R_RANGE) { xfrout_log1(client, question_name, ISC_LOG_DEBUG(4),