Browse Source

[2165] Strip RRSIGs from addditional records in DB datasource when DNSSEC is not asked

Mukund Sivaraman 12 years ago
parent
commit
ef85853043
1 changed files with 18 additions and 1 deletions
  1. 18 1
      src/lib/datasrc/zone_finder_context.cc

+ 18 - 1
src/lib/datasrc/zone_finder_context.cc

@@ -47,7 +47,24 @@ getAdditionalAddrs(ZoneFinder& finder, const Name& name,
     BOOST_FOREACH(RRType rrtype, requested_types) {
     BOOST_FOREACH(RRType rrtype, requested_types) {
         ConstZoneFinderContextPtr ctx = finder.find(name, rrtype, options);
         ConstZoneFinderContextPtr ctx = finder.find(name, rrtype, options);
         if (ctx->code == ZoneFinder::SUCCESS) {
         if (ctx->code == ZoneFinder::SUCCESS) {
-            result_rrsets.push_back(ctx->rrset);
+            ConstRRsetPtr rr = ctx->rrset;
+            ConstRRsetPtr sig_rrset = rr->getRRsig();
+            if (sig_rrset &&
+                ((options & ZoneFinder::FIND_DNSSEC) == 0)) {
+                RRsetPtr result_base(new RRset(rr->getName(),
+                                               rr->getClass(),
+                                               rr->getType(),
+                                               rr->getTTL()));
+                for (RdataIteratorPtr i(rr->getRdataIterator());
+                     !i->isLast();
+                     i->next()) {
+                    result_base->addRdata(i->getCurrent());
+                }
+
+                result_rrsets.push_back(result_base);
+            } else {
+                result_rrsets.push_back(rr);
+            }
         }
         }
     }
     }
 }
 }