]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Do not call bin/tools/genrandom unconditionally in system tests
authorMichał Kępień <michal@isc.org>
Fri, 24 Aug 2018 07:57:15 +0000 (09:57 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 24 Aug 2018 07:57:15 +0000 (09:57 +0200)
$RANDFILE, i.e. bin/tests/system/random.data, should only be written to
if a system test requires support for cryptography and that file does
not already exist.  Otherwise, when multiple system tests are run in
parallel, that file might get truncated due to bin/tools/genrandom.c
using fopen() with mode "w" when writing the destination file.  With
unfortunate timing, this may cause system tests employing BIND tools
which need entropy (e.g. dnssec-keygen) to fail.

Make sure bin/tests/system/metadata/tests.sh no longer calls
bin/tools/genrandom since $RANDFILE is guaranteed to already be created
by the time bin/tools/genrandom is currently called because
bin/tests/system/metadata/prereq.sh uses bin/tests/system/testcrypto.sh.

Make sure bin/tests/system/sfcache/prereq.sh only writes to $RANDFILE if
it does not already exist.

bin/tests/system/metadata/tests.sh
bin/tests/system/sfcache/prereq.sh

index 349a8dc7edc7bafb945db8ae01b4b1e4cad65b8e..17f11fffa0a66b386c122959ac7f186bc0feef39 100644 (file)
@@ -29,8 +29,6 @@ rolling=`sed 's/^K'${czone}'.+005+0*\([0-9]\)/\1/' < rolling.key`
 standby=`sed 's/^K'${czone}'.+005+0*\([0-9]\)/\1/' < standby.key`
 zsk=`sed 's/^K'${czone}'.+005+0*\([0-9]\)/\1/' < zsk.key`
 
-$GENRANDOM 800 $RANDFILE
-
 echo_i "signing zones"
 $SIGNER -Sg -o $czone $cfile > /dev/null 2>&1
 $SIGNER -Sg -o $pzone $pfile > /dev/null 2>&1
index 9847200dfde5b7a7e287358f40774f79a690b9f7..d46b69db5f0d2080771b938be91feb3667053c18 100644 (file)
@@ -12,7 +12,7 @@
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
-$GENRANDOM 800 $RANDFILE
+test -r $RANDFILE || $GENRANDOM 800 $RANDFILE
 
 if $KEYGEN -q -a RSAMD5 -b 1024 -n zone -r $RANDFILE foo > /dev/null 2>&1
 then