From 0ca59ad989bc771753ab45607d36c86f41b321f5 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Thu, 31 Oct 2019 10:32:44 +0100 Subject: [PATCH] auth: api: patchZone() was ignoring the default-api-rectify setting --- pdns/ws-auth.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 19ca1b5d56..31ebdf0542 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -2072,14 +2072,20 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) { throw; } + // Rectify DNSSECKeeper dk(&B); - string api_rectify; - di.backend->getDomainMetadataOne(zonename, "API-RECTIFY", api_rectify); - if (dk.isSecuredZone(zonename) && !dk.isPresigned(zonename) && api_rectify == "1") { - string error_msg = ""; - string info; - if (!dk.rectifyZone(zonename, error_msg, info, false)) - throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg); + if (!dk.isPresigned(zonename)) { + string api_rectify; + if (!di.backend->getDomainMetadataOne(zonename, "API-RECTIFY", api_rectify) && ::arg().mustDo("default-api-rectify")) { + api_rectify = "1"; + } + if (api_rectify == "1") { + string info; + string error_msg; + if (!dk.rectifyZone(zonename, error_msg, info, false)) { + throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg); + } + } } di.backend->commitTransaction(); -- 2.47.2