Commit 3ef106f6 authored by Michał Kępień's avatar Michał Kępień

Only run system tests as root in developer mode

Running system tests with root privileges is potentially dangerous.
Only allow it when explicitly requested (by building with
--enable-developer).
parent 1ce582ca
Pipeline #47837 canceled with stages
in 14 minutes and 50 seconds
......@@ -20,6 +20,11 @@ srcdir=@abs_srcdir@
# shellcheck source=conf.sh
. ${builddir}/conf.sh
if [ "$(id -u)" -eq "0" ] && [ "@DEVELOPER_MODE@" != "yes" ]; then
echofail "Refusing to run test as root. Build with --enable-developer to override." >&2
exit 1
fi
SYSTEMTESTTOP="$(cd -P -- "${builddir}" && pwd -P)"
if [ "$CYGWIN" ]; then
SYSTEMTESTTOP="$(cygpath -m "${SYSTEMTESTTOP}")"
......
......@@ -159,7 +159,8 @@ AC_ARG_ENABLE([developer],
[enable developer build settings])])
AS_IF([test "$enable_developer" = "yes"],
[STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
[DEVELOPER_MODE=yes
STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${enable_querytrace+set}" = set || enable_querytrace=yes
test "${with_cmocka+set}" = set || with_cmocka=yes
......@@ -168,6 +169,7 @@ AS_IF([test "$enable_developer" = "yes"],
test "${enable_warn_error+set}" = set || enable_warn_error=yes
])
AC_SUBST([DEVELOPER_MODE])
AC_SUBST([STD_CFLAGS])
AC_SUBST([STD_CPPFLAGS])
......
......@@ -211,6 +211,7 @@ my @substdefp = ();
my %configtest;
my @substtest = ("CRYPTO",
"DEVELOPER_MODE",
"DNSTAP",
"FSTRM_CAPTURE",
"JSONSTATS",
......@@ -722,6 +723,7 @@ sub myenable {
# enable-developer expansion now
if ($enable_developer eq "yes") {
$configtest{"DEVELOPER_MODE"} = "yes";
$configdefh{"ISC_LIST_CHECKINIT"} = 1;
$enable_querytrace = "yes";
# no atf on WIN32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment