From c90a4fb0e948cb764585d093344072ca94e7bd69 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Wed, 10 Apr 2024 01:09:57 +0200 Subject: [PATCH] auth: don't crash when a catalog SOA is invalid --- pdns/auth-primarycommunicator.cc | 17 +++++++++++------ pdns/backends/gsql/gsqlbackend.cc | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pdns/auth-primarycommunicator.cc b/pdns/auth-primarycommunicator.cc index 1b9ff3b3a493..e425d0442550 100644 --- a/pdns/auth-primarycommunicator.cc +++ b/pdns/auth-primarycommunicator.cc @@ -157,16 +157,21 @@ void CommunicatorClass::getUpdatedProducers(UeberBackend* B, vector& continue; } - B->setDomainMetadata(di.zone, "CATALOG-HASH", mapHash); - - g_log << Logger::Warning << "new CATALOG-HASH '" << mapHash << "' for zone '" << di.zone << "'" << endl; - SOAData sd; - if (!B->getSOAUncached(di.zone, sd)) { - g_log << Logger::Warning << "SOA lookup failed for producer zone '" << di.zone << "'" << endl; + try { + if (!B->getSOAUncached(di.zone, sd)) { + g_log << Logger::Warning << "SOA lookup failed for producer zone '" << di.zone << "'" << endl; + continue; + } + } + catch (...) { continue; } + g_log << Logger::Warning << "new CATALOG-HASH '" << mapHash << "' for zone '" << di.zone << "'" << endl; + + B->setDomainMetadata(di.zone, "CATALOG-HASH", mapHash); + DNSResourceRecord rr; makeIncreasedSOARecord(sd, "EPOCH", "", rr); di.backend->startTransaction(sd.qname, -1); diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 8ebb3c8acff7..09a090c74cc2 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -463,7 +463,7 @@ void GSQLBackend::getUnfreshSecondaryInfos(vector* unfreshDomains) continue; } catch (...) { - g_log << Logger::Warning << __PRETTY_FUNCTION__ << " error while parsing SOA data for zone '" << di.zone << endl; + g_log << Logger::Warning << __PRETTY_FUNCTION__ << " error while parsing SOA data for zone '" << di.zone << "'" << endl; continue; }