]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
A way to fix https://github.com/PowerDNS/pdns/issues/7646. It might
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 3 Apr 2019 12:10:22 +0000 (14:10 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 3 Apr 2019 12:10:22 +0000 (14:10 +0200)
not be the right place, though, but it prevents fatal exception on
unparseable A (or AAAA) addresss for nameserver addresses needed
to send notifies.

pdns/communicator.hh

index 5413e4dacf2335f9a5af69276536204d776719ae..2cb0f70feb3c5e8ed22777f62d96fce8c6421f2d 100644 (file)
@@ -259,10 +259,25 @@ public:
     
     if(b) {
         b->lookup(QType(QType::ANY),name);
-        DNSZoneRecord rr;
-        while(b->get(rr))
-          if(rr.dr.d_type == QType::A || rr.dr.d_type==QType::AAAA)
-            addresses.push_back(rr.dr.d_content->getZoneRepresentation());   // SOL if you have a CNAME for an NS
+        bool ok;
+        do {
+          DNSZoneRecord rr;
+          try {
+            ok = b->get(rr);
+          }
+          catch (PDNSException &ae) {
+            g_log << Logger::Error << "Skipping record: " << ae.reason << endl;
+            continue;
+          }
+          catch (std::exception &e) {
+            g_log << Logger::Error << "Skipping record: " << e.what() << endl;
+            continue;
+          }
+          if (ok) {
+            if (rr.dr.d_type == QType::A || rr.dr.d_type == QType::AAAA)
+              addresses.push_back(rr.dr.d_content->getZoneRepresentation());   // SOL if you have a CNAME for an NS
+          }
+        } while (ok);
     }
     return addresses;
   }