]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add '8bit-dns' config option to disable the valiDNSName rules when needed 4001/head
authorKees Monshouwer <mind04@monshouwer.org>
Wed, 15 Jun 2016 11:24:22 +0000 (13:24 +0200)
committermind04 <mind04@monshouwer.org>
Wed, 15 Jun 2016 11:24:22 +0000 (13:24 +0200)
docs/markdown/authoritative/settings.md
pdns/common_startup.cc
pdns/common_startup.hh
pdns/packethandler.cc

index 2aa852942814d907229b2a4f1d7625a07ca84d43..c20a890c10993c339f4c692270f30e1fa52b0e77 100644 (file)
@@ -11,6 +11,13 @@ setting. This is mostly useful for [`include-dir`](#include-dir) directive.
 For boolean settings, specifying the name of the setting without a value means
 `yes`.
 
+## `8bit-dns`
+* Allow 8 bit dns queries
+* Default: no
+* Available since: 4.0.0
+
+Allow 8 bit DNS queries.
+
 ## `allow-axfr-ips`
 * IP ranges, separated by commas
 * Default: 127.0.0.0/8,::1
index d712ae31ee8ec8bc423ee5f54a12836b81540b2f..3ee2b5a7da41878641bac33178224bae56cd5fa4 100644 (file)
@@ -34,6 +34,7 @@
 #endif
 
 bool g_anyToTcp;
+bool g_8bitDNS;
 typedef Distributor<DNSPacket,DNSPacket,PacketHandler> DNSDistributor;
 
 ArgvMap theArg;
@@ -185,6 +186,7 @@ void declareArguments()
   ::arg().set("security-poll-suffix","Domain name from which to query security update notifications")="secpoll.powerdns.com.";
 
   ::arg().setSwitch("outgoing-axfr-expand-alias", "Expand ALIAS records during outgoing AXFR")="no";
+  ::arg().setSwitch("8bit-dns", "Allow 8bit dns queries")="no";
 }
 
 static time_t s_start=time(0);
@@ -475,6 +477,7 @@ void mainthread()
      newuid=Utility::makeUidNumeric(::arg()["setuid"]); 
    
    g_anyToTcp = ::arg().mustDo("any-to-tcp");
+   g_8bitDNS = ::arg().mustDo("8bit-dns");
 
    DNSPacket::s_udpTruncationThreshold = std::max(512, ::arg().asNum("udp-truncation-threshold"));
    DNSPacket::s_doEDNSSubnetProcessing = ::arg().mustDo("edns-subnet-processing");
index 9300f8edd88ee4af4de3a10588651d1d4eb5f9ba..4acb89384b4cd31882f6bc844004297b404e5209 100644 (file)
@@ -52,5 +52,6 @@ extern void mainthread();
 extern int isGuarded( char ** );
 void* carbonDumpThread(void*);
 extern bool g_anyToTcp;
+extern bool g_8bitDNS;
 
 #endif // COMMON_STARTUP_HH
index e35e4be14a41761a08816212043423b01d505408..5f0c0a6ddf996111748686547efe107df593ec2d 100644 (file)
@@ -883,17 +883,19 @@ int PacketHandler::processNotify(DNSPacket *p)
 
 bool validDNSName(const DNSName &name)
 {
-  string::size_type pos, length;
-  char c;
-  for(const auto& s : name.getRawLabels()) {
-    length=s.length();
-    for(pos=0; pos < length; ++pos) {
-      c=s[pos];
-      if(!((c >= 'a' && c <= 'z') ||
-           (c >= 'A' && c <= 'Z') ||
-           (c >= '0' && c <= '9') ||
-           c =='-' || c == '_' || c=='*' || c=='.' || c=='/' || c=='@' || c==' ' || c=='\\' || c==':'))
-        return false;
+  if (!g_8bitDNS) {
+    string::size_type pos, length;
+    char c;
+    for(const auto& s : name.getRawLabels()) {
+      length=s.length();
+      for(pos=0; pos < length; ++pos) {
+        c=s[pos];
+        if(!((c >= 'a' && c <= 'z') ||
+             (c >= 'A' && c <= 'Z') ||
+             (c >= '0' && c <= '9') ||
+             c =='-' || c == '_' || c=='*' || c=='.' || c=='/' || c=='@' || c==' ' || c=='\\' || c==':'))
+          return false;
+      }
     }
   }
   return true;