]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Explicitely use const iterators in `validateWithKeySet` and `getKeysFor` 5045/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 16 Jan 2017 17:05:34 +0000 (18:05 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Feb 2017 16:02:07 +0000 (17:02 +0100)
(cherry picked from commit 7a4f4632913046afde9e8acbbff1213b8faf982d)

pdns/validate.cc

index 27f7114f880bbcf58814b6896eb8ee4431be70b8..fa209074a4ec8d4c8bb9349245c9c6da029b037a 100644 (file)
@@ -151,7 +151,7 @@ void validateWithKeySet(const cspmap_t& rrsets, cspmap_t& validated, const keyse
     cerr<<"\tTag: "<<key.getTag()<<" -> "<<key.getZoneRepresentation()<<endl;
   }
   */
-  for(auto i=rrsets.begin(); i!=rrsets.end(); i++) {
+  for(auto i=rrsets.cbegin(); i!=rrsets.cend(); i++) {
     LOG("validating "<<(i->first.first)<<"/"<<DNSRecordContent::NumberToType(i->first.second)<<" with "<<i->second.signatures.size()<<" sigs"<<endl);
     for(const auto& signature : i->second.signatures) {
       vector<shared_ptr<DNSRecordContent> > toSign = i->second.records;
@@ -281,7 +281,7 @@ vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, keyset_t &keyset)
     LOG(" => "<<zonecut);
   LOG(endl);
 
-  for(auto zoneCutIter = zoneCuts.begin(); zoneCutIter != zoneCuts.end(); ++zoneCutIter)
+  for(auto zoneCutIter = zoneCuts.cbegin(); zoneCutIter != zoneCuts.cend(); ++zoneCutIter)
   {
     vector<RRSIGRecordContent> sigs;
     vector<shared_ptr<DNSRecordContent> > toSign;
@@ -367,7 +367,7 @@ vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, keyset_t &keyset)
       // but not a fully validated DNSKEY set, yet
       // one of these valid DNSKEYs should be able to validate the
       // whole set
-      for(auto i=sigs.begin(); i!=sigs.end(); i++)
+      for(auto i=sigs.cbegin(); i!=sigs.cend(); i++)
       {
         //        cerr<<"got sig for keytag "<<i->d_tag<<" matching "<<getByTag(tkeys, i->d_tag).size()<<" keys of which "<<getByTag(validkeys, i->d_tag).size()<<" valid"<<endl;
         string msg=getMessageForRRSET(*zoneCutIter, *i, toSign);
@@ -416,9 +416,9 @@ vState getKeysFor(DNSRecordOracle& dro, const DNSName& zone, keyset_t &keyset)
     }
     LOG("situation: we have one or more valid DNSKEYs for ["<<*zoneCutIter<<"] (want ["<<zone<<"])"<<endl);
 
-    if(zoneCutIter == zoneCuts.end()-1) {
+    if(zoneCutIter == zoneCuts.cend()-1) {
       LOG("requested keyset found! returning Secure for the keyset"<<endl);
-      keyset.insert(validkeys.begin(), validkeys.end());
+      keyset.insert(validkeys.cbegin(), validkeys.cend());
       return Secure;
     }