]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix logging long named command lines
authorMichał Kępień <michal@isc.org>
Fri, 29 Nov 2019 08:06:41 +0000 (09:06 +0100)
committerMichał Kępień <michal@isc.org>
Fri, 29 Nov 2019 08:06:41 +0000 (09:06 +0100)
The saved_command_line buffer in bin/named/main.c is 8192 bytes long.
The size of libisc's internal logging buffer (defined by the value of
the LOG_BUFFER_SIZE constant in lib/isc/log.c) is also 8192 bytes.
Since the buffer containing the ellipsis is passed as the last argument
to isc_log_write() and the buffer containing the potentially trimmed
named command line (saved_command_line) is passed as the second argument
in the same isc_log_write() call, it may happen that saved_command_line
will exhaust all available space in libisc's internal logging buffer, in
which case the ellipsis will be elided from the output.

Make saved_command_line 4096 bytes long as that value is arguably also
large enough for any reasonable use case and at the same time it ensures
ellipsis will always be printed for excessively long named command
lines.

bin/named/main.c
bin/tests/system/runtime/tests.sh

index 1716de3532d123fc42f5472969caa1f74b40ec38..df9ec70f3d5ac3d81d1a19e009b0bcc8e116a45f 100644 (file)
@@ -116,7 +116,7 @@ LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month;
 static bool    want_stats = false;
 static char            program_name[NAME_MAX] = "named";
 static char            absolute_conffile[PATH_MAX];
-static char            saved_command_line[8192] =  { 0 };
+static char            saved_command_line[4096] = { 0 };
 static char            ellipsis[5] = { 0 };
 static char            version[512];
 static unsigned int    maxsocks = 0;
index f65ad20b85ffa719ad9f311f27728e5f1b67137e..e43e96e0ba55daa6b47186180235ea31c0621d27 100644 (file)
@@ -191,8 +191,7 @@ LONG_CMD_LINE=$(cat long-cmd-line)
 # shellcheck disable=SC2086
 (cd ns2 && $NAMED $LONG_CMD_LINE -c "named-alt7.conf" -g > named$n.run 2>&1 &)
 wait_for_named "running$" ns2/named$n.run || ret=1
-#grep "running as.*\.\.\.$" ns2/named$n.run > /dev/null || ret=1
-echo_i "skipped - the ellipsis is currently not printed"
+grep "running as.*\.\.\.$" ns2/named$n.run > /dev/null || ret=1
 kill_named ns2/named.pid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))