]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Improve error messages on security polling failures
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 14 Jan 2025 09:42:37 +0000 (10:42 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 14 Jan 2025 09:42:37 +0000 (10:42 +0100)
pdns/dnsdistdist/dnsdist-secpoll.cc

index 213b43f436843910ad4166c660cf1e1ad7e0b146..fb2472dabf79940344108ea9e055802ba3fb3894 100644 (file)
@@ -101,7 +101,11 @@ static std::string getSecPollStatus(const std::string& queriedName, int timeout=
 
   const auto& resolversForStub = getResolvers("/etc/resolv.conf");
 
-  for(const auto& dest : resolversForStub) {
+  if (resolversForStub.empty()) {
+    throw std::runtime_error("No resolver to query to check for Security Status update");
+  }
+
+  for (const auto& dest : resolversForStub) {
     Socket sock(dest.sin4.sin_family, SOCK_DGRAM);
     sock.setNonBlocking();
     sock.connect(dest);
@@ -155,7 +159,7 @@ static std::string getSecPollStatus(const std::string& queriedName, int timeout=
 
       /* no need to try another resolver if the domain does not exist */
       if (d.rcode == RCode::NXDomain) {
-        throw std::runtime_error("Unable to get a valid Security Status update");
+        throw std::runtime_error("Unable to get a valid Security Status update, domain does not exist");
       }
       continue;
     }