]> granicus.if.org Git - pdns/commitdiff
auth: limit long version strings to 63 characters and catch exceptions in secpoll
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 13 Jan 2015 12:12:54 +0000 (13:12 +0100)
committermind04 <mind04@monshouwer.org>
Tue, 13 Jan 2015 15:25:03 +0000 (16:25 +0100)
pdns/common_startup.cc
pdns/secpoll-auth.cc

index c1abe1d26b64bb504b0522ebb2e57aab4429b84b..bef05b8dc5d758b2c9051834287dd643d885d376 100644 (file)
@@ -430,7 +430,10 @@ void mainthread()
    DNSPacket::s_udpTruncationThreshold = std::max(512, ::arg().asNum("udp-truncation-threshold"));
    DNSPacket::s_doEDNSSubnetProcessing = ::arg().mustDo("edns-subnet-processing");
 
-   doSecPoll(true); // this must be BEFORE chroot
+   try {
+     doSecPoll(true); // this must be BEFORE chroot
+   }
+   catch(...) {}
 
    if(!::arg()["chroot"].empty()) {  
      triggerLoadOfLibraries();
index cfdce04d7dfa91bad51a93f63c3427e35be6c98a..50d9d4db74094abf0e62fa3c1c837b9c42716be6 100644 (file)
@@ -122,7 +122,8 @@ void doSecPoll(bool first)
   struct timeval now;
   gettimeofday(&now, 0);
 
-  string query = "auth-" PACKAGEVERSION ".security-status."+::arg()["security-poll-suffix"];
+  string version = "auth-" + string(PACKAGEVERSION);
+  string query = version.substr(0, 63) +".security-status."+::arg()["security-poll-suffix"];
 
   if(*query.rbegin()!='.')
     query+='.';
@@ -149,7 +150,7 @@ void doSecPoll(bool first)
 
   }
   else {
-    L<<Logger::Warning<<"Could not retrieve security status update for '" PACKAGEVERSION "' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
+    L<<Logger::Warning<<"Could not retrieve security status update for '"<<PACKAGEVERSION<<"' on '"+query+"', RCODE = "<< RCode::to_s(res)<<endl;
     if(security_status == 1) // it was ok, not it is unknown
       security_status = 0;
   }