Skip to content

Commit

Permalink
Merge pull request #7663 from omoerbeek/backport-7662
Browse files Browse the repository at this point in the history
auth 4.1.x: backport 7662 Do not exit on exception resolving addresses to notify
  • Loading branch information
Habbie committed Jun 11, 2019
2 parents a3f73e5 + 2c75693 commit d57b887
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
24 changes: 19 additions & 5 deletions pdns/communicator.hh
Expand Up @@ -244,18 +244,32 @@ private:
class FindNS
{
public:
vector<string> lookup(const DNSName &name, UeberBackend *b)
vector<string> lookup(const DNSName &name, UeberBackend *b, const DNSName& zone)
{
vector<string> addresses;

this->resolve_name(&addresses, name);

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)
b->lookup(QType(QType::ANY),name);
while (true) {
try {
DNSZoneRecord rr;
if (!b->get(rr))
break;
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
}
// After an exception, b can be inconsistent so break
catch (PDNSException &ae) {
L << Logger::Error << "Could not lookup address for nameserver " << name << " in zone " << zone << ", cannot notify: " << ae.reason << endl;
break;
}
catch (std::exception &e) {
L << Logger::Error << "Could not lookup address for nameserver " << name << " in zone " << zone << ", cannot notify: " << e.what() << endl;
break;
}
}
}
return addresses;
}
Expand Down
2 changes: 1 addition & 1 deletion pdns/mastercommunicator.cc
Expand Up @@ -56,7 +56,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B)
nsset.insert(getRR<NSRecordContent>(rr.dr)->getNS().toString());

for(set<string>::const_iterator j=nsset.begin();j!=nsset.end();++j) {
vector<string> nsips=fns.lookup(DNSName(*j), B);
vector<string> nsips=fns.lookup(DNSName(*j), B, di.zone);
if(nsips.empty())
L<<Logger::Warning<<"Unable to queue notification of domain '"<<di.zone<<"': nameservers do not resolve!"<<endl;
else
Expand Down
2 changes: 1 addition & 1 deletion pdns/tcpreceiver.cc
Expand Up @@ -491,7 +491,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr<DNSPacket> q)
while(B->get(rr))
nsset.insert(DNSName(rr.content));
for(const auto & j: nsset) {
vector<string> nsips=fns.lookup(j, s_P->getBackend());
vector<string> nsips=fns.lookup(j, s_P->getBackend(),q->qdomain);
for(vector<string>::const_iterator k=nsips.begin();k!=nsips.end();++k) {
// cerr<<"got "<<*k<<" from AUTO-NS"<<endl;
if(*k == q->getRemote().toString())
Expand Down

0 comments on commit d57b887

Please sign in to comment.