From: Remi Gacogne Date: Tue, 22 Aug 2017 09:48:07 +0000 (+0200) Subject: auth: Deny cache flush, zone retrieve and notify if the API is RO X-Git-Tag: auth-4.0.5^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=245a2c8211db2f6c5771f93671e4eb80d4e0a0c7;p=pdns auth: Deny cache flush, zone retrieve and notify if the API is RO (cherry picked from commit 64337a2fef53883a1962e36ae047b3a595951a42) --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index c1fb9fad1..2380206ce 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -867,7 +867,7 @@ static void apiServerZoneExport(HttpRequest* req, HttpResponse* resp) { static void apiServerZoneAxfrRetrieve(HttpRequest* req, HttpResponse* resp) { DNSName zonename = apiZoneIdToName(req->parameters["id"]); - if(req->method != "PUT") + if(req->method != "PUT" || ::arg().mustDo("api-readonly")) throw HttpMethodNotAllowedException(); UeberBackend B; @@ -886,7 +886,7 @@ static void apiServerZoneAxfrRetrieve(HttpRequest* req, HttpResponse* resp) { static void apiServerZoneNotify(HttpRequest* req, HttpResponse* resp) { DNSName zonename = apiZoneIdToName(req->parameters["id"]); - if(req->method != "PUT") + if(req->method != "PUT" || ::arg().mustDo("api-readonly")) throw HttpMethodNotAllowedException(); UeberBackend B; @@ -1198,7 +1198,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) { } void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp) { - if(req->method != "PUT") + if(req->method != "PUT" || ::arg().mustDo("api-readonly")) throw HttpMethodNotAllowedException(); DNSName canon = apiNameToDNSName(req->getvars["domain"]);