From a159675f448130daf29670c2b2bbc9edb5e20c09 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Thu, 7 Feb 2019 19:00:43 +0000 Subject: [PATCH 1/3] dnssec-coverage: fix handling of zones without trailing dots After change 5143, zones listed on the command line without trailing dots were ignored. --- bin/python/isc/coverage.py.in | 3 ++- bin/tests/system/coverage/clean.sh | 1 + bin/tests/system/coverage/tests.sh | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/python/isc/coverage.py.in b/bin/python/isc/coverage.py.in index b6ed5d0a69..14c00aac0a 100644 --- a/bin/python/isc/coverage.py.in +++ b/bin/python/isc/coverage.py.in @@ -189,7 +189,8 @@ def parse_args(): fatal("ERROR: -f can only be used with one zone.") # strip trailing dots - args.zone = [x[:-1] for x in args.zone if len(x) > 1 and x[-1] == '.'] + args.zone = [x[:-1] if len(x) > 1 and x[-1] == '.' else x + for x in args.zone] # convert from time arguments to seconds try: diff --git a/bin/tests/system/coverage/clean.sh b/bin/tests/system/coverage/clean.sh index 253e8aaca5..9917e2e24f 100644 --- a/bin/tests/system/coverage/clean.sh +++ b/bin/tests/system/coverage/clean.sh @@ -13,4 +13,5 @@ rm -f named-compilezone rm -f */K*.key rm -f */K*.private rm -rf coverage.* +rm -rf dotted-dotless rm -f ns*/named.lock diff --git a/bin/tests/system/coverage/tests.sh b/bin/tests/system/coverage/tests.sh index f435eb8f0e..47a4589511 100644 --- a/bin/tests/system/coverage/tests.sh +++ b/bin/tests/system/coverage/tests.sh @@ -81,5 +81,17 @@ for dir in [0-9][0-9]-*; do status=`expr $status + $ret` done +dir=dotted-dotless +[ -d $dir ] || mkdir $dir +echo_i "$dir" +zsk1=`$KEYGEN -q -K $dir -a rsasha256 one.example` +zsk2=`$KEYGEN -q -K $dir -a rsasha256 two.example` +$COVERAGE -K $dir one.example. two.example > coverage.$n 2>&1 +grep one.example coverage.$n >/dev/null 2>&1 || ret=1 +grep two.example coverage.$n >/dev/null 2>&1 || ret=1 +n=`expr $n + 1` +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 From 9949163936e22adabf94ea05a9dfed76527cf1a5 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 7 Feb 2019 16:42:12 -0800 Subject: [PATCH 2/3] adjust style, match test to other tests --- bin/python/isc/coverage.py.in | 6 +++--- .../system/coverage/13-dotted-dotless/expect | 7 +++++++ bin/tests/system/coverage/setup.sh | 5 +++++ bin/tests/system/coverage/tests.sh | 16 ++-------------- util/copyrights | 1 + 5 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 bin/tests/system/coverage/13-dotted-dotless/expect diff --git a/bin/python/isc/coverage.py.in b/bin/python/isc/coverage.py.in index 14c00aac0a..fe591431e8 100644 --- a/bin/python/isc/coverage.py.in +++ b/bin/python/isc/coverage.py.in @@ -188,9 +188,9 @@ def parse_args(): if args.filename and len(args.zone) > 1: fatal("ERROR: -f can only be used with one zone.") - # strip trailing dots - args.zone = [x[:-1] if len(x) > 1 and x[-1] == '.' else x - for x in args.zone] + # strip trailing dots if any + args.zone = [x[:-1] if (len(x) > 1 and x[-1] == '.') else x + for x in args.zone] # convert from time arguments to seconds try: diff --git a/bin/tests/system/coverage/13-dotted-dotless/expect b/bin/tests/system/coverage/13-dotted-dotless/expect new file mode 100644 index 0000000000..5760d298df --- /dev/null +++ b/bin/tests/system/coverage/13-dotted-dotless/expect @@ -0,0 +1,7 @@ +args="-z -m2h" +warn=0 +error=0 +ok=2 +retcode=0 +match= +zones="one.example. two.example" diff --git a/bin/tests/system/coverage/setup.sh b/bin/tests/system/coverage/setup.sh index 0f4d435819..b32937f229 100644 --- a/bin/tests/system/coverage/setup.sh +++ b/bin/tests/system/coverage/setup.sh @@ -132,3 +132,8 @@ ksk1=`$KEYGEN -q -K $dir -a rsasha1 -3fk example.com` dir=12-ksk-deletion ksk1=`$KEYGEN -q -K $dir -f KSK -a 8 -b 2048 -I +40d -D +40d example.com` ksk2=`$KEYGEN -q -K $dir -S $ksk1.key example.com` + +# Test 13: check names with/without dots at the end +dir=13-dotted-dotless +zsk1=`$KEYGEN -q -K $dir -a rsasha256 one.example` +zsk2=`$KEYGEN -q -K $dir -a rsasha256 two.example` diff --git a/bin/tests/system/coverage/tests.sh b/bin/tests/system/coverage/tests.sh index 47a4589511..7434358558 100644 --- a/bin/tests/system/coverage/tests.sh +++ b/bin/tests/system/coverage/tests.sh @@ -32,9 +32,9 @@ ret=0 for dir in [0-9][0-9]-*; do ret=0 echo_i "$dir" - args= warn= error= ok= retcode= match= + args= warn= error= ok= retcode= match= zones= . $dir/expect - $COVERAGE $args -K $dir example.com > coverage.$n 2>&1 + $COVERAGE $args -K $dir ${zones:-example.com} > coverage.$n 2>&1 # check that return code matches expectations found=$? @@ -81,17 +81,5 @@ for dir in [0-9][0-9]-*; do status=`expr $status + $ret` done -dir=dotted-dotless -[ -d $dir ] || mkdir $dir -echo_i "$dir" -zsk1=`$KEYGEN -q -K $dir -a rsasha256 one.example` -zsk2=`$KEYGEN -q -K $dir -a rsasha256 two.example` -$COVERAGE -K $dir one.example. two.example > coverage.$n 2>&1 -grep one.example coverage.$n >/dev/null 2>&1 || ret=1 -grep two.example coverage.$n >/dev/null 2>&1 || ret=1 -n=`expr $n + 1` -if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` - echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/util/copyrights b/util/copyrights index 9038aa70d4..41ce20d9c1 100644 --- a/util/copyrights +++ b/util/copyrights @@ -482,6 +482,7 @@ ./bin/tests/system/coverage/11-cutoff/README X 2014,2018,2019 ./bin/tests/system/coverage/11-cutoff/expect X 2014,2018,2019 ./bin/tests/system/coverage/12-ksk-deletion/expect X 2018,2019 +./bin/tests/system/coverage/13-dotted-dotless/expect X 2019 ./bin/tests/system/coverage/clean.sh SH 2013,2014,2016,2018,2019 ./bin/tests/system/coverage/setup.sh SH 2013,2014,2016,2017,2018,2019 ./bin/tests/system/coverage/tests.sh SH 2013,2014,2016,2018,2019 From a242c704f5aed9c8e8a42e2c975c70d37d882f67 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 7 Feb 2019 16:47:26 -0800 Subject: [PATCH 3/3] CHANGES --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index d53af0b235..351c410594 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5159. [bug] dnssec-coverage was incorrectly ignoring + names specified on the command line without + trailing dots. [GL !1478] + 5158. [protocol] Add support for ATMRELAY and ZONEMD. [GL #867] 5157. [bug] Nslookup now errors out if there are extra command