]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: api, do not create SOA and NS records for consumer zones
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 6 Dec 2022 17:29:16 +0000 (18:29 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 7 Dec 2022 13:14:24 +0000 (14:14 +0100)
(cherry picked from commit 1f1674ed5ed14af10a6ce38b9956ffdbef6fcee8)

pdns/ws-auth.cc

index 648938d31f504ca44d77f7a39db6a151b7276f21..d2d0ab015382fa5bb074d46531d5b1e9085ba8f5 100644 (file)
@@ -1704,7 +1704,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
       throw ApiException("You cannot give rrsets AND zone data as text");
 
     auto nameservers = document["nameservers"];
-    if (!nameservers.is_null() && !nameservers.is_array() && zonekind != DomainInfo::Slave)
+    if (!nameservers.is_null() && !nameservers.is_array() && zonekind != DomainInfo::Slave && zonekind != DomainInfo::Consumer)
       throw ApiException("Nameservers is not a list");
 
     string soa_edit_api_kind;
@@ -1764,7 +1764,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) {
     autorr.auth = true;
     autorr.ttl = ::arg().asNum("default-ttl");
 
-    if (!have_soa && zonekind != DomainInfo::Slave) {
+    if (!have_soa && zonekind != DomainInfo::Slave && zonekind != DomainInfo::Consumer) {
       // synthesize a SOA record so the zone "really" exists
       string soa = ::arg()["default-soa-content"];
       boost::replace_all(soa, "@", zonename.toStringNoDot());