From cbf6d3808e596d35fc8c83a5f35e13dfb4c2449b Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Thu, 6 Dec 2012 12:24:38 +0530 Subject: [PATCH] [2504] Add testcase that reproduces the problem This test currently fails with an assertion. --- .../tests/memory/testdata/2504-test.zone | 10 +++++++++ .../datasrc/tests/memory/testdata/Makefile.am | 2 ++ .../tests/memory/zone_finder_unittest.cc | 22 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/lib/datasrc/tests/memory/testdata/2504-test.zone diff --git a/src/lib/datasrc/tests/memory/testdata/2504-test.zone b/src/lib/datasrc/tests/memory/testdata/2504-test.zone new file mode 100644 index 0000000000..e4cc661496 --- /dev/null +++ b/src/lib/datasrc/tests/memory/testdata/2504-test.zone @@ -0,0 +1,10 @@ +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN SOA ns2.tjeb.nl. tjeb.tjeb.nl. 2012120601 28800 7200 604800 18000 +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN A 178.18.82.80 +ok.ok.ok.ok.dnssec.tjeb.nl. 3600 IN DNSKEY 256 3 5 AwEAAag7J/qxkLI1keftNSKe0fqa2mU1GaeZGQoOSgVZvJAMh6LK9F1NMmWP2MeaeJvfTkmZs2UggGnFjkb7QQygrZnfxxCOVu5fG8x3Na5Z7jAdMgVfuJ1FTmsi2Bj4W/+b3fuvv/eVGqlEsFdth+sGA+BKH9mdBwmt+aXJf9gohXpx ;{id = 34791 (zsk), size = 1024b} +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN NS ns2.tjeb.nl. +ok.ok.ok.ok.dnssec.tjeb.nl. 18000 IN NSEC ok.ok.ok.ok.dnssec.tjeb.nl. A NS SOA RRSIG NSEC DNSKEY +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN RRSIG SOA 5 7 600 20200101000000 20120627091929 34791 ok.ok.ok.ok.dnssec.tjeb.nl. Z+LjS0NtrUkOje1PZht8a3TylxEKabDltJSye3NO/n6tE9268S5EqQ6r0nZ0hO78c9r4lYxMlvnfyTAj/5rR/zdApCS0EnpQenVyvwagIAVdIcNqpZxr7i/tFmOvxyQK3NRhWqH83WhNwqRE1E4thUfNovtyscSLR+TOhuEBKlg= +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN RRSIG A 5 7 600 20200101000000 20120627091929 34791 ok.ok.ok.ok.dnssec.tjeb.nl. oYbwX46pDyaTNIeZByyLnUVc4RNgFmGeUuJ4sn0aIqrX6UqfNJwJpZiCspcyBRBNIZye6ypVNFD9RUHesrELHjFOAustg86GFws1jeEoDbi4W6wmeNQqiUfnyaqME3rHD9WE7I99Nqiyp8ZEBseem/SIOCsEXxPLrhoAL+Fa1+s= +ok.ok.ok.ok.dnssec.tjeb.nl. 600 IN RRSIG NS 5 7 600 20200101000000 20120627091929 34791 ok.ok.ok.ok.dnssec.tjeb.nl. KBRov1y79yN75feRo2Bv5B+UpmDAyEr/kTgWgL9dYtkuQXvT7Y1Lg5jhcFmyrAkpYud70i5Un2DEUtmnI2oUR7XUh1RDnMQZRgKkaDXNXj5D379hLxpD2jtN+A311ShReaM4laj44UiDzu0pjGtrDT7BY1c4Qb5XI0RLyI0VKSs= +ok.ok.ok.ok.dnssec.tjeb.nl. 3600 IN RRSIG DNSKEY 5 7 3600 20200101000000 20120627091929 34791 ok.ok.ok.ok.dnssec.tjeb.nl. NriwgSl8QskWiQMlIPzn3WvWQwfQDy8pnJ4U2qlOjWFeJ4wH7DS/P5BDh9+JXjKamh5Bdy2umSf1uY1BeodSP+Ga4yKxNb1sigGbToYGDsbLP1NfPPq6uijl5nRhqBQAAzjCmyU9sm6GUr/CyOpSTTxtFjosXZQ1t1GFya6Tgho= +ok.ok.ok.ok.dnssec.tjeb.nl. 18000 IN RRSIG NSEC 5 7 18000 20200101000000 20120627091929 34791 ok.ok.ok.ok.dnssec.tjeb.nl. ijT2etFxkmNLMdbugWsIrnPuJqxdPPO/ilWUb0ZapcuwtqV4mTZCalUlb3KSpcczHPfyClF7WvMEKdluLrX55TPKEBxx1AIdOduhwSTxCxgZpOp4LFIR3rg5hTH9bupEUvbFPWU8RX5oX0GLE0V/EpfNYpHOtvvG3rnegwynML4= diff --git a/src/lib/datasrc/tests/memory/testdata/Makefile.am b/src/lib/datasrc/tests/memory/testdata/Makefile.am index dddbf0a3dd..d99872cbd1 100644 --- a/src/lib/datasrc/tests/memory/testdata/Makefile.am +++ b/src/lib/datasrc/tests/memory/testdata/Makefile.am @@ -29,3 +29,5 @@ EXTRA_DIST += example.org-rrsigs.zone EXTRA_DIST += example.org-wildcard-dname.zone EXTRA_DIST += example.org-wildcard-ns.zone EXTRA_DIST += example.org-wildcard-nsec3.zone + +EXTRA_DIST += 2504-test.zone diff --git a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc index f1121194ea..c7ec501d1a 100644 --- a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc +++ b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. #include "memory_segment_test.h" +#include "zone_table_segment_test.h" // NOTE: this faked_nsec3 inclusion (and all related code below) // was ported during #2109 for the convenience of implementing #2218 @@ -25,7 +26,10 @@ #include #include #include +#include +#include #include +#include #include #include @@ -1426,6 +1430,24 @@ TEST_F(InMemoryZoneFinderTest, findOrphanRRSIG) { ZoneFinder::DELEGATION, true, ns_rrset); } +// \brief testcase for #2504 (Problem in inmem NSEC denial of existence +// handling) +TEST_F(InMemoryZoneFinderTest, NSECNonExistentTest) { + shared_ptr ztable_segment( + new ZoneTableSegmentTest(class_, mem_sgmt_)); + InMemoryClient client(ztable_segment, class_); + Name name("ok.ok.ok.ok.dnssec.tjeb.nl."); + + client.load(name, TEST_DATA_DIR "/2504-test.zone"); + DataSourceClient::FindResult result(client.findZone(name)); + + // Check for a non-existing name + Name search_name("nonexist.ok.ok.ok.ok.dnssec.tjeb.nl."); + ZoneFinderContextPtr find_result( + result.zone_finder->find(search_name, + RRType::A(), ZoneFinder::FIND_DNSSEC)); +} + /// \brief NSEC3 specific tests fixture for the InMemoryZoneFinder class class InMemoryZoneFinderNSEC3Test : public InMemoryZoneFinderTest { public: