BIND 10 trac553, updated. 76e1d3b208772073e664437788865a5e3d067a68 [trac553] Tests for cancellation of wildcard
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 11 13:00:59 UTC 2011
The branch, trac553 has been updated
via 76e1d3b208772073e664437788865a5e3d067a68 (commit)
via d9fda268d2fcecbb69f06f3480bc9dcd058c582e (commit)
via 17f874bb877356f0eb3c777282e1a21172a241c9 (commit)
via f364f8feb190aa09fd0a65b35bdf05a3c7fe0932 (commit)
from deedd6f7ff3339f822f9ed8de77a5a7164bda9a1 (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 76e1d3b208772073e664437788865a5e3d067a68
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 13:58:58 2011 +0100
[trac553] Tests for cancellation of wildcard
commit d9fda268d2fcecbb69f06f3480bc9dcd058c582e
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 13:56:18 2011 +0100
[trac553] Fix the wildcard check routine
It crashed when the checked code didn't provide any answer.
commit 17f874bb877356f0eb3c777282e1a21172a241c9
Merge: deedd6f7ff3339f822f9ed8de77a5a7164bda9a1 f364f8feb190aa09fd0a65b35bdf05a3c7fe0932
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 11 12:37:32 2011 +0100
Merge branch 'master' into work/wildcard/cancel
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/tests/memory_datasrc_unittest.cc | 63 ++++++++++++++++++++++
src/lib/log/tests/Makefile.am | 2 +
2 files changed, 65 insertions(+), 0 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index dd41bd7..b461dce 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -204,6 +204,7 @@ public:
{"*.dnamewild.example.org. 300 IN DNAME dnamewild.example.",
&rr_dnamewild_},
{"*.child.example.org. 300 IN A 192.0.2.1", &rr_child_wild_},
+ {"bar.foo.wild.example.org. 300 IN A 192.0.2.2", &rr_not_wild_},
{NULL, NULL}
};
@@ -254,6 +255,7 @@ public:
RRsetPtr rr_nested_emptywild_;
RRsetPtr rr_nswild_, rr_dnamewild_;
RRsetPtr rr_child_wild_;
+ RRsetPtr rr_not_wild_;
/**
* \brief Test one find query to the zone.
@@ -296,6 +298,11 @@ public:
if (check_answer) {
EXPECT_EQ(answer, find_result.rrset);
} else if (check_wild_answer) {
+ ASSERT_NE(ConstRRsetPtr(), answer) <<
+ "Wrong test, don't check for wild names if you expect"
+ "empty answer";
+ ASSERT_NE(ConstRRsetPtr(), find_result.rrset) <<
+ "No answer found";
RdataIteratorPtr expectedIt(answer->getRdataIterator());
RdataIteratorPtr gotIt(answer->getRdataIterator());
while (!expectedIt->isLast() && !gotIt->isLast()) {
@@ -844,6 +851,62 @@ TEST_F(MemoryZoneTest, nestedEmptyWildcard) {
}
}
+/*
+ * This tests that if there's a name between the wildcard domain and the
+ * searched one, it will not trigger wildcard, for example, if we have
+ * *.wild.example.org and bar.foo.example.org, then we know foo.example.org
+ * exists and is not wildcard. Therefore, search for aaa.foo.example.org should
+ * return NXDOMAIN.
+ *
+ * Tests few cases "around" the canceled wildcard match, to see something that
+ * shouldn't be canceled isn't.
+ */
+TEST_F(MemoryZoneTest, cancelWildcard) {
+ EXPECT_EQ(SUCCESS, zone_.add(rr_wild_));
+ EXPECT_EQ(SUCCESS, zone_.add(rr_not_wild_));
+
+ // These should be canceled
+ {
+ SCOPED_TRACE("Canceled under foo.example.org");
+ findTest(Name("aaa.foo.wild.example.org"), RRType::A(),
+ Zone::NXDOMAIN);
+ findTest(Name("zzz.foo.wild.example.org"), RRType::A(),
+ Zone::NXDOMAIN);
+ }
+
+ // This is existing, non-wildcard domain, shouldn't wildcard at all
+ {
+ SCOPED_TRACE("Existing domain under foo.example.org");
+ findTest(Name("bar.foo.wild.example.org"), RRType::A(), Zone::SUCCESS,
+ true, rr_not_wild_);
+ }
+
+ // These should be caught by the wildcard
+ {
+ SCOPED_TRACE("Neighbor wildcards to foo.example.org");
+
+ const char *names[] = {
+ "aaa.bbb.wild.example.org",
+ "aaa.zzz.wild.example.org",
+ "zzz.wild.example.org",
+ NULL
+ };
+
+ for (const char **name(names); *name; ++ name) {
+ SCOPED_TRACE(string("Node ") + *name);
+
+ findTest(Name(*name), RRType::A(), Zone::SUCCESS, false, rr_wild_,
+ NULL, NULL, Zone::FIND_DEFAULT, true);
+ }
+ }
+
+ // This shouldn't be wildcarded, it's an existing domain
+ {
+ SCOPED_TRACE("The foo.wild.example.org itself");
+ findTest(Name("foo.wild.example.org"), RRType::A(), Zone::NXRRSET);
+ }
+}
+
TEST_F(MemoryZoneTest, loadBadWildcard) {
// We reject loading the zone if it contains a wildcard name for
// NS or DNAME.
diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am
index 01973c9..e3a023a 100644
--- a/src/lib/log/tests/Makefile.am
+++ b/src/lib/log/tests/Makefile.am
@@ -11,6 +11,8 @@ endif
CLEANFILES = *.gcno *.gcda
+EXTRA_DIST = localdef.mes
+
TESTS =
if HAVE_GTEST
TESTS += run_unittests
More information about the bind10-changes
mailing list