]> granicus.if.org Git - pdns/commitdiff
Fix SERVFAIL when backend returns empty DNSName
authorMark Zealey <mark@markandruth.co.uk>
Wed, 10 Jul 2019 11:17:32 +0000 (14:17 +0300)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 10 Jul 2019 19:28:08 +0000 (21:28 +0200)
According to the documentation on UeberBackend::getAuth(), a backend
returning an empty DNSName should signal that no matching parent zone
exists in this backend. However commit ae14c1f36a raises an exception if
isPartOf() is called on an empty DNSName so we need to switch the order
of the logic to prevent a SERVFAIL as a result.

(cherry picked from commit 41147d678b30612d2431b59a898879368f1c4b06)

pdns/ueberbackend.cc

index 2c3dd363b04d4ef65a7d74c325c0c494ede9d86e..e33b9030ea669dd4e6187689fec85c720ce346b0 100644 (file)
@@ -330,7 +330,7 @@ bool UeberBackend::getAuth(const DNSName &target, const QType& qtype, SOAData* s
           DLOG(g_log<<Logger::Error<<"lookup: "<<shorter<<endl);
           if((*i)->getAuth(shorter, sd)) {
             DLOG(g_log<<Logger::Error<<"got: "<<sd->qname<<endl);
-            if(!shorter.isPartOf(sd->qname) && !sd->qname.empty()) {
+            if(!sd->qname.empty() && !shorter.isPartOf(sd->qname)) {
               throw PDNSException("getAuth() returned an SOA for the wrong zone. Zone '"+sd->qname.toLogString()+"' is not part of '"+shorter.toLogString()+"'");
             }
             j->first = sd->qname.wirelength();