From: Ondřej Surý Date: Wed, 18 Oct 2017 13:11:08 +0000 (+0200) Subject: [rt46602] Add $SEDPORTS variable to help with @PORT@ and @CONTROLPORT@ replacement X-Git-Tag: v9.13.0~158^2~51 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6802badc07062532196e51b82c21d3d9d8f56c5;p=thirdparty%2Fbind9.git [rt46602] Add $SEDPORTS variable to help with @PORT@ and @CONTROLPORT@ replacement --- diff --git a/bin/tests/system/allow_query/tests.sh b/bin/tests/system/allow_query/tests.sh index 9c76b2ef6cc..7cfbdbbd6d7 100644 --- a/bin/tests/system/allow_query/tests.sh +++ b/bin/tests/system/allow_query/tests.sh @@ -76,7 +76,7 @@ status=`expr $status + $ret` # Test 2 - explicit any, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named02.conf.in > ns2/named.conf +$SEDPORTS < ns2/named02.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -90,7 +90,7 @@ status=`expr $status + $ret` # Test 3 - none, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named03.conf.in > ns2/named.conf +$SEDPORTS < ns2/named03.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -104,7 +104,7 @@ status=`expr $status + $ret` # Test 4 - address allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named04.conf.in > ns2/named.conf +$SEDPORTS < ns2/named04.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -118,7 +118,7 @@ status=`expr $status + $ret` # Test 5 - address not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named05.conf.in > ns2/named.conf +$SEDPORTS < ns2/named05.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -132,7 +132,7 @@ status=`expr $status + $ret` # Test 6 - address disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named06.conf.in > ns2/named.conf +$SEDPORTS < ns2/named06.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -146,7 +146,7 @@ status=`expr $status + $ret` # Test 7 - acl allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named07.conf.in > ns2/named.conf +$SEDPORTS < ns2/named07.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -160,7 +160,7 @@ status=`expr $status + $ret` # Test 8 - acl not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named08.conf.in > ns2/named.conf +$SEDPORTS < ns2/named08.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -175,7 +175,7 @@ status=`expr $status + $ret` # Test 9 - acl disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named09.conf.in > ns2/named.conf +$SEDPORTS < ns2/named09.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -189,7 +189,7 @@ status=`expr $status + $ret` # Test 10 - key allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named10.conf.in > ns2/named.conf +$SEDPORTS < ns2/named10.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -203,7 +203,7 @@ status=`expr $status + $ret` # Test 11 - key not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named11.conf.in > ns2/named.conf +$SEDPORTS < ns2/named11.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -217,7 +217,7 @@ status=`expr $status + $ret` # Test 12 - key disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named12.conf.in > ns2/named.conf +$SEDPORTS < ns2/named12.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -234,7 +234,7 @@ status=`expr $status + $ret` n=20 # Test 21 - views default, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named21.conf.in > ns2/named.conf +$SEDPORTS < ns2/named21.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -248,7 +248,7 @@ status=`expr $status + $ret` # Test 22 - views explicit any, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named22.conf.in > ns2/named.conf +$SEDPORTS < ns2/named22.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -262,7 +262,7 @@ status=`expr $status + $ret` # Test 23 - views none, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named23.conf.in > ns2/named.conf +$SEDPORTS < ns2/named23.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -276,7 +276,7 @@ status=`expr $status + $ret` # Test 24 - views address allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named24.conf.in > ns2/named.conf +$SEDPORTS < ns2/named24.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -290,7 +290,7 @@ status=`expr $status + $ret` # Test 25 - views address not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named25.conf.in > ns2/named.conf +$SEDPORTS < ns2/named25.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -304,7 +304,7 @@ status=`expr $status + $ret` # Test 26 - views address disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named26.conf.in > ns2/named.conf +$SEDPORTS < ns2/named26.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -318,7 +318,7 @@ status=`expr $status + $ret` # Test 27 - views acl allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named27.conf.in > ns2/named.conf +$SEDPORTS < ns2/named27.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -332,7 +332,7 @@ status=`expr $status + $ret` # Test 28 - views acl not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named28.conf.in > ns2/named.conf +$SEDPORTS < ns2/named28.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -346,7 +346,7 @@ status=`expr $status + $ret` # Test 29 - views acl disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named29.conf.in > ns2/named.conf +$SEDPORTS < ns2/named29.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -360,7 +360,7 @@ status=`expr $status + $ret` # Test 30 - views key allowed, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named30.conf.in > ns2/named.conf +$SEDPORTS < ns2/named30.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -374,7 +374,7 @@ status=`expr $status + $ret` # Test 31 - views key not allowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named31.conf.in > ns2/named.conf +$SEDPORTS < ns2/named31.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -388,7 +388,7 @@ status=`expr $status + $ret` # Test 32 - views key disallowed, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named32.conf.in > ns2/named.conf +$SEDPORTS < ns2/named32.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -402,7 +402,7 @@ status=`expr $status + $ret` # Test 33 - views over options, views allow, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named33.conf.in > ns2/named.conf +$SEDPORTS < ns2/named33.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -416,7 +416,7 @@ status=`expr $status + $ret` # Test 34 - views over options, views disallow, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named34.conf.in > ns2/named.conf +$SEDPORTS < ns2/named34.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -434,7 +434,7 @@ n=40 # Test 41 - zone default, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named40.conf.in > ns2/named.conf +$SEDPORTS < ns2/named40.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -558,7 +558,7 @@ status=`expr $status + $ret` # Test 53 - zones over options, zones allow, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named53.conf.in > ns2/named.conf +$SEDPORTS < ns2/named53.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -572,7 +572,7 @@ status=`expr $status + $ret` # Test 54 - zones over options, zones disallow, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named54.conf.in > ns2/named.conf +$SEDPORTS < ns2/named54.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -586,7 +586,7 @@ status=`expr $status + $ret` # Test 55 - zones over views, zones allow, query allowed n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named55.conf.in > ns2/named.conf +$SEDPORTS < ns2/named55.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -600,7 +600,7 @@ status=`expr $status + $ret` # Test 56 - zones over views, zones disallow, query refused n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named56.conf.in > ns2/named.conf +$SEDPORTS < ns2/named56.conf.in > ns2/named.conf rndc_reload sleep 5 @@ -614,7 +614,7 @@ status=`expr $status + $ret` # Test 57 - zones over views, zones disallow, query refused (allow-query-on) n=`expr $n + 1` -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g;" < ns2/named57.conf.in > ns2/named.conf +$SEDPORTS < ns2/named57.conf.in > ns2/named.conf rndc_reload sleep 5 diff --git a/bin/tests/system/getopts.sh b/bin/tests/system/getopts.sh index 08fd8b7351a..cd8d5b0e143 100644 --- a/bin/tests/system/getopts.sh +++ b/bin/tests/system/getopts.sh @@ -14,7 +14,10 @@ while getopts "p:c:" flag; do case "$flag" in p) port=$OPTARG ;; c) controlport=$OPTARG ;; + -) break ;; *) exit 1 ;; esac done shift $(($OPTIND - 1)) + +SEDPORTS="sed -e s/@PORT@/${port}/g -e s/@CONTROLPORT@/${controlport}/g" diff --git a/bin/tests/system/serve-stale/setup.sh b/bin/tests/system/serve-stale/setup.sh index c709808b92f..4e9363967de 100644 --- a/bin/tests/system/serve-stale/setup.sh +++ b/bin/tests/system/serve-stale/setup.sh @@ -7,11 +7,11 @@ . ../getopts.sh -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g" < ns1/named1.conf.in > ns1/named.conf +$SEDPORTS < ns1/named1.conf.in > ns1/named.conf echo "${port}" > ns1/named.port -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g" < ans2/ans.pl.in > ans2/ans.pl +$SEDPORTS < ans2/ans.pl.in > ans2/ans.pl echo "${port}" > ans2/named.port -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g" < ns3/named.conf.in > ns3/named.conf +$SEDPORTS < ns3/named.conf.in > ns3/named.conf echo "${port}" > ns3/named.port diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh index 25b8041cb50..1cd8151193c 100755 --- a/bin/tests/system/serve-stale/tests.sh +++ b/bin/tests/system/serve-stale/tests.sh @@ -346,7 +346,7 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "updating ns1/named.conf ($n)" ret=0 -sed -e "s/@PORT@/${port}/g;s/@CONTROLPORT@/${controlport}/g" < ns1/named2.conf.in > ns1/named.conf +$SEDPORTS < ns1/named2.conf.in > ns1/named.conf if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret`