]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1604b] Merge branch 'master' into trac1604b
authorStephen Morris <stephen@isc.org>
Fri, 3 Feb 2012 11:39:28 +0000 (11:39 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 3 Feb 2012 11:39:28 +0000 (11:39 +0000)
Conflicts:
src/lib/datasrc/memory_datasrc.cc

1  2 
src/lib/datasrc/memory_datasrc.cc

index 285cee5fef723ffafef5dab1f932f5a191583748,0263b91d057b9849ef817a35e82e00a11e4e3f68..450c8b6c1453ba57e8962b7a65a675c65b182398
@@@ -137,24 -183,23 +183,23 @@@ struct InMemoryZoneFinder::InMemoryZone
       *
       * If such condition is found, it throws AddError.
       */
-     void contextCheck(const ConstRRsetPtr& rrset,
-                       const DomainPtr& domain) const {
 -    void contextCheck(const RRset& rrset, const Domain& domain) const {
++    void contextCheck(const AbstractRRset& rrset, const Domain& domain) const {
          // Ensure CNAME and other type of RR don't coexist for the same
-         // owner name.
-         if (rrset->getType() == RRType::CNAME()) {
-             // TODO: this check will become incorrect when we support DNSSEC
-             // (depending on how we support DNSSEC).  We should revisit it
-             // at that point.
-             if (!domain->empty()) {
+         // 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 (find_if(domain.begin(), domain.end(), isNotNSEC)
+                 != domain.end()) {
                  LOG_ERROR(logger, DATASRC_MEM_CNAME_TO_NONEMPTY).
-                     arg(rrset->getName());
+                     arg(rrset.getName());
                  isc_throw(AddError, "CNAME can't be added with other data for "
-                           << rrset->getName());
+                           << rrset.getName());
              }
-         } else if (domain->find(RRType::CNAME()) != domain->end()) {
-             LOG_ERROR(logger, DATASRC_MEM_CNAME_COEXIST).arg(rrset->getName());
-             isc_throw(AddError, "CNAME and " << rrset->getType() <<
-                       " can't coexist for " << rrset->getName());
+         } else if (rrset.getType() != RRType::NSEC() &&
+                    domain.find(RRType::CNAME()) != domain.end()) {
+             LOG_ERROR(logger, DATASRC_MEM_CNAME_COEXIST).arg(rrset.getName());
+             isc_throw(AddError, "CNAME and " << rrset.getType() <<
+                       " can't coexist for " << rrset.getName());
          }
  
          /*
          // Note: there's a slight chance of getting an exception.
          // As noted in add(), we give up strong exception guarantee in such
          // cases.
-         boost::const_pointer_cast<AbstractRRset>(it->second)->addRRsig(sig_rrset);
 -        boost::const_pointer_cast<RRset>(covered_rrset)->addRRsig(sig_rrset);
++        boost::const_pointer_cast<AbstractRRset>(covered_rrset)->addRRsig(sig_rrset);
  
          return (result::SUCCESS);
      }