]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add lowercase-outgoing tests 3617/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 23 Mar 2016 15:09:36 +0000 (16:09 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 31 Mar 2016 20:22:29 +0000 (22:22 +0200)
regression-tests.recursor/config.sh
regression-tests.recursor/lowercase-outgoing/command [new file with mode: 0755]
regression-tests.recursor/lowercase-outgoing/description [new file with mode: 0644]
regression-tests.recursor/lowercase-outgoing/expected_result [new file with mode: 0644]
regression-tests.recursor/start.sh
regression-tests.recursor/stop.sh

index a3ffc930a5d0cc4e1f1545c9609575ce4dfe1a25..0d36fcffe16e2f97bb5c1fb9fa8e3645293fc2bd 100755 (executable)
@@ -30,34 +30,37 @@ $AUTHRUN
 EOF
 chmod +x run-auth
 
-cd configs
-
-mkdir recursor-service
-cd recursor-service
 if [ \! -x "$PDNSRECURSOR" ]
 then
-       echo "Could not find an executable pdns_recursor at \"$PDNSRECURSOR\", check PDNSRECURSOR"
-       echo "Continuing with configuration anyhow"
+  echo "Could not find an executable pdns_recursor at \"$PDNSRECURSOR\", check PDNSRECURSOR"
+  echo "Continuing with configuration anyhow"
 fi
 
 if [ \! -x "$PDNS" ]
 then
-       echo "Could not find an executable pdns_server at \"$PDNS\", check PDNS"
-       echo "Continuing with configuration anyhow"
+  echo "Could not find an executable pdns_server at \"$PDNS\", check PDNS"
+  echo "Continuing with configuration anyhow"
 fi
 
-cat > run <<EOF
+cd configs
+
+for dir in recursor-service recursor-service2; do
+  mkdir $dir
+  cd $dir
+
+  cat > run <<EOF
 #!/bin/sh
 $RECRUN
 EOF
-chmod +x run
+  chmod +x run
 
-cat > hintfile << EOF
+  cat > hintfile << EOF
 .                        3600 IN NS  ns.root.
 ns.root.                 3600 IN A   $PREFIX.8
 EOF
 
-cd ..
+  cd ..
+done
 
 SOA="ns.example.net. hostmaster.example.net. 1 3600 1800 1209600 300"
 
@@ -107,6 +110,8 @@ box.answer-cname-in-local.example.net. 3600 IN NS ns.answer-cname-in-local.examp
 ns.answer-cname-in-local.example.net. 3600 IN A  $PREFIX.22
 not-auth-zone.example.net. 3600 IN NS ns.not-auth-zone.example.net.
 ns.not-auth-zone.example.net. 3600 IN A $PREFIX.23
+lowercase-outgoing.example.net. 3600 IN NS ns.lowercase-outgoing.example.net.
+ns.lowercase-outgoing.example.net. 3600 IN A $PREFIX.24
 EOF
 
 mkdir $PREFIX.11
@@ -419,6 +424,32 @@ host3.auth-zone.example.net. 20 IN CNAME host1.not-auth-zone.example.net.
 *.wild.auth-zone.example.net.  3600 IN TXT "Hi there!"
 EOF
 
+mkdir $PREFIX.24
+cat > $PREFIX.24/lowercase-outgoing.example.net.zone <<EOF
+lowercase-outgoing.example.net. 3600 IN SOA $SOA
+lowercase-outgoing.example.net. 20 IN NS ns.lowercase-outgoing.example.net.
+
+ns.lowercase-outgoing.example.net. 20 IN  A $PREFIX.24
+host.lowercase-outgoing.example.net. 20 IN  A 127.0.0.57
+EOF
+
+cat > $PREFIX.24/prequery.lua <<EOF
+filename = "questions.txt"
+
+--- Truncate file
+file = io.open(filename, "w")
+file:close()
+
+function prequery ( dnspacket )
+    qname, qtype = dnspacket:getQuestion()
+    file = io.open('questions.txt', "a")
+    file:write(qname .. "\n")
+    file:close()
+
+    return false
+end
+EOF
+
 cat > recursor-service/another-auth-zone.example.net.zone <<EOF
 another-auth-zone.example.net. 3600 IN SOA $SOA
 another-auth-zone.example.net. 20 IN NS localhost.example.net.
@@ -487,3 +518,10 @@ socket-dir=$(pwd)/recursor-serviceS
 auth-zones=global.box.answer-cname-in-local.example.net=$(pwd)/recursor-service/global.box.answer-cname-in-local.example.net.zone,auth-zone.example.net=$(pwd)/recursor-service/auth-zone.example.net.zone,another-auth-zone.example.net=$(pwd)/recursor-service/another-auth-zone.example.net.zone
 
 EOF
+
+cat > recursor-service2/recursor.conf <<EOF
+local-port=5300
+socket-dir=$(pwd)/recursor-service2S
+lowercase-outgoing=yes
+
+EOF
diff --git a/regression-tests.recursor/lowercase-outgoing/command b/regression-tests.recursor/lowercase-outgoing/command
new file mode 100755 (executable)
index 0000000..173d835
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+cleandig hOsT.lOwErcAsE-outgoing.example.net a >/dev/null 2>&1
+$SDIG $nameserver 5300 hOsT.lOwErcAsE-outgoing.example.net a recurse >/dev/null 2>&1
+cat configs/10.0.3.24/questions.txt
diff --git a/regression-tests.recursor/lowercase-outgoing/description b/regression-tests.recursor/lowercase-outgoing/description
new file mode 100644 (file)
index 0000000..e941b3a
--- /dev/null
@@ -0,0 +1 @@
+Test if the recursor indeed lowercases outgoing queries with lowercase-outgoing set
diff --git a/regression-tests.recursor/lowercase-outgoing/expected_result b/regression-tests.recursor/lowercase-outgoing/expected_result
new file mode 100644 (file)
index 0000000..1d1542e
--- /dev/null
@@ -0,0 +1,2 @@
+hOsT.lOwErcAsE-outgoing.example.net.
+host.lowercase-outgoing.example.net.
index a27d89829b4d24d185bab319fa948a852ba14554..45dd0694d738579b7b77284c5d9e5a8a4f409e79 100755 (executable)
@@ -14,9 +14,9 @@ fi
 
 cd configs
 
-for dir in $PREFIX.* recursor-service
+for dir in $PREFIX.* recursor-service recursor-service2
 do
        supervise $dir &
 done
 
-sleep 1
\ No newline at end of file
+sleep 1
index 411b43a84740506a680033a872a148ee51ab3804..cc2d8c60cd4a804aa3bcc6dc2adfe9fd0a9ca4d6 100755 (executable)
@@ -14,7 +14,7 @@ fi
 
 cd configs
 
-for dir in $PREFIX.* recursor-service
+for dir in $PREFIX.* recursor-service recursor-service2
 do
        svc -d $dir
        svc -k $dir