diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-02-19 06:49:45 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-02-19 06:49:45 +0100 |
commit | 3cc39bfc6387d1f1f61dd2a8533f5dc6a6edc42c (patch) | |
tree | 6e9626eb01094f4abb419da8444914f95570ff81 | |
parent | Disable environment propagation if sandbox is disabled (diff) | |
download | sandbox-3cc39bfc6387d1f1f61dd2a8533f5dc6a6edc42c.tar.gz sandbox-3cc39bfc6387d1f1f61dd2a8533f5dc6a6edc42c.tar.bz2 sandbox-3cc39bfc6387d1f1f61dd2a8533f5dc6a6edc42c.zip |
tests: Add a test for LD_PRELOAD non-preserving (SANDBOX_ON=0)
-rw-r--r-- | tests/script-15.sh | 21 | ||||
-rw-r--r-- | tests/script.at | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/script-15.sh b/tests/script-15.sh new file mode 100644 index 0000000..b2acddc --- /dev/null +++ b/tests/script-15.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# check that sandbox stops cloberring LD_PRELOAD when it's disabled +[ "${at_xfail}" = "yes" ] && exit 77 # see script-0 + +SANDBOX_ON=0 + +# keep in sync with script-4! +checkit() { + if eval "$@" | grep -q '^LD_PRELOAD=.*libsandbox.so.*' ; then + echo "LD_PRELOAD was reset when running (w/ SANDBOX_ON=0):" + echo " $*" + exit 1 + fi +} + +checkit "env -uLD_PRELOAD env" +checkit "(unset LD_PRELOAD; env)" +checkit "env LD_PRELOAD= env" +checkit "env LD_PRELOAD=libc.so env" + +exit $? diff --git a/tests/script.at b/tests/script.at index 9134ac1..8837bda 100644 --- a/tests/script.at +++ b/tests/script.at @@ -12,3 +12,4 @@ SB_CHECK(11) SB_CHECK(12) SB_CHECK(13) SB_CHECK(14) +SB_CHECK(15) |