From: bert hubert Date: Thu, 5 Nov 2015 14:17:53 +0000 (+0100) Subject: further DNSName cleanup - turns out almost every use of DNSName::length() was dubious! X-Git-Tag: dnsdist-1.0.0-alpha1~239^2~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6ad3383e4e874c369386ab5717f7bcb1254000f;p=pdns further DNSName cleanup - turns out almost every use of DNSName::length() was dubious! --- diff --git a/modules/mydnsbackend/mydnsbackend.cc b/modules/mydnsbackend/mydnsbackend.cc index 9cace468c..baa858683 100644 --- a/modules/mydnsbackend/mydnsbackend.cc +++ b/modules/mydnsbackend/mydnsbackend.cc @@ -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 {