Parcourir la source

removed the special case for CNAME under a zone cut, based on post review
discussion.

JINMEI Tatuya il y a 14 ans
Parent
commit
ea084ffdff

+ 2 - 2
src/lib/datasrc/memory_datasrc.cc

@@ -254,8 +254,8 @@ struct MemoryZone::MemoryZoneImpl {
         if (found != node->getData()->end()) {
             // Good, it is here
             return (FindResult(SUCCESS, found->second));
-        } else if (state.zonecut_node_ == NULL) {
-            // Next, try CNAME unless we are under a zone cut.
+        } else {
+            // Next, try CNAME.
             found = node->getData()->find(RRType::CNAME());
             if (found != node->getData()->end()) {
                 return (FindResult(CNAME, found->second));

+ 4 - 1
src/lib/datasrc/tests/memory_datasrc_unittest.cc

@@ -303,13 +303,16 @@ TEST_F(MemoryZoneTest, findCNAME) {
 }
 
 TEST_F(MemoryZoneTest, findCNAMEUnderZoneCut) {
+    // There's nothing special when we find a CNAME under a zone cut
+    // (with FIND_GLUE_OK).  The behavior is different from BIND 9,
+    // so we test this case explicitly.
     EXPECT_EQ(SUCCESS, zone_.add(rr_child_ns_));
     RRsetPtr rr_cname_under_cut_(new RRset(Name("cname.child.example.org"),
                                            class_, RRType::CNAME(),
                                            RRTTL(300)));
     EXPECT_EQ(SUCCESS, zone_.add(rr_cname_under_cut_));
     findTest(Name("cname.child.example.org"), RRType::AAAA(),
-             Zone::NXRRSET, false, ConstRRsetPtr(), NULL, Zone::FIND_GLUE_OK);
+             Zone::CNAME, true, rr_cname_under_cut_, NULL, Zone::FIND_GLUE_OK);
 }
 
 // Test adding child zones and zone cut handling

+ 1 - 3
src/lib/datasrc/zone.h

@@ -158,9 +158,7 @@ public:
     /// - If there is a CNAME RR of the searched name but there is no
     ///   RR of the searched type of the name (so this type is different from
     ///   CNAME), it returns the code of \c CNAME and that CNAME RR.
-    ///   This special rule does not apply on or under a zone cut (which is
-    ///   possible when the \c GLUE_OK option is specified).
-    ///   Note also that if the searched RR type is CNAME, it is considered
+    ///   Note that if the searched RR type is CNAME, it is considered
     ///   a successful match, and the code of \c SUCCESS will be returned.
     /// - If the search name matches a delegation point of DNAME, it returns
     ///   the code of \c DNAME and that DNAME RR.