Browse Source

[1177] NSEC in case of normal NXRRSET

Michal 'vorner' Vaner 13 years ago
parent
commit
2e1dceedf6
2 changed files with 13 additions and 3 deletions
  1. 11 1
      src/lib/datasrc/database.cc
  2. 2 2
      src/lib/datasrc/tests/database_unittest.cc

+ 11 - 1
src/lib/datasrc/database.cc

@@ -317,6 +317,7 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
     // NXDOMAIN and NXRRSET
     // NXDOMAIN and NXRRSET
     bool records_found = false;
     bool records_found = false;
     bool glue_ok(options & FIND_GLUE_OK);
     bool glue_ok(options & FIND_GLUE_OK);
+    bool dnssec_data(options & FIND_DNSSEC);
     isc::dns::RRsetPtr result_rrset;
     isc::dns::RRsetPtr result_rrset;
     ZoneFinder::Result result_status = SUCCESS;
     ZoneFinder::Result result_status = SUCCESS;
     FoundRRsets found;
     FoundRRsets found;
@@ -390,7 +391,7 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
         // And we don't consider the NS in origin
         // And we don't consider the NS in origin
 
 
         static WantedTypes final_types(empty_types + RRType::CNAME() +
         static WantedTypes final_types(empty_types + RRType::CNAME() +
-                                       RRType::NS());
+                                       RRType::NS() + RRType::NSEC());
         found = getRRsets(name, final_types + type, name != origin);
         found = getRRsets(name, final_types + type, name != origin);
         records_found = found.first;
         records_found = found.first;
 
 
@@ -505,6 +506,15 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
                     }
                     }
                 }
                 }
             }
             }
+        } else if (dnssec_data) {
+            // This is the "usual" NXRRSET case
+            // So in case they want DNSSEC, provide the NSEC
+            // (which should be available already here)
+            result_status = NXRRSET;
+            const FoundIterator nci(found.second.find(RRType::NSEC()));
+            if (nci != found.second.end()) {
+                result_rrset = nci->second;
+            }
         }
         }
     }
     }
 
 

+ 2 - 2
src/lib/datasrc/tests/database_unittest.cc

@@ -1553,7 +1553,7 @@ TYPED_TEST(DatabaseClientTest, NXRRSET_NSEC) {
                                          "20000201000000 12345 example.org. "
                                          "20000201000000 12345 example.org. "
                                          "FAKEFAKEFAKE");
                                          "FAKEFAKEFAKE");
     doFindTest(*finder, isc::dns::Name("www.example.org."),
     doFindTest(*finder, isc::dns::Name("www.example.org."),
-               isc::dns::RRType::TXT(), isc::dns::RRType::TXT(),
+               isc::dns::RRType::TXT(), isc::dns::RRType::NSEC(),
                isc::dns::RRTTL(3600),
                isc::dns::RRTTL(3600),
                ZoneFinder::NXRRSET,
                ZoneFinder::NXRRSET,
                this->expected_rdatas_, this->expected_sig_rdatas_,
                this->expected_rdatas_, this->expected_sig_rdatas_,
@@ -1575,7 +1575,7 @@ TYPED_TEST(DatabaseClientTest, wildcardNXRRSET_NSEC) {
                                          "FAKEFAKEFAKE");
                                          "FAKEFAKEFAKE");
     // Note that the NSEC name should NOT be synthesized.
     // Note that the NSEC name should NOT be synthesized.
     doFindTest(*finder, isc::dns::Name("a.wild.example.org."),
     doFindTest(*finder, isc::dns::Name("a.wild.example.org."),
-               isc::dns::RRType::TXT(), isc::dns::RRType::TXT(),
+               isc::dns::RRType::TXT(), isc::dns::RRType::NSEC(),
                isc::dns::RRTTL(3600),
                isc::dns::RRTTL(3600),
                ZoneFinder::NXRRSET,
                ZoneFinder::NXRRSET,
                this->expected_rdatas_, this->expected_sig_rdatas_,
                this->expected_rdatas_, this->expected_sig_rdatas_,