diff --git a/CHANGES b/CHANGES index ee5440579b..78bdda5dac 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4384. [bug] Change 4256 accidentally disabled logging of the + rndc command. [RT #42654] + 4379. [bug] An INSIST could be triggered if a zone contains RRSIG records with expiry fields that loop using serial number arithmetic. [RT #40571] diff --git a/bin/named/control.c b/bin/named/control.c index 3dc43fcb7c..1baf878d66 100644 --- a/bin/named/control.c +++ b/bin/named/control.c @@ -131,7 +131,7 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) { isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_CONTROL, log_level, "received control channel command '%s'", - command); + cmdline); if (command_compare(command, NS_COMMAND_RELOAD)) { result = ns_server_reloadcommand(ns_g_server, lex, text); diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh index 77a44ebe8a..43d5083cae 100644 --- a/bin/tests/system/rndc/tests.sh +++ b/bin/tests/system/rndc/tests.sh @@ -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 < /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 < /dev/null 2>&1 < /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 </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 </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 </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 < /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 @@ -253,7 +275,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:test 'rndc reload' on a zone with include files" +n=`expr $n + 1` +echo "I:test 'rndc reload' on a zone with include files ($n)" ret=0 grep "incl/IN: skipping load" ns2/named.run > /dev/null && ret=1 loads=`grep "incl/IN: starting load" ns2/named.run | wc -l` @@ -281,7 +304,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-md5" +n=`expr $n + 1` +echo "I:testing rndc with hmac-md5 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9951 -c ns4/key1.conf status > /dev/null 2>&1 || ret=1 for i in 2 3 4 5 6 @@ -291,7 +315,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-sha1" +n=`expr $n + 1` +echo "I:testing rndc with hmac-sha1 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9952 -c ns4/key2.conf status > /dev/null 2>&1 || ret=1 for i in 1 3 4 5 6 @@ -301,7 +326,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-sha224" +n=`expr $n + 1` +echo "I:testing rndc with hmac-sha224 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9953 -c ns4/key3.conf status > /dev/null 2>&1 || ret=1 for i in 1 2 4 5 6 @@ -311,7 +337,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-sha256" +n=`expr $n + 1` +echo "I:testing rndc with hmac-sha256 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9954 -c ns4/key4.conf status > /dev/null 2>&1 || ret=1 for i in 1 2 3 5 6 @@ -321,7 +348,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-sha384" +n=`expr $n + 1` +echo "I:testing rndc with hmac-sha384 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9955 -c ns4/key5.conf status > /dev/null 2>&1 || ret=1 for i in 1 2 3 4 6 @@ -331,7 +359,8 @@ done if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -echo "I:testing rndc with hmac-sha512" +n=`expr $n + 1` +echo "I:testing rndc with hmac-sha512 ($n)" ret=0 $RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > /dev/null 2>&1 || ret=1 for i in 1 2 3 4 5 @@ -341,20 +370,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.4 -p 9956 -c ns4/key6.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.4 -p 9956 -c ns4/key6.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.4 -p 9956 -c ns4/key6.conf querylog on >/dev/null 2>&1 || ret=1 @@ -371,14 +403,16 @@ grep "query: foo9876.bind CH TXT" ns4/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 9956 -c ns4/key6.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 @@ -393,5 +427,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