From a6ad3383e4e874c369386ab5717f7bcb1254000f Mon Sep 17 00:00:00 2001 From: bert hubert Date: Thu, 5 Nov 2015 15:17:53 +0100 Subject: [PATCH] further DNSName cleanup - turns out almost every use of DNSName::length() was dubious! --- modules/mydnsbackend/mydnsbackend.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 { -- 2.40.0