From: Otto Moerbeek Date: Wed, 3 Apr 2019 12:10:22 +0000 (+0200) Subject: A way to fix https://github.com/PowerDNS/pdns/issues/7646. It might X-Git-Tag: rec-4.2.0-rc1~42^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=475fc44ee8d1fc21bb9fe0beffa5fd5b1799277f;p=thirdparty%2Fpdns.git A way to fix https://github.com/PowerDNS/pdns/issues/7646. It might not be the right place, though, but it prevents fatal exception on unparseable A (or AAAA) addresss for nameserver addresses needed to send notifies. --- diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 5413e4dacf..2cb0f70feb 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -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; }