[Pdns-dev]bindbackend2.cс patch for lookup

Anton Nekhoroshikh anton at ht-systems.ru
Thu Oct 12 18:52:34 CEST 2006


Hi all!

if qname ended with dot you needed this patch


--- bindbackend2.cc.orig        2006-10-12 16:39:54.000000000 +0400
+++ bindbackend2.cc     2006-10-12 17:43:06.000000000 +0400
@@ -654,6 +654,13 @@
   d_handle.reset();
 
   string domain=toLower(qname);
+  string qname2=qname;
+
+  if(domain.substr(domain.length()-1,domain.length()-1)==".")
+    domain = domain.substr(0,domain.length()-1);
+
+  if(qname2.substr(qname2.length()-1,qname2.length()-1)==".")
+    qname2 = qname2.substr(0,qname2.length()-1);
 
   bool mustlog=arg().mustDo("query-logging");
   if(mustlog) 
@@ -665,7 +672,7 @@
 
   if(iditer==s_name_id_map.end()) {
     if(mustlog)
-      L<<Logger::Warning<<"Found no authoritative zone for "<<qname<<endl;
+      L<<Logger::Warning<<"Found no authoritative zone for "<<qname2<<endl;
     d_handle.d_list=false;
     return;
   }
@@ -676,14 +683,14 @@
   d_handle.id=iditer->second;
   
   DLOG(L<<"Bind2Backend constructing handle for search for "<<qtype.getName()<<" for "<<
-       qname<<endl);
+       qname2<<endl);
   
-  if(strcasecmp(qname.c_str(),domain.c_str()))
-    d_handle.qname=qname.substr(0,qname.size()-domain.length()-1); // strip domain name
+  if(strcasecmp(qname2.c_str(),domain.c_str()))
+    d_handle.qname=qname2.substr(0,qname2.size()-domain.length()-1); // strip domain name
 
   d_handle.parent=this;
   d_handle.qtype=qtype;
-  d_handle.domain=qname.substr(qname.size()-domain.length());
+  d_handle.domain=qname.substr(qname2.size()-domain.length());
 
   d_handle.d_records=s_id_zone_map[iditer->second].d_records; // give it a copy
   if(!d_handle.d_records->empty()) {




More information about the Pdns-dev mailing list