diff options
author | 2017-03-10 10:15:50 -0800 | |
---|---|---|
committer | 2017-03-10 10:15:50 -0800 | |
commit | 4c47cfa22802fd8201586bef233d8161df4ff61b (patch) | |
tree | 14994e1b6145e04a19678104bfda543e705fe08a /tests | |
parent | libsbutil: elide sb_maybe_gdb when -DNDEBUG is used (diff) | |
download | sandbox-4c47cfa22802fd8201586bef233d8161df4ff61b.tar.gz sandbox-4c47cfa22802fd8201586bef233d8161df4ff61b.tar.bz2 sandbox-4c47cfa22802fd8201586bef233d8161df4ff61b.zip |
libsandbox: whitelist renameat/symlinkat as symlink funcs
These funcs don't deref their path args, so flag them as such.
URL: https://bugs.gentoo.org/612202
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/renameat-2.sh | 12 | ||||
-rwxr-xr-x | tests/renameat-3.sh | 11 | ||||
-rw-r--r-- | tests/renameat.at | 2 | ||||
-rwxr-xr-x | tests/symlinkat-2.sh | 10 | ||||
-rwxr-xr-x | tests/symlinkat-3.sh | 9 | ||||
-rw-r--r-- | tests/symlinkat.at | 2 |
6 files changed, 46 insertions, 0 deletions
diff --git a/tests/renameat-2.sh b/tests/renameat-2.sh new file mode 100755 index 0000000..d0fbe8a --- /dev/null +++ b/tests/renameat-2.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# make sure we can clobber symlinks #612202 + +addwrite $PWD + +ln -s /asdf sym || exit 1 +touch file +renameat-0 0 AT_FDCWD file AT_FDCWD sym || exit 1 +[ ! -e file ] +[ ! -L sym ] +[ -e sym ] +test ! -s "${SANDBOX_LOG}" diff --git a/tests/renameat-3.sh b/tests/renameat-3.sh new file mode 100755 index 0000000..9ae5c9a --- /dev/null +++ b/tests/renameat-3.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# make sure we reject bad renames #612202 + +addwrite $PWD +mkdir deny +adddeny $PWD/deny + +touch file +renameat-0 -1,EACCES AT_FDCWD file AT_FDCWD deny/file || exit 1 +[ -e file ] +test -s "${SANDBOX_LOG}" diff --git a/tests/renameat.at b/tests/renameat.at index 081d7d2..eec4638 100644 --- a/tests/renameat.at +++ b/tests/renameat.at @@ -1 +1,3 @@ SB_CHECK(1) +SB_CHECK(2) +SB_CHECK(3) diff --git a/tests/symlinkat-2.sh b/tests/symlinkat-2.sh new file mode 100755 index 0000000..168362e --- /dev/null +++ b/tests/symlinkat-2.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# make sure we can clobber symlinks #612202 + +addwrite $PWD + +symlinkat-0 0 /asdf AT_FDCWD ./sym || exit 1 +[ -L sym ] +symlinkat-0 -1,EEXIST /asdf AT_FDCWD ./sym || exit 1 +[ -L sym ] +test ! -s "${SANDBOX_LOG}" diff --git a/tests/symlinkat-3.sh b/tests/symlinkat-3.sh new file mode 100755 index 0000000..a01c750 --- /dev/null +++ b/tests/symlinkat-3.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# make sure we reject bad symlinks #612202 + +addwrite $PWD +mkdir deny +adddeny $PWD/deny + +symlinkat-0 -1,EACCES ./ AT_FDCWD deny/sym || exit 1 +test -s "${SANDBOX_LOG}" diff --git a/tests/symlinkat.at b/tests/symlinkat.at index 081d7d2..eec4638 100644 --- a/tests/symlinkat.at +++ b/tests/symlinkat.at @@ -1 +1,3 @@ SB_CHECK(1) +SB_CHECK(2) +SB_CHECK(3) |