Got rid of protocol-29 check.
[rsync/rsync.git] / testsuite / default-acls.test
... / ...
CommitLineData
1#! /bin/sh
2
3# This program is distributable under the terms of the GNU GPL (see
4# COPYING).
5
6# Test that rsync obeys default ACLs. -- Matt McCutchen
7
8. $srcdir/testsuite/rsync.fns
9
10$RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
11
12case "$setfacl_nodef" in
13true) test_skipped "I don't know how to use your setfacl command" ;;
14*-k*) opts='-dm u::7,g::5,o:5' ;;
15*) opts='-m d:u::7,d:g::5,d:o:5' ;;
16esac
17setfacl $opts "$scratchdir" || test_skipped "Your filesystem has ACLs disabled"
18
19# Call as: testit <dirname> <default-acl> <file-expected> <program-expected>
20testit() {
21 todir="$scratchdir/$1"
22 mkdir "$todir"
23 $setfacl_nodef "$todir"
24 if [ "$2" ]; then
25 case "$setfacl_nodef" in
26 *-k*) opts="-dm $2" ;;
27 *) opts="-m `echo $2 | sed 's/\([ugom]:\)/d:\1/g'`"
28 esac
29 setfacl $opts "$todir"
30 fi
31 # Make sure we obey ACLs when creating a directory to hold multiple transferred files,
32 # even though the directory itself is outside the transfer
33 $RSYNC -rvv "$scratchdir/dir" "$scratchdir/file" "$scratchdir/program" "$todir/to/"
34 check_perms "$todir/to" $4 "Target $1"
35 check_perms "$todir/to/dir" $4 "Target $1"
36 check_perms "$todir/to/file" $3 "Target $1"
37 check_perms "$todir/to/program" $4 "Target $1"
38 # Make sure get_local_name doesn't mess us up when transferring only one file
39 $RSYNC -rvv "$scratchdir/file" "$todir/to/anotherfile"
40 check_perms "$todir/to/anotherfile" $3 "Target $1"
41 # Make sure we obey default ACLs when not transferring a regular file
42 $RSYNC -rvv "$scratchdir/dir/" "$todir/to/anotherdir/"
43 check_perms "$todir/to/anotherdir" $4 "Target $1"
44}
45
46mkdir "$scratchdir/dir"
47echo "File!" >"$scratchdir/file"
48echo "#!/bin/sh" >"$scratchdir/program"
49chmod 777 "$scratchdir/dir"
50chmod 666 "$scratchdir/file"
51chmod 777 "$scratchdir/program"
52
53# Test some target directories
54umask 0077
55testit da777 u::7,g::7,o:7 rw-rw-rw- rwxrwxrwx
56testit da775 u::7,g::7,o:5 rw-rw-r-- rwxrwxr-x
57testit da750 u::7,g::5,o:0 rw-r----- rwxr-x---
58testit da770mask u::7,u:0:7,g::0,m:7,o:0 rw-rw---- rwxrwx---
59testit noda1 '' rw------- rwx------
60umask 0000
61testit noda2 '' rw-rw-rw- rwxrwxrwx
62umask 0022
63testit noda3 '' rw-r--r-- rwxr-xr-x
64
65# Hooray
66exit 0