]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Make lowercase-outgoing actually lowercase all q's
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 28 Sep 2017 10:15:00 +0000 (12:15 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 16 Oct 2017 10:44:45 +0000 (12:44 +0200)
Before, we would only lowercase the original qname before handing it to
SyncRes. Now the asyncresolveWrapper lowercases if it has to behor
handing the qname to asyncresolve.

pdns/pdns_recursor.cc
pdns/recursordist/test-syncres_cc.cc
pdns/syncres.cc
pdns/syncres.hh

index 01fc6e3415f0cf28024d46834c55dc03069ccb63..6ea920f863916ed6221021ab69b2617668fde0cc 100644 (file)
@@ -149,7 +149,6 @@ static std::atomic<bool> statsWanted;
 static std::atomic<bool> g_quiet;
 static bool g_logCommonErrors;
 static bool g_anyToTcp;
-static bool g_lowercaseOutgoing;
 static bool g_weDistributeQueries; // if true, only 1 thread listens on the incoming query sockets
 static bool g_reusePort{false};
 static bool g_useOneSocketPerThread;
@@ -162,6 +161,7 @@ RecursorControlChannel s_rcc; // only active in thread 0
 RecursorStats g_stats;
 string s_programname="pdns_recursor";
 string s_pidfname;
+bool g_lowercaseOutgoing;
 unsigned int g_numThreads;
 uint16_t g_outgoingEDNSBufsize;
 bool g_logRPZChanges{false};
@@ -761,10 +761,6 @@ static 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 = dc->d_mdp.d_qname.makeLowerCase();
-
     uint32_t minTTL=std::numeric_limits<uint32_t>::max();
 
     SyncRes sr(dc->d_now);
index 5c82bb41de2c426fc3ca321989858316535c0724..bce93a4ebbf3565bb5ca7bea81d8e4f349116e64 100644 (file)
@@ -19,6 +19,7 @@ RecursorStats g_stats;
 GlobalStateHolder<LuaConfigItems> g_luaconfs;
 thread_local std::unique_ptr<MemRecursorCache> t_RC{nullptr};
 unsigned int g_numThreads = 1;
+bool g_lowercaseOutgoing = false;
 
 /* Fake some required functions we didn't want the trouble to
    link with */
index e964ffc833c4aa404d383c09fb0fce141994df98..7e0c9da5fd0babd0999a05f9ec10ea0ac41c0b4e 100644 (file)
@@ -451,11 +451,15 @@ int SyncRes::asyncresolveWrapper(const ComboAddress& ip, bool ednsMANDATORY, con
     else if(ednsMANDATORY || mode==EDNSStatus::UNKNOWN || mode==EDNSStatus::EDNSOK || mode==EDNSStatus::EDNSIGNORANT)
       EDNSLevel = 1;
 
+    DNSName sendQname(domain);
+    if (g_lowercaseOutgoing)
+      sendQname.makeUsLowerCase();
+
     if (d_asyncResolve) {
-      ret = d_asyncResolve(ip, domain, type, doTCP, sendRDQuery, EDNSLevel, now, srcmask, ctx, luaconfsLocal->outgoingProtobufServer, res);
+      ret = d_asyncResolve(ip, sendQname, type, doTCP, sendRDQuery, EDNSLevel, now, srcmask, ctx, luaconfsLocal->outgoingProtobufServer, res);
     }
     else {
-      ret=asyncresolve(ip, domain, type, doTCP, sendRDQuery, EDNSLevel, now, srcmask, ctx, luaconfsLocal->outgoingProtobufServer, res);
+      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
index bbce7ee6a64dd13829547367a41de8ec21091481..844d5d6891239ad7dc4815a940ff9ba90b348cab 100644 (file)
@@ -947,6 +947,7 @@ extern RecursorStats g_stats;
 extern unsigned int g_numThreads;
 extern uint16_t g_outgoingEDNSBufsize;
 extern std::atomic<uint32_t> g_maxCacheEntries, g_maxPacketCacheEntries;
+extern bool g_lowercaseOutgoing;
 
 
 std::string reloadAuthAndForwards();