summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-04-03 16:37:45 +0200
committerJim Meyering <meyering@redhat.com>2011-04-04 18:21:32 +0200
commitaec3e1e107b9104d188fc8494426bd8fb15b1741 (patch)
treeee7d3d2b5e8cf9a4cc5aee5e93d1e695de52192a /tests
parent40f71538b6166ea3e05a3976fd3b191803ff327b (diff)
downloadcoreutils-aec3e1e107b9104d188fc8494426bd8fb15b1741.tar.xz
tests: preserve-gid: don't chown temporary PATH dir to a nameless UID
* tests/cp/preserve-gid: Simply chmod a+rx instead. That is safer, in case the nameless UID actually has an account, and might take advantage of root running a program in a directory under its control
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp/preserve-gid7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index 4b80fa75f..de4bc5bce 100755
--- a/tests/cp/preserve-gid
+++ b/tests/cp/preserve-gid
@@ -103,9 +103,14 @@ t0 c1 0 "$nameless_gid2" cp -p
# $nameless_uid can access it and then make that directory the search path.
tmp_path=
cleanup_() { rm -rf "$tmp_path"; }
+
+# Cause mktemp to create a directory directly under /tmp.
+# Setting TMPDIR explicitly is required here, in case $TMPDIR
+# is not readable by our nameless IDs.
+test -d /tmp && TMPDIR=/tmp
tmp_path=$(mktemp -d) || fail_ "failed to create temporary directory"
cp "$abs_path_dir_/cp" "$tmp_path"
-chown -R $nameless_uid "$tmp_path"
+chmod -R a+rx "$tmp_path"
t1() {
f=$1; shift