]> granicus.if.org Git - pdns/commitdiff
further DNSName cleanup - turns out almost every use of DNSName::length() was dubious!
authorbert hubert <bert.hubert@powerdns.com>
Thu, 5 Nov 2015 14:17:53 +0000 (15:17 +0100)
committerbert hubert <bert.hubert@powerdns.com>
Thu, 5 Nov 2015 14:17:53 +0000 (15:17 +0100)
modules/mydnsbackend/mydnsbackend.cc

index 9cace468cef28ac6663a04a1d5024dc143549c4d..baa8586839d1c0ffeeac299ea7d6bf88ce0e3d44 100644 (file)
@@ -295,7 +295,6 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
     d_minimum = atol(rrow[1].c_str());
   }
 
-
   if (found) {
 
     while (d_result.size()>1) {
@@ -305,10 +304,8 @@ void MyDNSBackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p
     string host;
 
     // The host part of the query is the name less the origin
-    if (qname.length() == d_origin.length())
-      host = "";
-    else
-      host = qname.toString().substr(0, (qname.length() - d_origin.length())-1);
+    DNSName origin(d_origin);
+    host = qname.makeRelative(origin).toStringNoDot();    
 
     try {