Skip to content

Commit

Permalink
auth: don't crash when a catalog SOA is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
mind04 committed Apr 10, 2024
1 parent 8eb3d9e commit e7bb966
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions pdns/auth-primarycommunicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,21 @@ void CommunicatorClass::getUpdatedProducers(UeberBackend* B, vector<DomainInfo>&
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);
Expand Down
2 changes: 1 addition & 1 deletion pdns/backends/gsql/gsqlbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void GSQLBackend::getUnfreshSecondaryInfos(vector<DomainInfo>* 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;

Check warning on line 466 in pdns/backends/gsql/gsqlbackend.cc

View workflow job for this annotation

GitHub Actions / Analyze (cpp, auth)

do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead (cppcoreguidelines-pro-bounds-array-to-pointer-decay - Level=Warning)
continue;
}

Expand Down

0 comments on commit e7bb966

Please sign in to comment.