addzone system tests failing in Mac OS X
Summary
One of the addzone system test is failing consistently under Mac OS X. When adding a zone with escaped quotes, bind will respond OK and write an invalid configuration to the ns3/_default.nzf
file. This makes the test check that named restarts with multiple added zones
fails.
BIND version used
BIND 9.17.0 (Development Release) <id:2d74d88b47>
running on Darwin x86_64 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64
built by make with '--without-python' '--with-cmocka' 'PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig' 'KYUA=kyua'
compiled by CLANG 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)
compiled with OpenSSL version: OpenSSL 1.0.2s 28 May 2019
linked to OpenSSL version: OpenSSL 1.0.2s 28 May 2019
compiled with libxml2 version: 2.9.10
linked to libxml2 version: 20910
compiled with zlib version: 1.2.11
linked to zlib version: 1.2.11
threads support is enabled
default paths:
named configuration: /usr/local/etc/named.conf
rndc configuration: /usr/local/etc/rndc.conf
DNSSEC root key: /usr/local/etc/bind.keys
nsupdate session key: /usr/local/var/run/named/session.key
named PID file: /usr/local/var/run/named/named.pid
named lock file: /usr/local/var/run/named/named.lock
Steps to reproduce
- Clone the bind repository locally (master branch)
- Compile bind following the instructions found in the documentation
- Run the addzone system tests:
cd bin/tests/system ; sh run.sh addzone
What is the current bug behavior?
The test check that named restarts with multiple added zones
fails after an invalid configuration has been written in the ns3/_default.nzf file.
What is the expected correct behavior?
The test passes.
Relevant configuration files
All configuration is out of the box, no modifications are done.
Relevant logs and/or screenshots
Here is the output of the test runner (adding set -x in the relevant invocation of rndc):
I:addzone:check that named restarts with multiple added zones (56)
+ ret=0
+ bind9/bin/rndc/rndc -c ../common/rndc.conf -p 5309 -s 10.53.0.3 addzone test4.baz '{ type master; file "e.db"; };'
+ bind9/bin/rndc/rndc -c ../common/rndc.conf -p 5309 -s 10.53.0.3 addzone test5.baz '{ type master; file "e.db"; };'
+ bind9/bin/rndc/rndc -c ../common/rndc.conf -p 5309 -s 10.53.0.3 addzone '"test/.baz"' '{ type master; check-names ignore; file "e.db"; };'
+ bind9/bin/rndc/rndc -c ../common/rndc.conf -p 5309 -s 10.53.0.3 addzone '"test\".baz"' '{ type master; check-names ignore; file "e.db"; };'
+ /usr/local/bin/perl ../stop.pl addzone ns3
+ /usr/local/bin/perl ../start.pl --noclean --restart --port 5300 addzone ns3
I:addzone:Couldn't start server bind9/bin/named/named -D addzone-ns3 -X named.lock -m record,size,mctx -c named.conf -d 99 -g -U 4 >>named.run 2>&1 & echo $! (pid=11813)
I:addzone:failed
Here is the invalid _default.nzf
content when the test runs:
zone "test1.baz" { type master; file "e.db"; };
zone "test4.baz" { type master; file "e.db"; };
zone "test5.baz" { type master; file "e.db"; };
zone "test/.baz" { type master; check-names ignore; file "e.db"; };
zone "test".baz" { type master; check-names ignore; file "e.db"; };
As you can see, the culprit is this line:
bind9/bin/rndc/rndc -c ../common/rndc.conf -p 5309 -s 10.53.0.3 addzone '"test\".baz"' '{ type master; check-names ignore; file "e.db"; };'
Looks that there is something wrong with the parser when it encounters the escaping quote in my particular environment. I've tried a few rndc invocations to see the different behaviours. For example:
bind9/bin/rndc/rndc -c ./common/rndc.conf -p 5309 -s 10.53.0.3 addzone "\"test100\'.baz\" { type master; check-names ignore; file \"e.db\"; };"
bind9/bin/rndc/rndc -c ./common/rndc.conf -p 5309 -s 10.53.0.3 addzone "\"test100\'.baz\" { type master; check-names ignore; file \"e.db\"; };"
rndc: 'addzone' failed: already exists
bind9/bin/rndc/rndc -c ./common/rndc.conf -p 5309 -s 10.53.0.3 addzone "\"test100\\'.baz\" { type master; check-names ignore; file \"e.db\"; };"
rndc: 'addzone' failed: already exists
bind9/bin/rndc/rndc -c ./common/rndc.conf -p 5309 -s 10.53.0.3 addzone "\"test100\\\'.baz\" { type master; check-names ignore; file \"e.db\"; };"
cat addzone/ns3/_default.nzf
# New zone file for view: _default
# This file contains configuration for zones added by
# the 'rndc addzone' command. DO NOT EDIT BY HAND.
zone "test100\'.baz" { type master; check-names ignore; file "e.db"; };
zone "test100\\'.baz" { type master; check-names ignore; file "e.db"; };
In these few examples, you can see how the parser behaves.
Possible fixes
It is possible that this is just a weird behaviour of my environment. It could also be a bug in the parser logic when handling quotes / single quotes, backslashes and escaping.