From: Peter van Dijk Date: Mon, 21 May 2018 18:09:26 +0000 (+0200) Subject: move check down X-Git-Tag: dnsdist-1.3.1~71^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6633%2Fhead;p=thirdparty%2Fpdns.git move check down --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 14a1b5fc81..b63f1bdbcc 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -1642,14 +1642,15 @@ static void patchZone(HttpRequest* req, HttpResponse* resp) { apiCheckQNameAllowedCharacters(qname.toString()); QType qtype; qtype = stringFromJson(rrset, "type"); + if (qtype.getCode() == 0) { + throw ApiException("RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")+": unknown type given"); + } + if(seen.count({qname, qtype})) { - throw ApiException("Duplicate RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")); + throw ApiException("Duplicate RRset "+qname.toString()+" IN "+qtype.getName()); } seen.insert({qname, qtype}); - if (qtype.getCode() == 0) { - throw ApiException("RRset "+qname.toString()+" IN "+stringFromJson(rrset, "type")+": unknown type given"); - } if (changetype == "DELETE") { // delete all matching qname/qtype RRs (and, implicitly comments).