]> 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:58:08 +0000 (09:58 +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.

(cherry picked from commit c12388f5e8e27e6028b7fdb4485594731bb9c760)

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

index fe070b9361b3a2ed6abae92acf3f4ec9afebc045..5eb093801601761429e7b70ad94f570d9136caf6 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 400 $RANDFILE
-
 echo_i "signing zones"
 $SIGNER -Sg -o $czone $cfile > /dev/null 2>&1
 $SIGNER -Sg -o $pzone $pfile > /dev/null 2>&1
index e1a582e10c07079033f30c72eeffc42325d7fecc..338197bcf5bc96746bec9cfe2eb066199884db66 100644 (file)
@@ -12,7 +12,7 @@
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
-$GENRANDOM 400 $RANDFILE
+test -r $RANDFILE || $GENRANDOM 400 $RANDFILE
 
 if $KEYGEN -q -a RSAMD5 -b 512 -n zone -r $RANDFILE foo > /dev/null 2>&1
 then