From b52a15b47f30346048e387fceac2f358f7eab6d2 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Thu, 28 Sep 2017 13:13:13 +0200 Subject: [PATCH] Lowercase all outgoing qnames when lowercase-outgoing is set This is a backport of #5740 --- pdns/pdns_recursor.cc | 4 ---- pdns/syncres.cc | 6 +++++- pdns/syncres.hh | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index ef523a010a..4efc81e486 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -745,10 +745,6 @@ void startDoResolve(void *p) pw.getHeader()->rd=dc->d_mdp.d_header.rd; pw.getHeader()->cd=dc->d_mdp.d_header.cd; - // DO NOT MOVE THIS CODE UP - DNSPacketWriter needs to get the original-cased version - if (g_lowercaseOutgoing) - dc->d_mdp.d_qname = DNSName(toLower(dc->d_mdp.d_qname.toString())); - uint32_t minTTL=std::numeric_limits::max(); SyncRes sr(dc->d_now); diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 653c17682b..88e04f646e 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -374,7 +374,11 @@ int SyncRes::asyncresolveWrapper(const ComboAddress& ip, bool ednsMANDATORY, con else if(ednsMANDATORY || mode==EDNSStatus::UNKNOWN || mode==EDNSStatus::EDNSOK || mode==EDNSStatus::EDNSIGNORANT) EDNSLevel = 1; - ret=asyncresolve(ip, domain, type, doTCP, sendRDQuery, EDNSLevel, now, srcmask, ctx, luaconfsLocal->outgoingProtobufServer, res); + DNSName sendQname(domain); + if (g_lowercaseOutgoing) + sendQname = sendQname.makeLowerCase(); + + ret=asyncresolve(ip, sendQname, type, doTCP, sendRDQuery, EDNSLevel, now, srcmask, ctx, luaconfsLocal->outgoingProtobufServer, res); if(ret < 0) { return ret; // transport error, nothing to learn here } diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 26b2a9cccd..3154747934 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -744,6 +744,7 @@ extern __thread struct timeval g_now; extern NetmaskGroup g_ednssubnets; extern SuffixMatchNode g_ednsdomains; +extern bool g_lowercaseOutgoing; #ifdef HAVE_PROTOBUF extern __thread boost::uuids::random_generator* t_uuidGenerator; -- 2.47.2