]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Limit the TTL of RRSIG records as well 9205/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 5 Jun 2020 13:14:35 +0000 (15:14 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 5 Jun 2020 13:14:35 +0000 (15:14 +0200)
pdns/syncres.cc

index 3fde0ef257060ea7116080ff1eba002e39bd482f..1244b9966b9a07154d16203381bf9977b723d40e 100644 (file)
@@ -2546,11 +2546,13 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, LWResult& lwr
   const unsigned int labelCount = qname.countLabels();
   bool isCNAMEAnswer = false;
   bool isDNAMEAnswer = false;
-  for(const auto& rec : lwr.d_records) {
-    if (rec.d_class != QClass::IN) {
+  for (auto& rec : lwr.d_records) {
+    if (rec.d_type == QType::OPT || rec.d_class != QClass::IN) {
       continue;
     }
 
+    rec.d_ttl = min(s_maxcachettl, rec.d_ttl);
+
     if(!isCNAMEAnswer && rec.d_place == DNSResourceRecord::ANSWER && rec.d_type == QType::CNAME && (!(qtype==QType(QType::CNAME))) && rec.d_name == qname && !isDNAMEAnswer) {
       isCNAMEAnswer = true;
     }
@@ -2573,7 +2575,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, LWResult& lwr
         }
       }
     }
-    if(rec.d_type == QType::RRSIG) {
+    if (rec.d_type == QType::RRSIG) {
       auto rrsig = getRR<RRSIGRecordContent>(rec);
       if (rrsig) {
         /* As illustrated in rfc4035's Appendix B.6, the RRSIG label