]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix rpzrecurse test
authorEvan Hunt <each@isc.org>
Thu, 24 Jan 2019 17:21:35 +0000 (09:21 -0800)
committerEvan Hunt <each@isc.org>
Sat, 26 Jan 2019 00:15:08 +0000 (16:15 -0800)
- backport from v9_12 changes to enable rpzrecurse test to
  suspend and resume servers on win32
- use rndc to stop servers

CHANGES
bin/named/control.c
bin/tests/system/conf.sh.in
bin/tests/system/conf.sh.win32
bin/tests/system/rpzrecurse/clean.sh
bin/tests/system/rpzrecurse/ns4/named.conf.in
bin/tests/system/rpzrecurse/tests.sh
win32utils/Configure

diff --git a/CHANGES b/CHANGES
index b50a65760c1860049726c6b994383d4568ac8be5..7cadfc0164a0998cfa6af2bdaba1efaf2f66ddb4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 5039.  [bug]           Named could fail to preserve owner name case of new
                        RRset. [GL #420]
 
+4887.  [test]          Enable the rpzrecurse test to run on Windows.
+                       [RT #47093]
+
        --- 9.11.5 released ---
 
        --- 9.11.5rc1 released ---
index 478b54aece8c50efc718f8078ef22f24441810bd..df23c265076c9dde5726d1b0d1fbf060867a3ffd 100644 (file)
@@ -116,7 +116,8 @@ ns_control_docommand(isccc_sexpr_t *message, bool readonly,
        /*
         * Compare the 'command' parameter against all known control commands.
         */
-       if (command_compare(command, NS_COMMAND_NULL) ||
+       if ((command_compare(command, NS_COMMAND_NULL) &&
+            strlen(cmdline) == 4) ||
            command_compare(command, NS_COMMAND_STATUS))
        {
                log_level = ISC_LOG_DEBUG(1);
index 145e9ec4497817dc9772657ccdf99a1623f66b33..2236f0a151477123d01cb02d8e5243569ef3bf8e 100644 (file)
@@ -159,6 +159,8 @@ else
         TESTSOCK6=false
 fi
 
+# Windows process management leave empty
+PSSUSPEND=
 
 PYTHON=@PYTHON@
 
@@ -386,6 +388,7 @@ export PIPEQUERIES
 export PK11DEL
 export PK11GEN
 export PK11LIST
+export PSSUSPEND
 export PYTHON
 export RANDFILE
 export RESOLVE
index 9921cfc08d1b79d949b5e4893f0dfde27633e173..87d2fc84fe5b804d83cc1ff236551d37e335bd8a 100644 (file)
@@ -169,7 +169,11 @@ else
         TESTSOCK6=false
 fi
 
-
+#
+# PsSuspend is part of PSTools and can be downloaded from
+# https://download.sysinternals.com/files/PSTools.zip
+#
+PSSUSPEND=@PSSUSPEND@
 PYTHON=@PYTHON@
 
 #
@@ -367,6 +371,7 @@ export PIPEQUERIES
 export PK11DEL
 export PK11GEN
 export PK11LIST
+export PSSUSPEND
 export PYTHON
 export RANDFILE
 export RESOLVE
index de97959220a58901f2613a395e08bf86060e7a4f..188164de06d746843cabf396fa70b36448e8d31a 100644 (file)
@@ -16,14 +16,10 @@ rm -f ns*/named.memstats
 rm -f ns*/*.run
 rm -f ns*/*core *core
 rm -f ns*/named.conf
-
 rm -f ns2/*.local
 rm -f ns2/*.queries
 rm -f ns2/named.[0-9]*.conf
 rm -f ns2/named.conf.header
-
 rm -f ns3/named2.conf
-
 rm -f ans*/*.run
-
 rm -f ns*/session.key
index 24e5115ae6436159bbd82d17f43d28bd0ae0792c..707b5778063ca3612427ad23223cd9f71a42f021 100644 (file)
@@ -23,4 +23,13 @@ options {
        recursion no;
 };
 
+key rndc_key {
+       secret "1234abcd8765";
+       algorithm hmac-sha256;
+};
+
+controls {
+       inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
+};
+
 zone "child.example.tld" { type master; file "child.example.db"; };
index b8615fb9e10b49dee7c073f4061697b3d924762e..eec817659db3d97a0537389ff5de316e08d7763d 100644 (file)
@@ -20,7 +20,7 @@ run_server() {
     TESTNAME=$1
 
     echo_i "stopping resolver"
-    $PERL $SYSTEMTESTTOP/stop.pl rpzrecurse ns2
+    $PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} rpzrecurse ns2
 
     sleep 1
 
@@ -168,17 +168,16 @@ echo_i "running dig to cache CNAME record (${t})"
 $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org CNAME > dig.out.${t}
 sleep 1
 echo_i "suspending authority server"
+PID=`cat ns1/named.pid`
 if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
+    $PSSUSPEND $PID
 else
-    PID=`cat ns1/named.pid`
+    kill -TSTP $PID
 fi
-kill -TSTP $PID
 echo_i "adding an NSDNAME policy"
 cp ns2/db.6a.00.policy.local ns2/saved.policy.local
 cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /' | cat_i
 sleep 1
 t=`expr $t + 1`
 echo_i "running dig to follow CNAME (blocks, so runs in the background) (${t})"
@@ -186,16 +185,15 @@ $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org A > dig.out.${t} &
 sleep 1
 echo_i "removing the NSDNAME policy"
 cp ns2/db.6c.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /' | cat_i
 sleep 1
 echo_i "resuming authority server"
+PID=`cat ns1/named.pid`
 if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
+    $PSSUSPEND -r $PID
 else
-    PID=`cat ns1/named.pid`
+    kill -CONT $PID
 fi
-kill -CONT $PID
 for n in 1 2 3 4 5 6 7 8 9; do
     sleep 1
     [ -s dig.out.${t} ] || continue
@@ -215,16 +213,15 @@ echo_i "running dig to cache CNAME record (${t})"
 $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org CNAME > dig.out.${t}
 sleep 1
 echo_i "suspending authority server"
+PID=`cat ns1/named.pid`
 if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
+    $PSSUSPEND $PID
 else
-    PID=`cat ns1/named.pid`
+    kill -TSTP $PID
 fi
-kill -TSTP $PID
 echo_i "adding an NSDNAME policy"
 cp ns2/db.6b.00.policy.local ns2/db.6a.00.policy.local
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reload 6a.00.policy.local 2>&1 | sed 's/^/I:ns2 /' | cat_i
 sleep 1
 t=`expr $t + 1`
 echo_i "running dig to follow CNAME (blocks, so runs in the background) (${t})"
@@ -232,16 +229,15 @@ $DIG $DIGOPTS @10.53.0.2 -p ${PORT} www.test.example.org A > dig.out.${t} &
 sleep 1
 echo_i "removing the policy zone"
 cp ns2/named.default.conf ns2/named.conf
-$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns2 /'
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns2 /' | cat_i
 sleep 1
 echo_i "resuming authority server"
+PID=`cat ns1/named.pid`
 if [ "$CYGWIN" ]; then
-    WINPID=`cat ns1/named.pid`
-    PID=`ps | sed 's/^..//' | awk '$4 == '$WINPID | awk '{print $1}'`
+    $PSSUSPEND -r $PID
 else
-    PID=`cat ns1/named.pid`
+    kill -CONT $PID
 fi
-kill -CONT $PID
 for n in 1 2 3 4 5 6 7 8 9; do
     sleep 1
     [ -s dig.out.${t} ] || continue
index ff596b70fa0951d621b9d9b689119a70ef508fa1..ad99f8997bf115d63d4a519b345fd73cb209a143 100644 (file)
@@ -469,6 +469,7 @@ my @substvar = ("BIND9_VERSION",
                 "PLATFORM",
                 "PKCS11_TOOLS",
                 "prefix",
+                "PSSUSPEND",
                 "PYTHON",
                 "PYTHON_INSTALL_DIR",
                 "VCREDIST_PATH"),
@@ -536,6 +537,7 @@ my @withlist = ("aes",
                 "openssl",
                 "libxml2",
                 "pkcs11",
+                "pssuspend",
                 "python",
                 "readline",
                 "samples",
@@ -594,6 +596,7 @@ my @help = (
 "  with-gssapi[=PATH]    build with MIT KfW GSSAPI yes|no|path\n",
 "  with-libxml2[=PATH]   build with libxml2 library yes|no|path\n",
 "  with-geoip[=PATH]     build with GeoIP support yes|no|path\n",
+"  with-pssuspend[=COMMAND] specify pssuspend command\n",
 "  with-python[=COMMAND] specify python interpreter python|command\n",
 "  with-readline[=PATH]  build with readline library support yes|no|path\n",
 "  with-idn[=PATH]       build with IDN kit support yes|no|path\n",
@@ -644,6 +647,8 @@ my $use_geoip = "no";
 my $geoip_path = "";
 my $use_libxml2 = "auto";
 my $libxml2_path = "..\\..\\";
+my $with_pssuspend = "no";
+my $pssuspend_command = "pssuspend.exe";
 my $use_python = "auto";
 my $python_command = "python.exe";
 my $use_readline = "no";
@@ -1000,6 +1005,14 @@ sub mywith {
                 $zlib_path = $val;
             }
         }
+    } elsif ($key =~ /^pssuspend$/i) {
+       if ($val =~ /^no$/i) {
+           $with_pssuspend = "no";
+       } else {
+           if ($val !~ /^yes$/i) {
+               $pssuspend_command = $val;
+           }
+        }
     } elsif ($key =~ /^python$/i) {
         if ($val =~ /^no$/i) {
             $use_python = "no";
@@ -1228,6 +1241,11 @@ if ($verbose) {
     } else {
         print "zlib-path: $zlib_path\n";
     }
+    if ($with_pssuspend eq "no") {
+        print "pssuspend: disabled\n";
+    } else {
+        print "pssuspend-command: $pssuspend_command\n";
+    }
     if ($use_python eq "no") {
         print "python: disabled\n";
     } else {
@@ -2611,6 +2629,10 @@ if ($use_zlib eq "no") {
     $configdll{"ZLIB_DLL"} = "$zlib_dll";
 }
 
+if ($with_pssuspend ne "no") {
+    $configvar{"PSSUSPEND"} = "$pssuspend_command";
+}
+
 # with-python
 if ($use_python eq "no") {
     if ($verbose) {