]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix key ID processing
authorMichał Kępień <michal@isc.org>
Mon, 17 Jun 2019 12:15:18 +0000 (14:15 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 17 Jun 2019 12:16:20 +0000 (14:16 +0200)
If ns1/setup.sh generates a key with ID 0, the "KEYID" token in
ns1/named.conf.in will be replaced with an empty string, causing the
following broken statement to appear in ns1/named.conf:

    tkey-dhkey "server" ;

Such a statement triggers false positives for the "tkey" system test due
to ns1 being unable to start with a broken configuration file.  Fix by
tweaking the regular expression used for removing leading zeros from the
key ID, so that it removes at most 4 leading zeros.

(cherry picked from commit 0b7b1161c215bf4e08467c79282dddc34bda2240)

bin/tests/system/tkey/ns1/setup.sh

index c1e2ff3e3121966c10c16e98cbf52f3e9c631434..0fb13d625d8977fed4bfed72f9e45a9df42fdde4 100644 (file)
@@ -13,6 +13,6 @@ SYSTEMTESTTOP=../..
 . $SYSTEMTESTTOP/conf.sh
 
 keyname=`$KEYGEN -T KEY -a DH -b 768 -n host -r $RANDFILE server`
-keyid=`echo $keyname | $PERL -p -e 's/^.*\+0*//;'`
+keyid=`echo $keyname | $PERL -p -e 's/^.*\+0{0,4}//;'`
 rm -f named.conf
 sed -e "s;KEYID;$keyid;" -e "s;RANDFILE;$RANDFILE;" < named.conf.in > named.conf