Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth 4.1.x: backport 7662 Do not exit on exception resolving addresses to notify #7663

Merged
merged 1 commit into from Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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