From: JINMEI Tatuya Date: Mon, 12 Nov 2012 22:18:24 +0000 (-0800) Subject: [2420] added tests with RRSIG-only RRsets. X-Git-Tag: bind10-1.0.0-beta-release~52^2~1^2~2^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56b5c356dd0e122da66a0ee94c33368ff1f86386;p=thirdparty%2Fkea.git [2420] added tests with RRSIG-only RRsets. Due to the extension to RdataSet::find(), the tested code doesn't have to be modified. --- diff --git a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc index 4cd08c0a54..3df1179885 100644 --- a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc +++ b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc @@ -1358,6 +1358,74 @@ TEST_F(InMemoryZoneFinderTest, findNSEC3ForBadZone) { DataSourceError); } +TEST_F(InMemoryZoneFinderTest, findOrphanRRSIG) { + // Make the zone "NSEC signed" + addToZoneData(rr_nsec_); + const ZoneFinder::FindResultFlags expected_flags = + ZoneFinder::RESULT_NSEC_SIGNED; + + // Add A for ns.example.org, and RRSIG-only covering TXT for the same name. + // query for the TXT should result in NXRRSET. + addToZoneData(rr_ns_a_); + updater_.add(ConstRRsetPtr(), + textToRRset( + "ns.example.org. 300 IN RRSIG TXT 5 3 300 20120814220826 " + "20120715220826 1234 example.com. FAKE")); + findTest(Name("ns.example.org"), RRType::TXT(), + ZoneFinder::NXRRSET, true, ConstRRsetPtr(), expected_flags); + + // Add RRSIG-only covering NSEC. This shouldn't be returned when NSEC is + // requested, whether it's for NXRRSET or NXDOMAIN + updater_.add(ConstRRsetPtr(), + textToRRset( + "ns.example.org. 300 IN RRSIG NSEC 5 3 300 " + "20120814220826 20120715220826 1234 example.com. FAKE")); + // The added RRSIG for NSEC could be used for NXRRSET but shouldn't + findTest(Name("ns.example.org"), RRType::TXT(), + ZoneFinder::NXRRSET, true, ConstRRsetPtr(), + expected_flags, NULL, ZoneFinder::FIND_DNSSEC); + // The added RRSIG for NSEC could be used for NXDOMAIN but shouldn't + findTest(Name("nz.example.org"), RRType::A(), + ZoneFinder::NXDOMAIN, true, rr_nsec_, + expected_flags, NULL, ZoneFinder::FIND_DNSSEC); + + // RRSIG-only CNAME shouldn't be accidentally confused with real CNAME. + updater_.add(ConstRRsetPtr(), + textToRRset( + "nocname.example.org. 300 IN RRSIG CNAME 5 3 300 " + "20120814220826 20120715220826 1234 example.com. FAKE")); + findTest(Name("nocname.example.org"), RRType::A(), + ZoneFinder::NXRRSET, true, ConstRRsetPtr(), expected_flags); + + // RRSIG-only for NS wouldn't invoke delegation anyway, but we check this + // case explicitly. + updater_.add(ConstRRsetPtr(), + textToRRset( + "nodelegation.example.org. 300 IN RRSIG NS 5 3 300 " + "20120814220826 20120715220826 1234 example.com. FAKE")); + findTest(Name("nodelegation.example.org"), RRType::A(), + ZoneFinder::NXRRSET, true, ConstRRsetPtr(), expected_flags); + findTest(Name("www.nodelegation.example.org"), RRType::A(), + ZoneFinder::NXDOMAIN, true, ConstRRsetPtr(), expected_flags); + + // Same for RRSIG-only for DNAME + updater_.add(ConstRRsetPtr(), + textToRRset( + "nodname.example.org. 300 IN RRSIG DNAME 5 3 300 " + "20120814220826 20120715220826 1234 example.com. FAKE")); + findTest(Name("www.nodname.example.org"), RRType::A(), + ZoneFinder::NXDOMAIN, true, ConstRRsetPtr(), expected_flags); + // If we have a delegation NS at this node, it will be a bit trickier, + // because the zonecut processing actually takes place at the node. + // But the RRSIG-only for DNAME shouldn't confuse the process and the NS + // should win. + ConstRRsetPtr ns_rrset = + textToRRset("nodname.example.org. 300 IN NS ns.nodname.example.org."); + addToZoneData(ns_rrset); + findTest(Name("www.nodname.example.org"), RRType::A(), + ZoneFinder::DELEGATION, true, ns_rrset); +} + /// \brief NSEC3 specific tests fixture for the InMemoryZoneFinder class class InMemoryZoneFinderNSEC3Test : public InMemoryZoneFinderTest { public: