]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[rt46602] Add $SEDPORTS variable to help with @PORT@ and @CONTROLPORT@ replacement
authorOndřej Surý <ondrej@sury.org>
Wed, 18 Oct 2017 13:11:08 +0000 (15:11 +0200)
committerStephen Morris <stephen@isc.org>
Fri, 16 Feb 2018 14:57:51 +0000 (14:57 +0000)
bin/tests/system/allow_query/tests.sh
bin/tests/system/getopts.sh
bin/tests/system/serve-stale/setup.sh
bin/tests/system/serve-stale/tests.sh

index 9c76b2ef6cc99bf53dc5cf973b89b6ddfbc5606a..7cfbdbbd6d7b52b5d55d7628b04469d3ee4cc799 100644 (file)
@@ -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
 
index 08fd8b7351aaffdb0b897095d215c3ba26c0df73..cd8d5b0e14394c6b8d44bcb2061e5a49fe55f29b 100644 (file)
@@ -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"
index c709808b92fc59266d7d8bf1d180c3da8e50b2a0..4e9363967de5679b1126dc70b0f430c60e9df185 100644 (file)
@@ -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
index 25b8041cb504907512d4d7e6bb581c3d7893ebc4..1cd8151193c07654c346d197515bb1269bae1de0 100755 (executable)
@@ -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`