diff options
author | JINMEI Tatuya <jinmei@isc.org> | 2012-11-30 07:30:56 +0100 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2012-12-01 04:41:13 +0100 |
commit | b9f1eefe7e7040db4841e75a38b6a9cd1511eb59 (patch) | |
tree | bc1220e669f2bdaa952e7d541f4072ca27f1e8be /src/lib/dns/rdata.cc | |
parent | [2382] ungetToken EOL/EOF in the backend factories. (diff) | |
download | kea-b9f1eefe7e7040db4841e75a38b6a9cd1511eb59.tar.xz kea-b9f1eefe7e7040db4841e75a38b6a9cd1511eb59.zip |
[2382] Consume to end of line / file in createRdata().
Diffstat (limited to 'src/lib/dns/rdata.cc')
-rw-r--r-- | src/lib/dns/rdata.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc index ddb4b77258..cc7c582743 100644 --- a/src/lib/dns/rdata.cc +++ b/src/lib/dns/rdata.cc @@ -30,6 +30,7 @@ #include <util/buffer.h> #include <dns/name.h> #include <dns/messagerenderer.h> +#include <dns/master_lexer.h> #include <dns/rdata.h> #include <dns/rrparamregistry.h> #include <dns/rrtype.h> @@ -87,17 +88,17 @@ createRdata(const RRType& rrtype, const RRClass& rrclass, MasterLoader::Options options, MasterLoaderCallbacks& callbacks) { - RdataPtr ret; - - try { - ret = RRParamRegistry::getRegistry().createRdata(rrtype, rrclass, - lexer, origin, - options, callbacks); - } catch (...) { - // ret is NULL here. - } + const RdataPtr rdata = RRParamRegistry::getRegistry().createRdata( + rrtype, rrclass, lexer, origin, options, callbacks); + + // Consume to end of line / file. + // If not at end of line initially set error code. + // Call callback via fromtext_error once if there was an error. + const MasterToken& token = lexer.getNextToken(); + assert(token.getType() == MasterToken::END_OF_LINE || + token.getType() == MasterToken::END_OF_FILE); - return (ret); + return (rdata); } int |