]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Support testcrypto.sh usage without including conf.sh
authorTom Krizek <tkrizek@isc.org>
Tue, 25 Oct 2022 12:05:07 +0000 (14:05 +0200)
committerTom Krizek <tkrizek@isc.org>
Thu, 22 Dec 2022 14:17:41 +0000 (15:17 +0100)
The only variable really needed for the script to work is the path to
the $KEYGEN binary. Allow setting this via an environment variable to
avoid loading conf.sh (and causing a chicken-egg problem). Also make
testcrypto.sh executable to allow its use from conf.sh.

(cherry picked from commit bb1c6bbdc701cdbadfe7c796acf8b5ecd719f1b9)

bin/tests/system/testcrypto.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 023cd6d..e9dd0f9
 # information regarding copyright ownership.
 
 SYSTEMTESTTOP=${SYSTEMTESTTOP:=..}
-. $SYSTEMTESTTOP/conf.sh
 
-prog=$0
+if test -z "$KEYGEN"; then
+    . $SYSTEMTESTTOP/conf.sh
+    alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS"
+else
+    alg=""
+fi
 
+prog=$0
 args=""
-alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS"
 quiet=0
-
 msg="cryptography"
 while test "$#" -gt 0; do
     case $1 in
@@ -63,6 +66,11 @@ while test "$#" -gt 0; do
     shift
 done
 
+if test -z "$alg"; then
+    echo "${prog}: no algorithm selected"
+    exit 1
+fi
+
 if $KEYGEN $args $alg foo > /dev/null 2>&1
 then
     rm -f Kfoo*