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.10.8rc1~84^2~48 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=76848ca9d4943ccb00a56a3c7e887ecb94569999;p=thirdparty%2Fbind9.git [rt46602] Add $SEDPORTS variable to help with @PORT@ and @CONTROLPORT@ replacement (cherry picked from commit e6802badc07062532196e51b82c21d3d9d8f56c5) (cherry picked from commit d37a52cc56c4156f1f1bebf96f0da6770c4b8bc4) --- diff --git a/bin/tests/system/allow_query/tests.sh b/bin/tests/system/allow_query/tests.sh index 60e5974cb7a..ded4f948d89 100644 --- a/bin/tests/system/allow_query/tests.sh +++ b/bin/tests/system/allow_query/tests.sh @@ -84,7 +84,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 @@ -98,7 +98,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 @@ -112,7 +112,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 @@ -126,7 +126,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 @@ -140,7 +140,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 @@ -154,7 +154,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 @@ -168,7 +168,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 @@ -183,7 +183,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 @@ -197,7 +197,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 @@ -211,7 +211,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 @@ -225,7 +225,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 @@ -242,7 +242,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 @@ -256,7 +256,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 @@ -270,7 +270,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 @@ -284,7 +284,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 @@ -298,7 +298,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 @@ -312,7 +312,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 @@ -326,7 +326,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 @@ -340,7 +340,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 @@ -354,7 +354,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 @@ -368,7 +368,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 @@ -382,7 +382,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 @@ -396,7 +396,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 @@ -410,7 +410,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 @@ -424,7 +424,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 @@ -442,7 +442,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 @@ -566,7 +566,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 @@ -580,7 +580,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 @@ -594,7 +594,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 @@ -608,7 +608,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 @@ -622,7 +622,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"