BIND 10 trac505, updated. 49e2c1ae796e46fca4f5c395a92387638bb828c6 [trac505] Another test
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 11 11:20:47 UTC 2011
The branch, trac505 has been updated
via 49e2c1ae796e46fca4f5c395a92387638bb828c6 (commit)
via 53f4afe16013ef6f97556d3b49d1bc56443dc08c (commit)
via 180015eada7cdc67f8756a7425f9023d884b19df (commit)
from f9a11dcba2da26e3a27a4be00461aea07aa60d85 (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 49e2c1ae796e46fca4f5c395a92387638bb828c6
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 12:16:18 2011 +0100
[trac505] Another test
Checks that we don't reject synthesized name of the maximum length by
mistake.
commit 53f4afe16013ef6f97556d3b49d1bc56443dc08c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 10:59:13 2011 +0100
[trac505] Update comment
commit 180015eada7cdc67f8756a7425f9023d884b19df
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 10:54:11 2011 +0100
[trac505] Simplify length check condition
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/query.cc | 6 +---
src/bin/auth/tests/query_unittest.cc | 44 ++++++++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc
index 461a329..e936c97 100644
--- a/src/bin/auth/query.cc
+++ b/src/bin/auth/query.cc
@@ -169,10 +169,8 @@ Query::process() const {
db_result.rrset->getName().getLabelCount()));
// If we put it together, will it be too long?
// (The prefix contains trailing ., which will be removed
- if (prefix.getLength() - Name(".").getLength() +
- dname.getDname().getLength() > Name::MAX_WIRE ||
- prefix.getLabelCount() - Name(".").getLabelCount() +
- dname.getDname().getLabelCount() > Name::MAX_LABELS) {
+ if (prefix.getLength() - Name::ROOT_NAME().getLength() +
+ dname.getDname().getLength() > Name::MAX_WIRE) {
/*
* In case the synthesized name is too long, section 4.1
* of RFC 2672 mandates we return YXDOMAIN.
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index e5a885a..07515b1 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -571,8 +571,8 @@ TEST_F(QueryTest, DNAME) {
* Ask an ANY query below a DNAME. Should return the DNAME and synthetized
* CNAME.
*
- * This is added because the original implementation had a bug and didn't
- * include the CNAME at all.
+ * ANY is handled specially sometimes. We check it is not the case with
+ * DNAME.
*/
TEST_F(QueryTest, DNAME_ANY) {
Query(memory_datasrc, Name("www.dname.example.com"), RRType::ANY(),
@@ -635,4 +635,44 @@ TEST_F(QueryTest, LongDNAME) {
dname_txt, NULL, NULL);
}
+/*
+ * Constructing the CNAME will result in a name of maximal length.
+ * This tests that we don't reject valid one by some kind of off by
+ * one mistake.
+ */
+TEST_F(QueryTest, MaxLenDNAME) {
+ Name longname(
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa."
+ "dname.example.com.");
+ EXPECT_NO_THROW(Query(memory_datasrc, longname, RRType::A(),
+ response).process());
+
+ // Check the answer is OK
+ responseCheck(response, Rcode::NOERROR(), AA_FLAG, 2, 0, 0,
+ NULL, NULL, NULL);
+
+ // Check that the CNAME has the maximal length.
+ bool ok(false);
+ for (RRsetIterator i(response.beginSection(Message::SECTION_ANSWER));
+ i != response.endSection(Message::SECTION_ANSWER); ++ i) {
+ if ((*i)->getType() == RRType::CNAME()) {
+ ok = true;
+ RdataIteratorPtr ci((*i)->getRdataIterator());
+ ASSERT_FALSE(ci->isLast()) << "The CNAME is empty";
+ /*
+ * Does anybody have a clue why, if the Name::MAX_WIRE is put
+ * directly inside ASSERT_EQ, it fails to link and complains
+ * it is unresolved external?
+ */
+ size_t max_len(Name::MAX_WIRE);
+ ASSERT_EQ(max_len, dynamic_cast<const rdata::generic::CNAME&>(
+ ci->getCurrent()).getCname().getLength());
+ }
+ }
+ EXPECT_TRUE(ok) << "The synthetized CNAME not found";
+}
+
}
More information about the bind10-changes
mailing list