From a41a789ac1fe0b57c91528c51553e76925419629 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Thu, 31 Oct 2019 13:12:44 +0100 Subject: [PATCH] auth: api: do not run soaedit or rectify for disabled zones --- pdns/ws-auth.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 31ebdf0542..40ba082f35 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -1924,6 +1924,8 @@ static void storeChangedPTRs(UeberBackend& B, vector& new_ptr } static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { + bool zone_disabled; + SOAData sd; DomainInfo di; DNSName zonename = apiZoneIdToName(req->parameters["id"]); if (!B.getDomainInfo(zonename, di)) { @@ -2048,12 +2050,10 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { throw ApiException("Changetype not understood"); } - // edit SOA (if needed) - if (!soa_edit_api_kind.empty() && !soa_edit_done) { - SOAData sd; - if (!B.getSOAUncached(zonename, sd)) - throw ApiException("No SOA found for domain '"+zonename.toString()+"'"); + zone_disabled = (!B.getSOAUncached(zonename, sd)); + // edit SOA (if needed) + if (!zone_disabled && !soa_edit_api_kind.empty() && !soa_edit_done) { DNSResourceRecord rr; if (makeIncreasedSOARecord(sd, soa_edit_api_kind, soa_edit_kind, rr)) { if (!di.backend->replaceRRSet(di.id, rr.qname, rr.qtype, vector(1, rr))) { @@ -2074,7 +2074,7 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { // Rectify DNSSECKeeper dk(&B); - if (!dk.isPresigned(zonename)) { + if (!zone_disabled && !dk.isPresigned(zonename)) { string api_rectify; if (!di.backend->getDomainMetadataOne(zonename, "API-RECTIFY", api_rectify) && ::arg().mustDo("default-api-rectify")) { api_rectify = "1"; -- 2.47.2