BIND 10 trac2421, updated. cec4bf4314a6c8deaeadf10c5d95bc812480653a [2421] Handle exceptions when loading a zone

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 7 19:51:39 UTC 2012


The branch, trac2421 has been updated
       via  cec4bf4314a6c8deaeadf10c5d95bc812480653a (commit)
       via  80c2a36861978d77f7a1649ba32a316996376221 (commit)
       via  ecace4bc156ef36fdade632f5656ce8886b2433f (commit)
      from  0ff35f6ed78f78cd23ddb0747d2f97e152e7b774 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cec4bf4314a6c8deaeadf10c5d95bc812480653a
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 8 01:17:42 2012 +0530

    [2421] Handle exceptions when loading a zone

commit 80c2a36861978d77f7a1649ba32a316996376221
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 8 01:12:01 2012 +0530

    [2421] Add a testcase for empty zone too (which should throw EmptyZone)

commit ecace4bc156ef36fdade632f5656ce8886b2433f
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Nov 8 01:11:27 2012 +0530

    [2421] Change test data to throw ZoneDataUpdater::AddError
    
    ... instead of MasterLoadError.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/client_list.cc                     |   27 +++++++++++++++++++-
 src/lib/datasrc/datasrc_messages.mes               |   15 +++++++++++
 .../configurations/auth/auth_badzone.config.orig   |    3 ++-
 tests/lettuce/data/example.com-broken              |    5 +++-
 tests/lettuce/data/example.net-empty               |    1 +
 tests/lettuce/features/auth_badzone.feature        |    1 +
 6 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 tests/lettuce/data/example.net-empty

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index e7fb63b..19ec3c3 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -20,6 +20,7 @@
 #include "memory/zone_table_segment.h"
 #include "memory/zone_writer.h"
 #include "memory/zone_data_loader.h"
+#include "memory/zone_data_updater.h"
 #include "logger.h"
 #include <dns/masterload.h>
 #include <util/memory_segment_local.h>
@@ -37,6 +38,7 @@ using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 using isc::datasrc::memory::InMemoryClient;
 using isc::datasrc::memory::ZoneTableSegment;
+using isc::datasrc::memory::ZoneDataUpdater;
 
 namespace isc {
 namespace datasrc {
@@ -178,6 +180,15 @@ ConfigurableClientList::configure(const ConstElementPtr& config,
                         } catch (const isc::dns::MasterLoadError& mle) {
                             LOG_ERROR(logger, DATASRC_MASTERLOAD_ERROR)
                                 .arg(mle.what());
+                        } catch (const ZoneDataUpdater::NullRRset& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_NULL_RRSET_ERROR)
+                                .arg(e.what());
+                        } catch (const ZoneDataUpdater::AddError& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_ADD_ERROR)
+                                .arg(e.what());
+                        } catch (const isc::datasrc::memory::EmptyZone& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_EMPTY_ZONE_ERROR)
+                                .arg(e.what());
                         }
                     } else {
                         ZoneIteratorPtr iterator;
@@ -192,7 +203,21 @@ ConfigurableClientList::configure(const ConstElementPtr& config,
                             isc_throw(isc::Unexpected, "Got NULL iterator "
                                       "for zone " << origin);
                         }
-                        cache->load(origin, *iterator);
+                        try {
+                            cache->load(origin, *iterator);
+                        } catch (const isc::dns::MasterLoadError& mle) {
+                            LOG_ERROR(logger, DATASRC_MASTERLOAD_ERROR)
+                                .arg(mle.what());
+                        } catch (const ZoneDataUpdater::NullRRset& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_NULL_RRSET_ERROR)
+                                .arg(e.what());
+                        } catch (const ZoneDataUpdater::AddError& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_ADD_ERROR)
+                                .arg(e.what());
+                        } catch (const isc::datasrc::memory::EmptyZone& e) {
+                            LOG_ERROR(logger, DATASRC_LOAD_EMPTY_ZONE_ERROR)
+                                .arg(e.what());
+                        }
                     }
                 }
             }
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index 94b4d42..3788a48 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -310,6 +310,21 @@ An error was found in the zone data for a MasterFiles zone. The zone
 is not loaded. The specific error is shown in the message, and should
 be addressed.
 
+% DATASRC_LOAD_ADD_ERROR %1
+An error was found in the zone data when it was being loaded. The zone
+was not loaded. The specific error is shown in the message, and should
+be addressed.
+
+% DATASRC_LOAD_NULL_RRSET_ERROR %1
+A NULL RRset was passed to be added to a zone. The zone was not
+loaded. The specific error is shown in the message, and should be
+addressed.
+
+% DATASRC_LOAD_EMPTY_ZONE_ERROR %1
+A zone was asked to be loaded without any zone data. The zone was not
+loaded. The specific error is shown in the message, and should be
+addressed.
+
 % DATASRC_MEM_ADD_RRSET adding RRset '%1/%2' into zone '%3'
 Debug information. An RRset is being added to the in-memory data source.
 
diff --git a/tests/lettuce/configurations/auth/auth_badzone.config.orig b/tests/lettuce/configurations/auth/auth_badzone.config.orig
index cf7dd5b..ec55f55 100644
--- a/tests/lettuce/configurations/auth/auth_badzone.config.orig
+++ b/tests/lettuce/configurations/auth/auth_badzone.config.orig
@@ -21,7 +21,8 @@
                     "cache-enable": true,
                     "params": {
                         "example.org": "data/example.org",
-                        "example.com": "data/example.com-broken"
+                        "example.com": "data/example.com-broken",
+                        "example.net": "data/example.net-empty"
                     }
                 }
             ]
diff --git a/tests/lettuce/data/example.com-broken b/tests/lettuce/data/example.com-broken
index cf4b72e..ceef6c3 100644
--- a/tests/lettuce/data/example.com-broken
+++ b/tests/lettuce/data/example.com-broken
@@ -5,4 +5,7 @@ example.com.	3600	IN	MX	10 mail.example.com.
 www.example.com.	3600	IN	A	192.0.2.1
 ns1.example.com.	3600	IN	A	192.0.2.3
 ns2.example.com.	3600	IN	A	192.0.2.4
-shell.example.com.	3600	IN	SSHFP	# this is clearly broken
+
+;; DNAME + NS (non-apex) throws ZoneDataUpdater::AddError
+ns1.example.com.        3600    IN DNAME    foo.example.com.
+ns1.example.com.        3600    IN NS       bar.example.com.
diff --git a/tests/lettuce/data/example.net-empty b/tests/lettuce/data/example.net-empty
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/lettuce/data/example.net-empty
@@ -0,0 +1 @@
+
diff --git a/tests/lettuce/features/auth_badzone.feature b/tests/lettuce/features/auth_badzone.feature
index 24b5ee1..60da1b0 100644
--- a/tests/lettuce/features/auth_badzone.feature
+++ b/tests/lettuce/features/auth_badzone.feature
@@ -35,3 +35,4 @@ Feature: Authoritative DNS server with a bad zone
         """
 
         A query for www.example.com should have rcode REFUSED
+        A query for www.example.net should have rcode REFUSED



More information about the bind10-changes mailing list