BIND 10 trac2428, updated. 45e97b85271f437e9f3897fc78e82cbac8f2368a [2428] Test and fix error handling in $INCLUDE
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Dec 11 14:41:01 UTC 2012
The branch, trac2428 has been updated
via 45e97b85271f437e9f3897fc78e82cbac8f2368a (commit)
from 33fb59eeb630ce1fb6055a6a8d26c46951fc9c78 (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 45e97b85271f437e9f3897fc78e82cbac8f2368a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Dec 11 15:20:11 2012 +0100
[2428] Test and fix error handling in $INCLUDE
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/master_loader.cc | 6 ++----
src/lib/dns/tests/master_loader_unittest.cc | 4 ++++
2 files changed, 6 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index bf28ea2..40710c2 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -81,9 +81,7 @@ public:
std::string error;
if (!lexer_.pushSource(filename.c_str(), &error)) {
if (initialized_) {
- // $INCLUDE file
- reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
- error);
+ isc_throw(InternalException, error.c_str());
} else {
// Top-level file
reportError("", 0, error);
@@ -116,7 +114,7 @@ public:
void doInclude() {
// First, get the filename to include
const MasterToken::StringRegion
- filename(lexer_.getNextToken(MasterLexer::QSTRING).
+ filename(lexer_.getNextToken(MasterToken::QSTRING).
getStringRegion());
// TODO: Handle the case where there's Name after the
diff --git a/src/lib/dns/tests/master_loader_unittest.cc b/src/lib/dns/tests/master_loader_unittest.cc
index 4860bad..e79e2f8 100644
--- a/src/lib/dns/tests/master_loader_unittest.cc
+++ b/src/lib/dns/tests/master_loader_unittest.cc
@@ -282,6 +282,10 @@ struct ErrorCase {
// Check the unknown directive. The rest looks like ordinary RR,
// so we see the $ is actually special.
{ "$UNKNOWN 3600 IN A 192.0.2.1", "Unknown $ directive" },
+ { "$INCLUDE", "Missing include path" },
+ { "$INCLUDE /file/not/found", "Include file not found" },
+ { "$INCLUDE /file/not/found and here goes bunch of garbage",
+ "Include file not found and garbage at the end of line" },
{ NULL, NULL }
};
More information about the bind10-changes
mailing list