From: bert hubert Date: Thu, 11 Feb 2016 11:33:43 +0000 (+0100) Subject: a function misnamed 'isCanonical' was being used to configure domain forwarding in... X-Git-Tag: auth-4.0.0-alpha2~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7d7a91a96bc0f9203be057f279f73e8b2ad808d;p=thirdparty%2Fpdns.git a function misnamed 'isCanonical' was being used to configure domain forwarding in recursor --- diff --git a/pdns/misc.hh b/pdns/misc.hh index 731c3df8cd..8d788dcdf4 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -473,14 +473,6 @@ inline bool isCanonical(const string& qname) return qname[qname.size()-1]=='.'; } -inline bool isCanonical(const DNSName& qname) -{ - if(qname.empty()) - return false; - return true; -} - - inline DNSName toCanonic(const DNSName& zone, const string& qname) { if(qname.size()==1 && qname[0]=='@') diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 8993f9d33f..ea0aadd085 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -628,8 +628,9 @@ DNSName SyncRes::getBestNSNamesFromCache(const DNSName &qname, const QType& qtyp if( iter->second.d_servers.empty() ) nsset.insert({DNSName(), {ComboAddress(), false}}); // this gets picked up in doResolveAt, the empty DNSName, combined with the empty ComboAddress means 'we are auth' else { - for(auto const &server : iter->second.d_servers) + for(auto const &server : iter->second.d_servers) { nsset.insert({DNSName(), {server, iter->second.d_rdForward}}); // An empty DNSName, combined with a non-empty ComboAddress means 'this is a forwarded domain' + } } return authdomain; } @@ -965,7 +966,7 @@ int SyncRes::doResolveAt(map > &nameservers, D if(g_luaconfs.getLocal()->dfe.getProcessingPolicy(*tns).d_kind != DNSFilterEngine::PolicyKind::NoAction) throw ImmediateServFailException("Dropped because of policy"); - if(!isCanonical(*tns)) { + if(tns->empty()) { LOG(prefix< > &nameservers, D nameservers.insert({nameserver, {ComboAddress(), false}}); break; } - else if(isCanonical(*tns)) { // means: not OOB (I think) + else if(!tns->empty()) { // means: not OOB, OOB == empty goto wasLame; } }