]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2165] Check for NULL rrsets in stripRRsigs() itself
authorMukund Sivaraman <muks@isc.org>
Wed, 22 Aug 2012 02:50:38 +0000 (08:20 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 22 Aug 2012 02:50:38 +0000 (08:20 +0530)
This will also be useful in the next commit.

src/bin/auth/tests/query_unittest.cc
src/lib/datasrc/zone.h

index b9650d6ca4f81268ef6883148107df53c3656114..513b18bce404ae18ffcde1f51c4cb373bba53905 100644 (file)
@@ -485,7 +485,7 @@ protected:
                                        isc::dns::ConstRRsetPtr rrset,
                                        FindResultFlags flags = RESULT_DEFAULT)
     {
-        ConstRRsetPtr rr = (rrset ? stripRRsigs(rrset, options) : rrset);
+        ConstRRsetPtr rr = stripRRsigs(rrset, options);
         return (ZoneFinderContextPtr(
                     new Context(*this, options,
                                 ResultContext(code, rr, flags))));
index 4babefe911a8d55436ffa1ccade7ec32e390a2e4..15a949d70498ef90504affb34625d5f7d74aa2d8 100644 (file)
@@ -138,23 +138,26 @@ public:
     /// requested.
     static isc::dns::ConstRRsetPtr
     stripRRsigs(isc::dns::ConstRRsetPtr rr, const FindOptions options) {
-        isc::dns::ConstRRsetPtr sig_rrset = rr->getRRsig();
-        if (sig_rrset &&
-            ((options & ZoneFinder::FIND_DNSSEC) == 0)) {
-            isc::dns::RRsetPtr result_base(new isc::dns::RRset(rr->getName(),
-                                           rr->getClass(),
-                                           rr->getType(),
-                                           rr->getTTL()));
-            for (isc::dns::RdataIteratorPtr i(rr->getRdataIterator());
-                 !i->isLast();
-                 i->next()) {
-                result_base->addRdata(i->getCurrent());
-            }
+        if (rr) {
+            isc::dns::ConstRRsetPtr sig_rrset = rr->getRRsig();
+            if (sig_rrset &&
+                ((options & ZoneFinder::FIND_DNSSEC) == 0)) {
+                isc::dns::RRsetPtr result_base
+                    (new isc::dns::RRset(rr->getName(),
+                                         rr->getClass(),
+                                         rr->getType(),
+                                         rr->getTTL()));
+                for (isc::dns::RdataIteratorPtr i(rr->getRdataIterator());
+                     !i->isLast();
+                     i->next()) {
+                    result_base->addRdata(i->getCurrent());
+                }
 
-            return(result_base);
-        } else {
-            return(rr);
+                return (result_base);
+            }
         }
+
+        return (rr);
     }
 
     /// \brief Context of the result of a find() call.