rdata_str, rdata_dnskey2, true, true);
}
+ void checkFromText_BadString(const string& rdata_str) {
+ checkFromText
+ <generic::DNSKEY, InvalidRdataText, isc::Exception>(
+ rdata_str, rdata_dnskey2, true, false);
+ }
+
const string dnskey_txt;
const string dnskey_txt2;
const generic::DNSKEY rdata_dnskey;
checkFromText_LexerError("foo 3 5 YmluZDEwLmlzYy5vcmc=");
checkFromText_LexerError("257 foo 5 YmluZDEwLmlzYy5vcmc=");
checkFromText_LexerError("257 3 foo YmluZDEwLmlzYy5vcmc=");
+
+ // Trailing garbage. This should cause only the string constructor
+ // to fail, but the lexer constructor must be able to continue
+ // parsing from it.
+ checkFromText_BadString("257 3 5 YmluZDEwLmlzYy5vcmc= ; comment\n"
+ "257 3 4 YmluZDEwLmlzYy5vcmc=");
}
TEST_F(Rdata_DNSKEY_Test, assign) {
rdata_str, rdata_nsec3, true, true);
}
+ void checkFromText_BadString(const string& rdata_str) {
+ checkFromText
+ <generic::NSEC3, InvalidRdataText, isc::Exception>(
+ rdata_str, rdata_nsec3, true, false);
+ }
+
const string nsec3_txt;
const string nsec3_nosalt_txt;
const string nsec3_notype_txt;
"H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA");
checkFromText_LexerError("1 1 foo D399EAAB "
"H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA");
+
+ // Trailing garbage. This should cause only the string constructor
+ // to fail, but the lexer constructor must be able to continue
+ // parsing from it.
+ checkFromText_BadString(
+ "1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA ;comment\n"
+ "1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA");
}
TEST_F(Rdata_NSEC3_Test, createFromWire) {
rdata_str, rdata_nsec3param, true, true);
}
+ void checkFromText_BadString(const string& rdata_str,
+ const generic::NSEC3PARAM& rdata)
+ {
+ checkFromText
+ <generic::NSEC3PARAM, InvalidRdataText, isc::Exception>(
+ rdata_str, rdata, true, false);
+ }
+
const string nsec3param_txt;
const string nsec3param_nosalt_txt;
const generic::NSEC3PARAM rdata_nsec3param;
// constructor, as the lexer constructor stops reading at the end of
// its RDATA.
const generic::NSEC3PARAM rdata_nsec3param2("1 1 1 D399");
- checkFromText<generic::NSEC3PARAM, InvalidRdataText, isc::Exception>(
- "1 1 1 D399 EAAB", rdata_nsec3param2, true, false);
+ checkFromText_BadString("1 1 1 D399 EAAB", rdata_nsec3param2);
// Hash algorithm out of range.
checkFromText_InvalidText("256 1 1 D399EAAB");
checkFromText_LexerError("foo 1 256 D399EAAB");
checkFromText_LexerError("1 foo 256 D399EAAB");
checkFromText_LexerError("1 1 foo D399EAAB");
+
+ // Trailing garbage. This should cause only the string constructor
+ // to fail, but the lexer constructor must be able to continue
+ // parsing from it.
+ checkFromText_BadString("1 1 1 D399EAAB ; comment\n"
+ "1 1 1 D399EAAB", rdata_nsec3param);
}
TEST_F(Rdata_NSEC3PARAM_Test, toText) {