]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Only run system tests as root in developer mode
authorMichał Kępień <michal@isc.org>
Fri, 31 Jul 2020 05:47:49 +0000 (07:47 +0200)
committerMichał Kępień <michal@isc.org>
Fri, 31 Jul 2020 05:47:49 +0000 (07:47 +0200)
Running system tests with root privileges is potentially dangerous.
Only allow it when explicitly requested (by building with
--enable-developer).

(cherry picked from commit 3ef106f69df076340914257df4bdd1a1c22a9440)

bin/tests/system/run.sh

index c8190ec0839a24e7cd5c2fc54ea00dd7fcd0a057..7ec4b2d0233bfeaf262a12749766f53051ed4981 100755 (executable)
 SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
 . $SYSTEMTESTTOP/conf.sh
 
+if [ "`id -u`" -eq "0" ] && ! ${NAMED} -V | grep -q -F -- "enable-developer"; then
+       echofail "Refusing to run test as root. Build with --enable-developer to override." >&2
+       exit 1
+fi
+
 export SYSTEMTESTTOP
 
 stopservers=true