File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / testsuite / default-acls.test
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 07:51:15 2013 UTC (10 years, 8 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_1_2p5, RSYNC3_1_0, HEAD
v 3.1.0

    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: . $suitedir/rsync.fns
    9: 
   10: $RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
   11: 
   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' ;;
   16: esac
   17: setfacl $opts "$scratchdir" || test_skipped "Your filesystem has ACLs disabled"
   18: 
   19: # Call as: testit <dirname> <default-acl> <file-expected> <program-expected>
   20: testit() {
   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: 
   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"
   52: 
   53: # Test some target directories
   54: umask 0077
   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------
   60: umask 0000
   61: testit noda2 '' rw-rw-rw- rwxrwxrwx
   62: umask 0022
   63: testit noda3 '' rw-r--r-- rwxr-xr-x
   64: 
   65: # Hooray
   66: exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>