Parcourir la source

[2108] Fix context check when adding a CNAME record

Mukund Sivaraman il y a 12 ans
Parent
commit
083e683626
1 fichiers modifiés avec 8 ajouts et 5 suppressions
  1. 8 5
      src/lib/datasrc/memory/memory_client.cc

+ 8 - 5
src/lib/datasrc/memory/memory_client.cc

@@ -178,11 +178,14 @@ public:
         // owner name except with NSEC, which is the only RR that can coexist
         // with CNAME (and also RRSIG, which is handled separately)
         if (rrset.getType() == RRType::CNAME()) {
-            if (RdataSet::find(set, RRType::NSEC()) != NULL) {
-                LOG_ERROR(logger, DATASRC_MEM_CNAME_TO_NONEMPTY).
-                    arg(rrset.getName());
-                isc_throw(AddError, "CNAME can't be added with other data for "
-                          << rrset.getName());
+            for (const RdataSet* sp = set; sp != NULL; sp = sp->getNext()) {
+                if (sp->type != RRType::NSEC()) {
+                    LOG_ERROR(logger, DATASRC_MEM_CNAME_TO_NONEMPTY).
+                        arg(rrset.getName());
+                    isc_throw(AddError, "CNAME can't be added with "
+                              << sp->type << " RRType for "
+                              << rrset.getName());
+                }
             }
         } else if ((rrset.getType() != RRType::NSEC()) &&
                    (RdataSet::find(set, RRType::CNAME()) != NULL)) {