Parcourir la source

[1310] Add WILDCARD_NXRRSET case in Query.process()

xiejiagui il y a 13 ans
Parent
commit
32b1e0701a
2 fichiers modifiés avec 24 ajouts et 0 suppressions
  1. 9 0
      src/bin/auth/query.cc
  2. 15 0
      src/bin/auth/tests/query_unittest.cc

+ 9 - 0
src/bin/auth/query.cc

@@ -355,6 +355,15 @@ Query::process() {
                                        dnssec_);
                 }
                 break;
+			case ZoneFinder::WILDCARD_NXRRSET:
+				addSOA(*result.zone_finder);
+				if(dnssec_ && db_result.rrset) {
+				   response_.addRRset(Message::SECTION_AUTHORITY,
+				   					  boost::const_pointer_cast<RRset>(
+									       db_result.rrset),
+									  dnssec_);
+				}
+				break;
             default:
                 // This is basically a bug of the data source implementation,
                 // but could also happen in the middle of development where

+ 15 - 0
src/bin/auth/tests/query_unittest.cc

@@ -924,6 +924,21 @@ TEST_F(QueryTest, badWildcardProof3) {
                  Query::BadNSEC);
 }
 
+TEST_F(QueryTest, wildcardNxrrsetWithNSEC1) {
+    // NXRRSET with DNSSEC proof.  We should have SOA, NSEC that proves the
+    // NXRRSET and their RRSIGs.
+    Query(memory_client, Name("www.wild.example.com"), RRType::TXT(), response,
+          true).process();
+
+    responseCheck(response, Rcode::NOERROR(), AA_FLAG, 0, 4, 0, NULL,
+                  (string(soa_txt) + string("example.com. 3600 IN RRSIG ") +
+                   getCommonRRSIGText("SOA") + "\n" +
+                   string(nsec_wild_txt) + 
+                   string("*.wild.example.com. 3600 IN RRSIG ") +
+                   getCommonRRSIGText("NSEC")+"\n").c_str(),
+                  NULL, mock_finder->getOrigin());
+}
+
 /*
  * This tests that when there's no SOA and we need a negative answer. It should
  * throw in that case.