[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] tests: preserve-gid: don't chown temporary PATH dir to a nam
From: |
Jim Meyering |
Subject: |
[PATCH 4/6] tests: preserve-gid: don't chown temporary PATH dir to a nameless UID |
Date: |
Mon, 4 Apr 2011 07:13:39 +0200 |
From: Jim Meyering <address@hidden>
* 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
---
tests/cp/preserve-gid | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index 4b80fa7..de4bc5b 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
--
1.7.4.2.662.gcbd0
- minor test improvements, Jim Meyering, 2011/04/04
- [PATCH 1/6] tests: minor improvement of sc_tight_scope rule, Jim Meyering, 2011/04/04
- [PATCH 2/6] tests: convert common root-build test failure to a "skip", Jim Meyering, 2011/04/04
- [PATCH 3/6] tests: preserve-gid: remove useless use of "env", Jim Meyering, 2011/04/04
- [PATCH 4/6] tests: preserve-gid: don't chown temporary PATH dir to a nameless UID,
Jim Meyering <=
- [PATCH 5/6] tests: don't ever leave a backgrounded "sleep 10m" process, Jim Meyering, 2011/04/04
- [PATCH 6/6] tests: avoid spurious parallel failure due to temporary disk full, Jim Meyering, 2011/04/04
Re: minor test improvements, Jim Meyering, 2011/04/04