]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1722. [bug] Don't commit the journal on malformed ixfr streams.
authorMark Andrews <marka@isc.org>
Thu, 16 Sep 2004 04:54:03 +0000 (04:54 +0000)
committerMark Andrews <marka@isc.org>
Thu, 16 Sep 2004 04:54:03 +0000 (04:54 +0000)
                        [RT #12519]

1721.   [bug]           Error message from the journal processing were not
                        always identifing the relevent journal. [RT #12519]

CHANGES
lib/dns/journal.c
lib/dns/xfrin.c

diff --git a/CHANGES b/CHANGES
index 0e941f4c1ab994b2c17ba6e49f0308eaf8ff1f3b..3271d9437d91e57456cc0b0f5e33261bbd094d8c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-1722.  [placeholder]   rt12519
+1722.  [bug]           Don't commit the journal on malformed ixfr streams.
+                       [RT #12519]
 
-1721.  [placeholder]   rt12519
+1721.  [bug]           Error message from the journal processing were not
+                       always identifing the relevent journal. [RT #12519]
 
 1720.  [bug]           'dig +chase' did not terminate on a RFC 2308 Type 1
                        negative response. [RT #12506]
index 5930af4fe02156fea21bf81db22f06c0178d4900..b2b0306b7f0ead16eba422ea439abb727caf3abc 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: journal.c,v 1.88 2004/05/14 05:08:00 marka Exp $ */
+/* $Id: journal.c,v 1.89 2004/09/16 04:54:03 marka Exp $ */
 
 #include <config.h>
 
@@ -1035,8 +1035,8 @@ dns_journal_commit(dns_journal_t *j) {
         */
        if (j->x.n_soa != 2) {
                isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                             "malformed transaction: %d SOAs",
-                             j->x.n_soa);
+                             "%s: malformed transaction: %d SOAs",
+                             j->filename, j->x.n_soa);
                return (ISC_R_UNEXPECTED);
        }
        if (! (DNS_SERIAL_GT(j->x.pos[1].serial, j->x.pos[0].serial) ||
@@ -1044,8 +1044,8 @@ dns_journal_commit(dns_journal_t *j) {
                j->x.pos[1].serial == j->x.pos[0].serial)))
        {
                isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                             "malformed transaction: serial number "
-                             "would decrease");
+                             "%s: malformed transaction: serial number "
+                             "would decrease", j->filename);
                return (ISC_R_UNEXPECTED);
        }
        if (! JOURNAL_EMPTY(&j->header)) {
@@ -1266,8 +1266,8 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
 
                if (++n_put > 100)  {
                        isc_log_write(JOURNAL_DEBUG_LOGARGS(3),
-                                     "applying diff to database (%u)",
-                                     db_serial);
+                                     "%s: applying diff to database (%u)",
+                                     j->filename, db_serial);
                        (void)dns_diff_print(&diff, NULL);
                        CHECK(dns_diff_apply(&diff, db, ver));
                        dns_diff_clear(&diff);
@@ -1280,8 +1280,8 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
 
        if (n_put != 0) {
                isc_log_write(JOURNAL_DEBUG_LOGARGS(3),
-                             "applying final diff to database (%u)",
-                             db_serial);
+                             "%s: applying final diff to database (%u)",
+                             j->filename, db_serial);
                (void)dns_diff_print(&diff, NULL);
                CHECK(dns_diff_apply(&diff, db, ver));
                dns_diff_clear(&diff);
@@ -1352,7 +1352,8 @@ dns_journal_print(isc_mem_t *mctx, const char *filename, FILE *file) {
 
        if (result != ISC_R_SUCCESS) {
                isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                             "journal open failure");
+                             "journal open failure: %s: %s",
+                             isc_result_totext(result), j->filename);
                return (result);
        }
 
@@ -1545,7 +1546,8 @@ read_one_rr(dns_journal_t *j) {
                CHECK(journal_read_xhdr(j, &xhdr));
                if (xhdr.size == 0) {
                        isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
-                                     "journal corrupt: empty transaction");
+                                     "%s: journal corrupt: empty transaction",
+                                     j->filename);
                        FAIL(ISC_R_UNEXPECTED);
                }
                if (xhdr.serial0 != j->it.current_serial) {
index 88d20a4f9eb11fdaf4b4e4c098621a5f3f27f225..efd5090d76c538c11c3415cae1d4906f354f1e7c 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: xfrin.c,v 1.136 2004/06/27 10:10:55 jakob Exp $ */
+/* $Id: xfrin.c,v 1.137 2004/09/16 04:54:03 marka Exp $ */
 
 #include <config.h>
 
@@ -500,8 +500,8 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, isc_uint32_t ttl,
        case XFRST_IXFR_ADD:
                if (rdata->type == dns_rdatatype_soa) {
                        isc_uint32_t soa_serial = dns_soa_getserial(rdata);
-                       CHECK(ixfr_commit(xfr));
                        if (soa_serial == xfr->end_serial) {
+                               CHECK(ixfr_commit(xfr));
                                xfr->state = XFRST_END;
                                break;
                        } else if (soa_serial != xfr->ixfr.current_serial) {
@@ -511,6 +511,7 @@ xfr_rr(dns_xfrin_ctx_t *xfr, dns_name_t *name, isc_uint32_t ttl,
                                          xfr->ixfr.current_serial, soa_serial);
                                FAIL(DNS_R_FORMERR);
                        } else {
+                               CHECK(ixfr_commit(xfr));
                                xfr->state = XFRST_IXFR_DELSOA;
                                goto redo;
                        }