]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Recursor: add an extensive test for auth-zones 2730/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 4 Sep 2015 08:28:31 +0000 (10:28 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 4 Sep 2015 08:57:53 +0000 (10:57 +0200)
regression-tests.recursor/auth-zones/command [new file with mode: 0755]
regression-tests.recursor/auth-zones/description [new file with mode: 0644]
regression-tests.recursor/auth-zones/expected_result [new file with mode: 0644]
regression-tests.recursor/config.sh

diff --git a/regression-tests.recursor/auth-zones/command b/regression-tests.recursor/auth-zones/command
new file mode 100755 (executable)
index 0000000..8b1819d
--- /dev/null
@@ -0,0 +1,4 @@
+cleandig host1.auth-zone.example.net. A | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+cleandig host1.auth-zone.example.net. AAAA | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+cleandig host2.auth-zone.example.net. A | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
+cleandig host3.auth-zone.example.net. A | sed 's/\(.*\tIN\t[A-Z0-9]\+\t\)\([0-9]\+\)/\13600/'
diff --git a/regression-tests.recursor/auth-zones/description b/regression-tests.recursor/auth-zones/description
new file mode 100644 (file)
index 0000000..52478b2
--- /dev/null
@@ -0,0 +1,3 @@
+Test 3 direct queries for data in an auth-zone. 2 records that are in-zone,
+one that is a CNAME to a name inside another auth-zone and a final one that is a
+CNAME to a record in a zone where the recursor is not authoritative for.
diff --git a/regression-tests.recursor/auth-zones/expected_result b/regression-tests.recursor/auth-zones/expected_result
new file mode 100644 (file)
index 0000000..3534b98
--- /dev/null
@@ -0,0 +1,14 @@
+0      host1.auth-zone.example.net.    IN      A       3600    127.0.0.55
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='host1.auth-zone.example.net.', qtype=A
+0      host1.auth-zone.example.net.    IN      AAAA    3600    2001:db8::1:45ba
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='host1.auth-zone.example.net.', qtype=AAAA
+0      host1.another-auth-zone.example.net.    IN      A       3600    127.0.0.56
+0      host2.auth-zone.example.net.    IN      CNAME   3600    host1.another-auth-zone.example.net.
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='host2.auth-zone.example.net.', qtype=A
+0      host1.not-auth-zone.example.net.        IN      A       3600    127.0.0.57
+0      host3.auth-zone.example.net.    IN      CNAME   3600    host1.not-auth-zone.example.net.
+Rcode: 0, RD: 1, QR: 1, TC: 0, AA: 0, opcode: 0
+Reply to question for qname='host3.auth-zone.example.net.', qtype=A
index 65b8d4a4f909bf90f3ddc4347e6452f4850a5022..bad16460cac333b9582d124b1dde89eaff9c2695 100755 (executable)
@@ -81,6 +81,8 @@ hijackme.example.net.    3600 IN NS  ns.hijackme.example.net.
 ns.hijackme.example.net. 3600 IN A   $PREFIX.20
 hijacker.example.net.    3600 IN NS  ns.hijacker.example.net.
 ns.hijacker.example.net. 3600 IN A   $PREFIX.21
+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
 EOF
 
 mkdir $PREFIX.11
@@ -328,6 +330,37 @@ www.hijackme.example.net.  20 IN A   192.0.2.21
 
 EOF
 
+# Used for the auth-zones test, to test a CNAME inside an auth-zone to a name
+# outside of and auth-zone
+mkdir $PREFIX.23
+cat > $PREFIX.23/not-auth-zone.example.net.zone <<EOF
+not-auth-zone.example.net. 3600 IN SOA $SOA
+not-auth-zone.example.net. 20 IN NS ns.not-auth-zone.example.net.
+
+ns.not-auth-zone.example.net. 20 IN  A $PREFIX.23
+host1.not-auth-zone.example.net. 20 IN  A 127.0.0.57
+EOF
+
+# For the auth-zones test
+cat > recursor-service/auth-zone.example.net.zone <<EOF
+auth-zone.example.net. 3600 IN SOA $SOA
+auth-zone.example.net. 20 IN NS localhost.example.net.
+
+host1.auth-zone.example.net. 20 IN A 127.0.0.55
+host1.auth-zone.example.net. 20 IN AAAA 2001:DB8::1:45BA
+
+host2.auth-zone.example.net. 20 IN CNAME host1.another-auth-zone.example.net.
+
+host3.auth-zone.example.net. 20 IN CNAME host1.not-auth-zone.example.net.
+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.
+
+host1.another-auth-zone.example.net. 20 IN A 127.0.0.56
+EOF
+
 for dir in $PREFIX.*
 do
     cat > $dir/pdns.conf <<EOF
@@ -372,6 +405,8 @@ EOF
     ln -s ../run-auth $dir/run
 done
 
-cat > recursor-service/recursor.conf << EOF
-socket-dir=$(pwd)/recursor-service
-EOF
\ No newline at end of file
+cat > recursor-service/recursor.conf <<EOF
+socket-dir=$(pwd)/recursor-serviceS
+auth-zones=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