]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: lmdb, check if the lookup name is part of the zone 11152/head
authorKees Monshouwer <mind04@monshouwer.org>
Fri, 7 Jan 2022 23:29:38 +0000 (00:29 +0100)
committermind04 <mind04@monshouwer.org>
Fri, 7 Jan 2022 23:45:39 +0000 (00:45 +0100)
modules/lmdbbackend/lmdbbackend.cc
modules/lmdbbackend/lmdbbackend.hh

index 7c33213610f995fc8cb74d4c38c7d476c03c0047..18f7b7eb2ff57a18f11b9a2c702f317eb226f418 100644 (file)
@@ -736,6 +736,9 @@ void LMDBBackend::lookup(const QType& type, const DNSName& qdomain, int zoneId,
   }
 
   DNSName relqname = qdomain.makeRelative(hunt);
+  if (relqname.empty()) {
+    return;
+  }
   // cout<<"get will look for "<<relqname<< " in zone "<<hunt<<" with id "<<zoneId<<" and type "<<type.toString()<<endl;
   d_rotxn = getRecordsROTransaction(zoneId, d_rwtxn);
 
index 33399f31d70bb42350edbb61cabe7f0f1f40b6aa..2325c67bd9562c604d54c3cd952135dd530f597d 100644 (file)
@@ -32,8 +32,14 @@ std::string keyConv(const T& t)
      nl -> nl0
      
   */
-  if (t.isRoot())
+  if (t.empty()) {
+    throw std::out_of_range(std::string(__PRETTY_FUNCTION__) + " Attempt to serialize an unset dnsname");
+  }
+
+  if (t.isRoot()) {
     return std::string(1, (char)0);
+  }
+
   std::string in = t.labelReverse().toDNSStringLC(); // www.ds9a.nl is now 2nl4ds9a3www0
   std::string ret;
   ret.reserve(in.size());