]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1580] a suggested cleanup: rename addNSCOMAINProof to addNSCOMAINProofByNSEC
authorJINMEI Tatuya <jinmei@isc.org>
Thu, 16 Feb 2012 08:19:11 +0000 (00:19 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Thu, 16 Feb 2012 08:19:11 +0000 (00:19 -0800)
so it's clearer that it's NSEC specific (now that we have an NSEC3 version
of addNXDOMAINProof).  For consistency rename the NSEC3 version to
addNSCOMAINProofByNSEC3.  also a bit reorganized the code calling these methods
(mostly a matter of taste though), and adjusted tests to make them pass.

src/bin/auth/query.cc
src/bin/auth/query.h
src/bin/auth/tests/query_unittest.cc

index 4ebf5a5d2a7f4e9832209eb326956b3a640e49ba..b0c3b769103c25098cb68134cf6f4710cdf8ed1b 100644 (file)
@@ -117,7 +117,7 @@ Query::addSOA(ZoneFinder& finder) {
 // either an SERVFAIL response or just ignoring the query.  We at least prevent
 // a complete crash due to such broken behavior.
 void
-Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
+Query::addNXDOMAINProofByNSEC(ZoneFinder& finder, ConstRRsetPtr nsec) {
     if (nsec->getRdataCount() == 0) {
         isc_throw(BadNSEC, "NSEC for NXDOMAIN is empty");
     }
@@ -168,7 +168,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
 }
 
 void
-Query::addNSEC3NXDOMAINProof(ZoneFinder& finder) {
+Query::addNXDOMAINProofByNSEC3(ZoneFinder& finder) {
     // Firstly get the NSEC3 proves for Closest Encloser Proof
     // See section 7.2.1 of RFC 5155.
     // Since this is a Name Error case both closest and next proofs should
@@ -542,12 +542,12 @@ Query::process() {
         case ZoneFinder::NXDOMAIN:
             response_.setRcode(Rcode::NXDOMAIN());
             addSOA(*result.zone_finder);
-            if (dnssec_ && db_result.isNSEC3Signed()) {
-                addNSEC3NXDOMAINProof(zfinder);
-                break;
-            }
-            if (dnssec_ && db_result.rrset) {
-                addNXDOMAINProof(zfinder, db_result.rrset);
+            if (dnssec_) {
+                if (db_result.isNSECSigned() && db_result.rrset) {
+                    addNXDOMAINProofByNSEC(zfinder, db_result.rrset);
+                } else if (db_result.isNSEC3Signed()) {
+                    addNXDOMAINProofByNSEC3(zfinder);
+                }
             }
             break;
         case ZoneFinder::NXRRSET:
index 46216e384a1b5c5e49e33b4e46747635545698a6..210ff69449771df7bb738a352c1975447569f8c7 100644 (file)
@@ -101,13 +101,13 @@ private:
     /// Add NSEC RRs that prove an NXDOMAIN result.
     ///
     /// This corresponds to Section 3.1.3.2 of RFC 4035.
-    void addNXDOMAINProof(isc::datasrc::ZoneFinder& finder,
-                          isc::dns::ConstRRsetPtr nsec);
+    void addNXDOMAINProofByNSEC(isc::datasrc::ZoneFinder& finder,
+                                isc::dns::ConstRRsetPtr nsec);
 
     /// Add NSEC3 RRs that prove an NXDOMAIN result.
     ///
     /// This corresponds to Section 7.2.2 of RFC 5155.
-    void addNSEC3NXDOMAINProof(isc::datasrc::ZoneFinder& finder);
+    void addNXDOMAINProofByNSEC3(isc::datasrc::ZoneFinder& finder);
 
     /// Add NSEC RRs that prove a wildcard answer is the best one.
     ///
index 775208d5b67fcb13441b78a59a0f998d2d6a5727..dd2f78ae43a01f80d3ca45dc8051eeaa3b2059d7 100644 (file)
@@ -373,7 +373,8 @@ public:
                        ConstRRsetPtr rrset)
     {
         nsec_name_ = nsec_name;
-        nsec_result_.reset(new ZoneFinder::FindResult(code, rrset));
+        nsec_result_.reset(new ZoneFinder::FindResult(code, rrset,
+                                                      RESULT_NSEC_SIGNED));
     }
 
     // Once called, the findNSEC3 will return the provided result for the next