diff options
author | Wayne Davison <wayned@samba.org> | 2006-02-04 19:42:47 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2006-02-04 19:42:47 +0000 |
commit | b31243b472865c89aaeab0d30c4b8d0efcb96b35 (patch) | |
tree | 98fb0e333ba1b8f8bc17484543b51cd12c85c57b /testsuite/dir-sgid.test | |
parent | c8d19f90a679343c92295e364e57fb3375c0a8e6 (diff) | |
download | rsync-b31243b472865c89aaeab0d30c4b8d0efcb96b35.tar.gz |
Test directory setgid inheritence when --perms is not in effect.
Diffstat (limited to 'testsuite/dir-sgid.test')
-rw-r--r-- | testsuite/dir-sgid.test | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/dir-sgid.test b/testsuite/dir-sgid.test new file mode 100644 index 00000000..8109b0ce --- /dev/null +++ b/testsuite/dir-sgid.test @@ -0,0 +1,41 @@ +#! /bin/sh + +# This program is distributable under the terms of the GNU GPL (see +# COPYING). + +# Test that rsync obeys directory setgid. -- Matt McCutchen + +. $srcdir/testsuite/rsync.fns + +umask 077 + +# Call as: testit <dirname> <dirperms> <file-expected> <program-expected> <dir-expected> +testit() { + todir="$scratchdir/$1" + mkdir "$todir" + chmod $2 "$todir" + # Make sure we obey directory setgid when creating a directory to hold multiple transferred files, + # even though the directory itself is outside the transfer + $RSYNC -rvv "$scratchdir/dir" "$scratchdir/file" "$scratchdir/program" "$todir/to/" + check_perms "$todir/to" $5 "Target $1" + check_perms "$todir/to/dir" $5 "Target $1" + check_perms "$todir/to/file" $3 "Target $1" + check_perms "$todir/to/program" $4 "Target $1" +} + +echo "File!" >"$scratchdir/file" +echo "#!/bin/sh" >"$scratchdir/program" +mkdir "$scratchdir/dir" +chmod 2764 "$scratchdir/dir" || test_skipped "Can't chmod" +chmod 664 "$scratchdir/file" +chmod 775 "$scratchdir/program" +[ -g "$scratchdir/dir" ] || test_skipped "The directory setgid bit vanished!" +mkdir "$scratchdir/dir/blah" +[ -g "$scratchdir/dir/blah" ] || test_skipped "Your filesystem doesn't use directory setgid; maybe it's BSD." + +# Test some target directories +testit setgid-off 700 rw------- rwx------ rwx------ +testit setgid-on 2700 rw------- rwx------ rwx--S--- + +# Hooray +exit 0 |