4384. [bug] Change 4256 accidentally disabled logging of the

rndc command. [RT #42654]

(cherry picked from commit 948fe5822b)
This commit is contained in:
Mark Andrews
2016-06-18 00:10:51 +10:00
parent 6d79461e07
commit c3ff4e9f8f
3 changed files with 59 additions and 23 deletions

View File

@@ -24,7 +24,9 @@ DIGCMD="$DIG $DIGOPTS @10.53.0.2 -p 5300"
RNDCCMD="$RNDC -s 10.53.0.2 -p 9953 -c ../common/rndc.conf"
status=0
n=0
n=`expr $n + 1`
echo "I:preparing"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
@@ -44,19 +46,22 @@ status=`expr $status + $ret`
echo "I:rndc freeze"
$RNDCCMD freeze | sed 's/^/I:ns2 /'
echo "I:checking zone was dumped"
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
grep "addition 1" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking journal file is still present"
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
[ -s ns2/nil.db.jnl ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking zone not writable"
n=`expr $n + 1`
echo "I:checking zone not writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END && ret=1
server 10.53.0.2
@@ -72,7 +77,8 @@ status=`expr $status + $ret`
echo "I:rndc thaw"
$RNDCCMD thaw | sed 's/^/I:ns2 /'
echo "I:checking zone now writable"
n=`expr $n + 1`
echo "I:checking zone now writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
server 10.53.0.2
@@ -88,19 +94,22 @@ echo "I:rndc sync"
ret=0
$RNDCCMD sync nil | sed 's/^/I:ns2 /'
echo "I:checking zone was dumped"
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
grep "addition 3" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking journal file is still present"
n=`expr $n + 1`
echo "I:checking journal file is still present ($n)"
ret=0
[ -s ns2/nil.db.jnl ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking zone is still writable"
n=`expr $n + 1`
echo "I:checking zone is still writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
server 10.53.0.2
@@ -113,23 +122,27 @@ $DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:rndc sync -clean"
ret=0
$RNDCCMD sync -clean nil | sed 's/^/I:ns2 /'
echo "I:checking zone was dumped"
n=`expr $n + 1`
echo "I:checking zone was dumped ($n)"
ret=0
grep "addition 4" ns2/nil.db > /dev/null 2>&1 || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking journal file is deleted"
n=`expr $n + 1`
echo "I:checking journal file is deleted ($n)"
ret=0
[ -s ns2/nil.db.jnl ] && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking zone is still writable"
n=`expr $n + 1`
echo "I:checking zone is still writable ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
server 10.53.0.2
@@ -142,7 +155,8 @@ $DIGCMD text4.nil. TXT | grep 'addition 4' >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking other journal files not removed"
n=`expr $n + 1`
echo "I:checking other journal files not removed ($n)"
ret=0
[ -s ns2/other.db.jnl ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
@@ -151,20 +165,23 @@ status=`expr $status + $ret`
echo "I:cleaning all zones"
$RNDCCMD sync -clean | sed 's/^/I:ns2 /'
echo "I:checking all journals removed"
n=`expr $n + 1`
echo "I:checking all journals removed ($n)"
ret=0
[ -s ns2/nil.db.jnl ] && ret=1
[ -s ns2/other.db.jnl ] && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that freezing static zones is not allowed"
n=`expr $n + 1`
echo "I:checking that freezing static zones is not allowed ($n)"
ret=0
$RNDCCMD freeze static 2>&1 | grep 'not dynamic' > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that journal is removed when serial is changed before thaw"
n=`expr $n + 1`
echo "I:checking that journal is removed when serial is changed before thaw ($n)"
ret=0
sleep 1
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
@@ -195,7 +212,8 @@ $DIGCMD frozen.other. TXT | grep 'frozen addition' >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that journal is kept when ixfr-from-differences is in use"
n=`expr $n + 1`
echo "I:checking that journal is kept when ixfr-from-differences is in use ($n)"
ret=0
$NSUPDATE -p 5300 -k ns2/session.key > /dev/null 2>&1 <<END || ret=1
server 10.53.0.2
@@ -225,13 +243,15 @@ $DIGCMD frozen.nil. TXT | grep 'frozen addition' >/dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test using second key"
n=`expr $n + 1`
echo "I:test using second key($n)"
ret=0
$RNDC -s 10.53.0.2 -p 9953 -c ns2/secondkey.conf status > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test 'rndc dumpdb' on a empty cache"
n=`expr $n + 1`
echo "I:test 'rndc dumpdb' on a empty cache ($n)"
ret=0
$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf dumpdb > /dev/null || ret=1
for i in 1 2 3 4 5 6 7 8 9
@@ -245,20 +265,23 @@ done
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:testing rndc with null command"
n=`expr $n + 1`
echo "I:testing rndc with null command ($n)"
ret=0
$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:testing rndc with unknown control channel command"
n=`expr $n + 1`
echo "I:testing rndc with unknown control channel command ($n)"
ret=0
$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf obviouslynotacommand >/dev/null 2>&1 && ret=1
# rndc: 'obviouslynotacommand' failed: unknown command
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:testing rndc with querylog command"
n=`expr $n + 1`
echo "I:testing rndc with querylog command ($n)"
ret=0
# first enable it with querylog on option
$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf querylog on >/dev/null 2>&1 || ret=1
@@ -275,14 +298,16 @@ grep "query: foo9876.bind CH TXT" ns3/named.run > /dev/null && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:testing rndc with a token containing a space"
n=`expr $n + 1`
echo "I:testing rndc with a token containing a space ($n)"
ret=0
$RNDC -s 10.53.0.4 -p 9953 -c ../common/rndc.conf flush '"view with a space"' 2>&1 > rndc.output || ret=1
grep "not found" rndc.output > /dev/null && ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test 'rndc reconfig' with a broken config"
n=`expr $n + 1`
echo "I:test 'rndc reconfig' with a broken config ($n)"
ret=0
$RNDC -s 10.53.0.3 -p 9953 -c ../common/rndc.conf reconfig > /dev/null || ret=1
sleep 1
@@ -297,5 +322,13 @@ sleep 1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:verify that the full command is logged ($n)"
ret=0
$RNDCCMD null with extra arguments > /dev/null 2>&1
grep "received control channel command 'null with extra arguments'" ns2/named.run > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
[ $status -eq 0 ] || exit 1