]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add test
authorOtto Moerbeek <otto@drijf.net>
Tue, 8 Jul 2025 10:03:00 +0000 (12:03 +0200)
committerOtto Moerbeek <otto@drijf.net>
Tue, 8 Jul 2025 10:03:00 +0000 (12:03 +0200)
regression-tests.recursor-dnssec/test_Lua.py

index 436a25f5199a6ca158440ade475b75f9f7bde754..40799449076406376cb52c8f9cfb81b018669f14 100644 (file)
@@ -317,11 +317,14 @@ quiet=no
         dq.rcode = -3 -- "kill"
         return true
       end
+      if dq.remoteaddr:equal(newCA("%s.23")) and dq.qname == newDN("preout.luahooks.example.") and dq.qtype == pdns.TXT then
+        dq.isTcp = true
+      end
 
       return false
     end
 
-    """ % (os.environ['PREFIX'], os.environ['PREFIX'], os.environ['PREFIX'])
+    """ % (os.environ['PREFIX'], os.environ['PREFIX'], os.environ['PREFIX'], os.environ['PREFIX'])
 
     @classmethod
     def startResponders(cls):
@@ -414,6 +417,14 @@ quiet=no
             res = sender(query)
             self.assertRcodeEqual(res, dns.rcode.NOERROR)
 
+    def testPreOutInterceptedToTCPQuery(self):
+        query = dns.message.make_query('preout.luahooks.example.', 'TXT', 'IN')
+
+        for method in ("sendUDPQuery", "sendTCPQuery"):
+            sender = getattr(self, method)
+            res = sender(query)
+            self.assertRcodeEqual(res, dns.rcode.SERVFAIL) # crude, responder does not do TCP
+
 class LuaHooksRecursorDistributesTest(LuaHooksRecursorTest):
     _confdir = 'LuaHooksRecursorDistributes'
     _config_template = """