]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test named logs cmd line as expected
authorJoey Salazar <joey@isc.org>
Thu, 10 Jan 2019 13:01:54 +0000 (21:01 +0800)
committerEvan Hunt <each@isc.org>
Thu, 14 Mar 2019 21:43:45 +0000 (14:43 -0700)
Test named logs control characters, special characters and large cmd line respectively as octal escaped, special escaped and elipsis

bin/tests/system/runtime/clean.sh
bin/tests/system/runtime/ctrl-char-dir-name [new file with mode: 0644]
bin/tests/system/runtime/ns2/named-alt7.conf.in [new file with mode: 0644]
bin/tests/system/runtime/tests.sh
util/copyrights

index 1be52649b00e5562a11337363e6d733a219b36a6..705e88e0051195f010c6d6db7912739f04741da5 100644 (file)
@@ -18,3 +18,5 @@ rm -f rndc.out*
 [ -d ns2/nope ] && chmod 755 ns2/nope
 rm -rf ns2/nope
 rm -f ns*/managed-keys.bind*
+rm -rf "ns2/`cat ctrl-char-dir-name`"
+rm -rf "ns2/$;"
diff --git a/bin/tests/system/runtime/ctrl-char-dir-name b/bin/tests/system/runtime/ctrl-char-dir-name
new file mode 100644 (file)
index 0000000..4ce1650
--- /dev/null
@@ -0,0 +1 @@
+\7f\e
\ No newline at end of file
diff --git a/bin/tests/system/runtime/ns2/named-alt7.conf.in b/bin/tests/system/runtime/ns2/named-alt7.conf.in
new file mode 100644 (file)
index 0000000..8b8a20a
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+options {
+       port @PORT@;
+       pid-file "named7.pid";
+       listen-on { 10.53.0.2; };
+       listen-on-v6 { fd92:7065:b8e:ffff::2; };
+};
index 343adebc6b1bed51bb4ff03d9a5960736dc12c99..31fe17cad5ff21b8506764f0ac9c7ddea588247c 100644 (file)
@@ -113,5 +113,51 @@ cd ..
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "checking that named logs control characters in octal notation ($n)"
+ret=0
+SPEC_DIR=`cat ctrl-char-dir-name`
+mkdir "ns2/${SPEC_DIR}"
+copy_setports ns2/named-alt7.conf.in "ns2/${SPEC_DIR}/named.conf"
+cd ns2
+$NAMED -c "${SPEC_DIR}/named.conf" -d 99 -g > named6.run 2>&1 &
+sleep 2
+grep 'running as.*\\177\\033' named6.run > /dev/null || ret=1
+pid=`cat named7.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
+cd ..
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
+n=`expr $n + 1`
+echo_i "checking that named escapes special characters in the logs ($n)"
+ret=0
+SPEC_DIR="$;"
+mkdir "ns2/${SPEC_DIR}"
+copy_setports ns2/named-alt7.conf.in "ns2/${SPEC_DIR}/named.conf"
+cd ns2
+$NAMED -c "${SPEC_DIR}/named.conf" -d 99 -g > named7.run 2>&1 &
+sleep 2
+grep 'running as.*\\$\\;' named7.run > /dev/null || ret=1
+pid=`cat named7.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
+cd ..
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
+n=`expr $n + 1`
+echo_i "checking that named logs an ellipsis when the command line is larger than 8k bytes ($n)"
+ret=0
+SPEC_DIR=`yes | head -10000 | tr -d '\n'`
+cd ns2
+$NAMED -c "${SPEC_DIR}/named.conf" -d 99 -g > named8.run 2>&1 &
+sleep 2
+grep "running as.*\.\.\.$" named8.run > /dev/null || ret=1
+pid=`cat named7.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
+cd ..
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1
index 5ad20e05770c814f98427fdc208f57bb3c582f43..bdf6d6286f43e057000f9de2c680bcc3dbc1514a 100644 (file)
 ./bin/tests/system/runsequential.sh            SH      2018,2019
 ./bin/tests/system/runtime/README              TXT.BRIEF       2014,2016,2018,2019
 ./bin/tests/system/runtime/clean.sh            SH      2014,2015,2016,2017,2018,2019
+./bin/tests/system/runtime/ctrl-char-dir-name  X       2019
 ./bin/tests/system/runtime/setup.sh            SH      2015,2016,2017,2018,2019
 ./bin/tests/system/runtime/tests.sh            SH      2014,2015,2016,2017,2018,2019
 ./bin/tests/system/send.pl                     PERL    2001,2004,2007,2011,2012,2016,2018,2019