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: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3216c7db1f4311f5cc8aed53b2304e915811d287;p=pdns move check down --- diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 14a1b5fc8..b63f1bdbc 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).