]> granicus.if.org Git - pdns/commitdiff
in the recursor secpoll code, we ASSumed the TXT record would be the first record...
authorbert hubert <bert.hubert@netherlabs.nl>
Wed, 8 Nov 2017 14:33:45 +0000 (15:33 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Wed, 8 Nov 2017 14:33:45 +0000 (15:33 +0100)
pdns/pdns_recursor.cc
pdns/secpoll-recursor.cc

index e987037e064f4eb88de1c0e3b9be74e79db6f73e..50c4156c5060a042006d39db5007cc6029ea3fe9 100644 (file)
@@ -2158,7 +2158,10 @@ static void houseKeeping(void *)
        try {
          doSecPoll(&last_secpoll);
        }
-       catch(...) {}
+       catch(std::exception& e)
+        {
+          L<<Logger::Error<<"Exception while performing security poll: "<<e.what()<<endl;
+        }
       }
     }
     s_running=false;
index c7b6d47d4fbb49b0a969e1d5324f2a04214ada1f..3248b84657764b7d0e4a9ac1f463fddef00f9055 100644 (file)
@@ -36,7 +36,7 @@ void doSecPoll(time_t* last_secpoll)
   }
 
   vector<DNSRecord> ret;
-
+  
   string version = "recursor-" +pkgv;
   string qstring(version.substr(0, 63)+ ".security-status."+::arg()["security-poll-suffix"]);
 
@@ -62,16 +62,20 @@ void doSecPoll(time_t* last_secpoll)
   }
 
   if(!res && !ret.empty()) {
-    string content=ret.begin()->d_content->getZoneRepresentation();
+    string content;
+    for(const auto&r : ret) {
+      if(r.d_type == QType::TXT)
+        content = r.d_content->getZoneRepresentation();
+    }
+
     if(!content.empty() && content[0]=='"' && content[content.size()-1]=='"') {
       content=content.substr(1, content.length()-2);
     }
-      
+
     pair<string, string> split = splitField(content, ' ');
     
     g_security_status = std::stoi(split.first);
     g_security_message = split.second;
-
   }
   else {
     if(pkgv.find("0.0.") != 0)