]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth api: after a db lookup, always finish the get cycle
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 15 Nov 2019 14:29:51 +0000 (15:29 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 15 Nov 2019 14:29:51 +0000 (15:29 +0100)
pdns/ws-auth.cc

index 54f4e0b17848c974c6fb368e36ff5c67e7700bdd..de11fdf336e6746855fd8f3c435863bc133d8ba5 100644 (file)
@@ -2025,6 +2025,11 @@ static void patchZone(UeberBackend& B, HttpRequest* req, HttpResponse* resp) {
             if (qtype.getCode() != rr.qtype.getCode()
               && (exclusiveEntryTypes.count(qtype.getCode()) != 0
                 || exclusiveEntryTypes.count(rr.qtype.getCode()) != 0)) {
+
+              // leave database handle in a consistent state
+              while (di.backend->get(rr))
+                ;
+
               throw ApiException("RRset "+qname.toString()+" IN "+qtype.getName()+": Conflicts with pre-existing RRset");
             }
           }