3 # This program is distributable under the terms of the GNU GPL (see
6 # Test that rsync obeys default ACLs. -- Matt McCutchen
10 $RSYNC --version |
grep "[, ] ACLs" >/dev
/null || test_skipped
"Rsync is configured without ACL support"
12 case "$setfacl_nodef" in
13 true
) 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' ;;
17 setfacl
$opts "$scratchdir" || test_skipped
"Your filesystem has ACLs disabled"
19 # Call as: testit <dirname> <default-acl> <file-expected> <program-expected>
21 todir
="$scratchdir/$1"
23 $setfacl_nodef "$todir"
25 case "$setfacl_nodef" in
26 *-k*) opts
="-dm $2" ;;
27 *) opts
="-m `echo $2 | sed 's/\([ugom]:\)/d:\1/g'`"
29 setfacl
$opts "$todir"
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"
46 mkdir
"$scratchdir/dir"
47 echo "File!" >"$scratchdir/file"
48 echo "#!/bin/sh" >"$scratchdir/program"
49 chmod 777 "$scratchdir/dir"
50 chmod 666 "$scratchdir/file"
51 chmod 777 "$scratchdir/program"
53 # Test some target directories
55 testit da777 u
::7,g
::7,o
:7 rw-rw-rw- rwxrwxrwx
56 testit da775 u
::7,g
::7,o
:5 rw-rw-r-- rwxrwxr-x
57 testit da750 u
::7,g
::5,o
:0 rw-r----- rwxr-x---
58 testit da750mask u
::7,u
:0:7,g
::7,m
:5,o
:0 rw-r----- rwxr-x---
59 testit noda1
'' rw------- rwx------
61 testit noda2
'' rw-rw-rw- rwxrwxrwx
63 testit noda3
'' rw-r--r-- rwxr-xr-x