BIND 10 trac2428, updated. 33fb59eeb630ce1fb6055a6a8d26c46951fc9c78 [2428] Do pop even after error
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Dec 11 12:45:39 UTC 2012
The branch, trac2428 has been updated
via 33fb59eeb630ce1fb6055a6a8d26c46951fc9c78 (commit)
from de08d209347b6639bc28d1847344c80616a6cb87 (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 33fb59eeb630ce1fb6055a6a8d26c46951fc9c78
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Dec 11 13:45:16 2012 +0100
[2428] Do pop even after error
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/master_loader.cc | 8 +++++---
src/lib/dns/tests/master_loader_unittest.cc | 22 ++++++++++++++++++++++
src/lib/dns/tests/testdata/Makefile.am | 1 +
src/lib/dns/tests/testdata/broken.zone | 3 +++
4 files changed, 31 insertions(+), 3 deletions(-)
create mode 100644 src/lib/dns/tests/testdata/broken.zone
-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index a68c67f..bf28ea2 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -285,9 +285,11 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
callbacks_.warning(lexer_.getSourceName(),
lexer_.getSourceLine(),
"Unexpected end ond of file");
- // TODO: Try pop in case this is not the only
- // source
- return (true);
+ if (!popSource()) {
+ return (true);
+ }
+ // Else: fall through, the popped source is
+ // at the end of line currently
case MasterToken::END_OF_LINE:
end = true;
break;
diff --git a/src/lib/dns/tests/master_loader_unittest.cc b/src/lib/dns/tests/master_loader_unittest.cc
index 17b221c..4860bad 100644
--- a/src/lib/dns/tests/master_loader_unittest.cc
+++ b/src/lib/dns/tests/master_loader_unittest.cc
@@ -158,6 +158,8 @@ TEST_F(MasterLoaderTest, include) {
};
for (const char** include = includes; *include != NULL; ++include) {
SCOPED_TRACE(*include);
+
+ clear();
// Prepare input source that has the include and some more data
// below (to see it returns back to the original source).
const string include_str = "$" + string(*include) + " " +
@@ -176,6 +178,26 @@ TEST_F(MasterLoaderTest, include) {
}
}
+// Test the source is correctly popped even after error
+TEST_F(MasterLoaderTest, popAfterError) {
+ const string include_str = "$include " TEST_DATA_SRCDIR
+ "/broken.zone\nwww 3600 IN AAAA 2001:db8::1\n";
+ stringstream ss(include_str);
+ // We don't test without MANY_ERRORS, we want to see what happens
+ // after the error.
+ setLoader(ss, Name("example.org."), RRClass::IN(),
+ MasterLoader::MANY_ERRORS);
+
+ loader_->load();
+ EXPECT_FALSE(loader_->loadedSucessfully());
+ EXPECT_EQ(1, errors_.size()); // For the broken RR
+ EXPECT_EQ(1, warnings_.size()); // For missing EOLN
+
+ // The included file doesn't contain anything usable, but the
+ // line after the include should be there.
+ checkRR("www.example.org", RRType::AAAA(), "2001:db8::1");
+}
+
// Check it works the same when created based on a stream, not filename
TEST_F(MasterLoaderTest, streamConstructor) {
stringstream zone_stream(prepareZone("", true));
diff --git a/src/lib/dns/tests/testdata/Makefile.am b/src/lib/dns/tests/testdata/Makefile.am
index d312e07..9494117 100644
--- a/src/lib/dns/tests/testdata/Makefile.am
+++ b/src/lib/dns/tests/testdata/Makefile.am
@@ -171,6 +171,7 @@ EXTRA_DIST += tsig_verify4.spec tsig_verify5.spec tsig_verify6.spec
EXTRA_DIST += tsig_verify7.spec tsig_verify8.spec tsig_verify9.spec
EXTRA_DIST += tsig_verify10.spec
EXTRA_DIST += example.org
+EXTRA_DIST += broken.zone
.spec.wire:
$(PYTHON) $(top_builddir)/src/lib/util/python/gen_wiredata.py -o $@ $<
diff --git a/src/lib/dns/tests/testdata/broken.zone b/src/lib/dns/tests/testdata/broken.zone
new file mode 100644
index 0000000..70f4540
--- /dev/null
+++ b/src/lib/dns/tests/testdata/broken.zone
@@ -0,0 +1,3 @@
+; This should fail due to broken TTL
+; The file should _NOT_ end with EOLN
+broken. 3600X IN A 192.0.2.2 More data
\ No newline at end of file
More information about the bind10-changes
mailing list