+-!/^OFF_T|^size_t|^off_t|^pid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^uchar|^short|^struct|^BOOL|^void|^time|^const|^RETSIGTYPE/ {
++!/^OFF_T|^size_t|^off_t|^pid_t|^id_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^uchar|^short|^struct|^BOOL|^void|^time|^const|^RETSIGTYPE/ {
+ next;
+ }
+
+--- old/options.c
++++ new/options.c
+@@ -45,6 +45,7 @@ int copy_dirlinks = 0;
+ int copy_links = 0;
+ int preserve_links = 0;
+ int preserve_hard_links = 0;
++int preserve_acls = 0;
+ int preserve_perms = 0;
+ int preserve_executability = 0;
+ int preserve_devices = 0;
+@@ -194,6 +195,7 @@ static void print_rsync_version(enum log
+ char const *got_socketpair = "no ";
+ char const *have_inplace = "no ";
+ char const *hardlinks = "no ";
++ char const *acls = "no ";
+ char const *links = "no ";
+ char const *ipv6 = "no ";
+ STRUCT_STAT *dumstat;
+@@ -210,6 +212,10 @@ static void print_rsync_version(enum log
+ hardlinks = "";
+ #endif
+
++#ifdef SUPPORT_ACLS
++ acls = "";
++#endif
++
+ #ifdef SUPPORT_LINKS
+ links = "";
+ #endif
+@@ -223,9 +229,9 @@ static void print_rsync_version(enum log
+ rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
+ rprintf(f, "<http://rsync.samba.org/>\n");
+ rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, "
+- "%shard links, %ssymlinks, batchfiles,\n",
++ "%shard links, %sACLs, %ssymlinks, batchfiles,\n",
+ (int) (sizeof (OFF_T) * 8),
+- got_socketpair, hardlinks, links);
++ got_socketpair, hardlinks, acls, links);
+
+ /* Note that this field may not have type ino_t. It depends
+ * on the complicated interaction between largefile feature
+@@ -295,6 +301,9 @@ void usage(enum logcode F)
+ rprintf(F," -H, --hard-links preserve hard links\n");
+ rprintf(F," -p, --perms preserve permissions\n");
+ rprintf(F," -E, --executability preserve the file's executability\n");
++#ifdef SUPPORT_ACLS
++ rprintf(F," -A, --acls preserve ACLs (implies --perms)\n");
++#endif
+ rprintf(F," --chmod=CHMOD change destination permissions\n");
+ rprintf(F," -o, --owner preserve owner (super-user only)\n");
+ rprintf(F," -g, --group preserve group\n");
+@@ -410,6 +419,9 @@ static struct poptOption long_options[]
+ {"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
+ {"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
+ {"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
++ {"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
++ {"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
++ {"no-A", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
+ {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
+ {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
+ {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
+@@ -1068,6 +1080,23 @@ int parse_arguments(int *argc, const cha
+ usage(FINFO);
+ exit_cleanup(0);
+
++ case 'A':
++#ifdef SUPPORT_ACLS
++ preserve_acls = preserve_perms = 1;
++ break;
++#else
++ /* FIXME: this should probably be ignored with a
++ * warning and then countermeasures taken to
++ * restrict group and other access in the presence
++ * of any more restrictive ACLs, but this is safe
++ * for now */
++ snprintf(err_buf,sizeof(err_buf),
++ "ACLs are not supported on this %s\n",
++ am_server ? "server" : "client");
++ return 0;
++#endif
++
++
+ default:
+ /* A large opt value means that set_refuse_options()
+ * turned this option off. */
+@@ -1511,6 +1540,10 @@ void server_options(char **args,int *arg
+
+ if (preserve_hard_links)
+ argstr[x++] = 'H';
++#ifdef SUPPORT_ACLS
++ if (preserve_acls)
++ argstr[x++] = 'A';
++#endif
+ if (preserve_uid)
+ argstr[x++] = 'o';
+ if (preserve_gid)
+--- old/receiver.c
++++ new/receiver.c
+@@ -46,6 +46,7 @@ extern int keep_partial;
+ extern int checksum_seed;
+ extern int inplace;
+ extern int delay_updates;
++extern mode_t orig_umask;
+ extern struct stats stats;
+ extern char *log_format;
+ extern char *tmpdir;
+@@ -344,6 +345,10 @@ int recv_files(int f_in, struct file_lis
+ int itemizing = am_daemon ? daemon_log_format_has_i
+ : !am_server && log_format_has_i;
+ int max_phase = protocol_version >= 29 ? 2 : 1;
++ int dflt_perms = (ACCESSPERMS & ~orig_umask);
++#ifdef SUPPORT_ACLS
++ char *parent_dirname = "";
++#endif
+ int i, recv_ok;
+
+ if (verbose > 2)
+@@ -541,7 +546,16 @@ int recv_files(int f_in, struct file_lis
+ * mode based on the local permissions and some heuristics. */
+ if (!preserve_perms) {
+ int exists = fd1 != -1;
+- file->mode = dest_mode(file->mode, st.st_mode, exists);
++#ifdef SUPPORT_ACLS
++ char *dn = file->dirname ? file->dirname : ".";
++ if (parent_dirname != dn
++ && strcmp(parent_dirname, dn) != 0) {
++ dflt_perms = default_perms_for_dir(dn);
++ parent_dirname = dn;
++ }
++#endif
++ file->mode = dest_mode(file->mode, st.st_mode,
++ dflt_perms, exists);
+ }
+
+ /* We now check to see if we are writing file "inplace" */
+--- old/rsync.c
++++ new/rsync.c
+@@ -33,6 +33,7 @@
+ extern int verbose;
+ extern int dry_run;
+ extern int daemon_log_format_has_i;
++extern int preserve_acls;
+ extern int preserve_perms;
+ extern int preserve_executability;
+ extern int preserve_times;
+@@ -101,7 +102,8 @@ void free_sums(struct sum_struct *s)
+
+ /* This is only called when we aren't preserving permissions. Figure out what
+ * the permissions should be and return them merged back into the mode. */
+-mode_t dest_mode(mode_t flist_mode, mode_t cur_mode, int exists)
++mode_t dest_mode(mode_t flist_mode, mode_t cur_mode, int dflt_perms,
++ int exists)
+ {
+ /* If the file already exists, we'll return the local permissions,
+ * possibly tweaked by the --executability option. */
+@@ -116,7 +118,7 @@ mode_t dest_mode(mode_t flist_mode, mode
+ cur_mode |= (cur_mode & 0444) >> 2;
+ }
+ } else
+- cur_mode = flist_mode & ACCESSPERMS & ~orig_umask;
++ cur_mode = flist_mode & ACCESSPERMS & dflt_perms;
+ if (daemon_chmod_modes && !S_ISLNK(flist_mode))
+ cur_mode = tweak_mode(cur_mode, daemon_chmod_modes);
+ return (flist_mode & ~CHMOD_BITS) | (cur_mode & CHMOD_BITS);
+@@ -203,9 +205,21 @@ int set_file_attrs(char *fname, struct f
+ updated = 1;
+ }
+
++#ifdef SUPPORT_ACLS
++ /* It's OK to call set_acl() now, even for a dir, as the generator
++ * will enable owner-writability using chmod, if necessary.
++ *
++ * If set_acl changes permission bits in the process of setting
++ * an access ACL, it changes st->st_mode so we know whether we
++ * need to chmod. */
++ if (preserve_acls && set_acl(fname, file, &st->st_mode) == 0)
++ updated = 1;
++#endif
++
+ #ifdef HAVE_CHMOD
+ if ((st->st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
+- int ret = do_chmod(fname, file->mode);
++ mode_t mode = file->mode;
++ int ret = do_chmod(fname, mode);
+ if (ret < 0) {
+ rsyserr(FERROR, errno,
+ "failed to set permissions on %s",
+--- old/rsync.h
++++ new/rsync.h
+@@ -658,6 +658,20 @@ struct chmod_mode_struct;
+
+ #define UNUSED(x) x __attribute__((__unused__))
+
++#if HAVE_POSIX_ACLS|HAVE_UNIXWARE_ACLS|HAVE_SOLARIS_ACLS|\
++ HAVE_HPUX_ACLS|HAVE_IRIX_ACLS|HAVE_AIX_ACLS|HAVE_TRU64_ACLS
++#define SUPPORT_ACLS 1
++#endif
++
++#if HAVE_UNIXWARE_ACLS|HAVE_SOLARIS_ACLS|HAVE_HPUX_ACLS
++#define ACLS_NEED_MASK 1
++#endif
++
++#if defined SUPPORT_ACLS && defined HAVE_SYS_ACL_H
++#include <sys/acl.h>
++#endif
++#include "smb_acls.h"
++
+ #include "proto.h"
+
+ /* We have replacement versions of these if they're missing. */
+--- old/rsync.yo
++++ new/rsync.yo
+@@ -321,6 +321,7 @@ to the detailed description below for a
+ -H, --hard-links preserve hard links
+ -p, --perms preserve permissions
+ -E, --executability preserve executability
++ -A, --acls preserve ACLs (implies -p) [non-standard]
+ --chmod=CHMOD change destination permissions
+ -o, --owner preserve owner (super-user only)
+ -g, --group preserve group
+@@ -742,7 +743,9 @@ quote(itemize(
+ permissions, though the bf(--executability) option might change just
+ the execute permission for the file.
+ it() New files get their "normal" permission bits set to the source
+- file's permissions masked with the receiving end's umask setting, and
++ file's permissions masked with the receiving directory's default
++ permissions (either the receiving process's umask, or the permissions
++ specified via the destination directory's default ACL), and
+ their special permission bits disabled except in the case where a new
+ directory inherits a setgid bit from its parent directory.
+ ))
+@@ -773,9 +776,11 @@ The preservation of the destination's se
+ directories when bf(--perms) is off was added in rsync 2.6.7. Older rsync
+ versions erroneously preserved the three special permission bits for
+ newly-created files when bf(--perms) was off, while overriding the
+-destination's setgid bit setting on a newly-created directory. (Keep in
+-mind that it is the version of the receiving rsync that affects this
+-behavior.)
++destination's setgid bit setting on a newly-created directory. Default ACL
++observance was added to the ACL patch for rsync 2.6.7, so older (or
++non-ACL-enabled) rsyncs use the umask even if default ACLs are present.
++(Keep in mind that it is the version of the receiving rsync that affects
++these behaviors.)
+
+ dit(bf(-E, --executability)) This option causes rsync to preserve the
+ executability (or non-executability) of regular files when bf(--perms) is
+@@ -793,6 +798,10 @@ quote(itemize(
+
+ If bf(--perms) is enabled, this option is ignored.
+
++dit(bf(-A, --acls)) This option causes rsync to update the destination
++ACLs to be the same as the source ACLs. This nonstandard option only
++works if the remote rsync also supports it. bf(--acls) implies bf(--perms).
++
+ dit(bf(--chmod)) This option tells rsync to apply one or more
+ comma-separated "chmod" strings to the permission of the files in the
+ transfer. The resulting value is treated as though it was the permissions
+--- old/smb_acls.h
++++ new/smb_acls.h
+@@ -0,0 +1,277 @@
++/*
++ Unix SMB/Netbios implementation.
++ Version 2.2.x
++ Portable SMB ACL interface
++ Copyright (C) Jeremy Allison 2000
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++*/
++
++#ifndef _SMB_ACLS_H
++#define _SMB_ACLS_H
++
++#if defined HAVE_POSIX_ACLS
++
++/* This is an identity mapping (just remove the SMB_). */
++
++#define SMB_ACL_TAG_T acl_tag_t
++#define SMB_ACL_TYPE_T acl_type_t
++#define SMB_ACL_PERMSET_T acl_permset_t
++#define SMB_ACL_PERM_T acl_perm_t
++#define SMB_ACL_READ ACL_READ
++#define SMB_ACL_WRITE ACL_WRITE
++#define SMB_ACL_EXECUTE ACL_EXECUTE
++
++/* Types of ACLs. */
++#define SMB_ACL_USER ACL_USER
++#define SMB_ACL_USER_OBJ ACL_USER_OBJ
++#define SMB_ACL_GROUP ACL_GROUP
++#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
++#define SMB_ACL_OTHER ACL_OTHER
++#define SMB_ACL_MASK ACL_MASK
++
++#define SMB_ACL_T acl_t
++
++#define SMB_ACL_ENTRY_T acl_entry_t
++
++#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY
++#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY
++
++#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
++#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
++
++#elif defined HAVE_TRU64_ACLS
++
++/* This is for DEC/Compaq Tru64 UNIX */
++
++#define SMB_ACL_TAG_T acl_tag_t
++#define SMB_ACL_TYPE_T acl_type_t
++#define SMB_ACL_PERMSET_T acl_permset_t
++#define SMB_ACL_PERM_T acl_perm_t
++#define SMB_ACL_READ ACL_READ
++#define SMB_ACL_WRITE ACL_WRITE
++#define SMB_ACL_EXECUTE ACL_EXECUTE
++
++/* Types of ACLs. */
++#define SMB_ACL_USER ACL_USER
++#define SMB_ACL_USER_OBJ ACL_USER_OBJ
++#define SMB_ACL_GROUP ACL_GROUP
++#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
++#define SMB_ACL_OTHER ACL_OTHER
++#define SMB_ACL_MASK ACL_MASK
++
++#define SMB_ACL_T acl_t
++
++#define SMB_ACL_ENTRY_T acl_entry_t
++
++#define SMB_ACL_FIRST_ENTRY 0
++#define SMB_ACL_NEXT_ENTRY 1
++
++#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
++#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
++
++#elif defined HAVE_UNIXWARE_ACLS || defined HAVE_SOLARIS_ACLS
++/*
++ * Donated by Michael Davidson <md@sco.COM> for UnixWare / OpenUNIX.
++ * Modified by Toomas Soome <tsoome@ut.ee> for Solaris.
++ */
++
++/* SVR4.2 ES/MP ACLs */
++typedef int SMB_ACL_TAG_T;
++typedef int SMB_ACL_TYPE_T;
++typedef ushort *SMB_ACL_PERMSET_T;
++typedef ushort SMB_ACL_PERM_T;
++#define SMB_ACL_READ 4
++#define SMB_ACL_WRITE 2
++#define SMB_ACL_EXECUTE 1
++
++/* Types of ACLs. */
++#define SMB_ACL_USER USER
++#define SMB_ACL_USER_OBJ USER_OBJ
++#define SMB_ACL_GROUP GROUP
++#define SMB_ACL_GROUP_OBJ GROUP_OBJ
++#define SMB_ACL_OTHER OTHER_OBJ
++#define SMB_ACL_MASK CLASS_OBJ
++
++typedef struct SMB_ACL_T {
++ int size;
++ int count;
++ int next;
++ struct acl acl[1];
++} *SMB_ACL_T;
++
++typedef struct acl *SMB_ACL_ENTRY_T;
++
++#define SMB_ACL_FIRST_ENTRY 0
++#define SMB_ACL_NEXT_ENTRY 1
++
++#define SMB_ACL_TYPE_ACCESS 0
++#define SMB_ACL_TYPE_DEFAULT 1
++
++#elif defined HAVE_HPUX_ACLS
++
++/*
++ * Based on the Solaris & UnixWare code.
++ */
++
++#undef GROUP
++#include <sys/aclv.h>
++
++/* SVR4.2 ES/MP ACLs */
++typedef int SMB_ACL_TAG_T;
++typedef int SMB_ACL_TYPE_T;
++typedef ushort *SMB_ACL_PERMSET_T;
++typedef ushort SMB_ACL_PERM_T;
++#define SMB_ACL_READ 4
++#define SMB_ACL_WRITE 2
++#define SMB_ACL_EXECUTE 1
++
++/* Types of ACLs. */
++#define SMB_ACL_USER USER
++#define SMB_ACL_USER_OBJ USER_OBJ
++#define SMB_ACL_GROUP GROUP
++#define SMB_ACL_GROUP_OBJ GROUP_OBJ
++#define SMB_ACL_OTHER OTHER_OBJ
++#define SMB_ACL_MASK CLASS_OBJ
++
++typedef struct SMB_ACL_T {
++ int size;
++ int count;
++ int next;
++ struct acl acl[1];
++} *SMB_ACL_T;
++
++typedef struct acl *SMB_ACL_ENTRY_T;
++
++#define SMB_ACL_FIRST_ENTRY 0
++#define SMB_ACL_NEXT_ENTRY 1
++
++#define SMB_ACL_TYPE_ACCESS 0
++#define SMB_ACL_TYPE_DEFAULT 1
++
++#elif defined HAVE_IRIX_ACLS
++
++#define SMB_ACL_TAG_T acl_tag_t
++#define SMB_ACL_TYPE_T acl_type_t
++#define SMB_ACL_PERMSET_T acl_permset_t
++#define SMB_ACL_PERM_T acl_perm_t
++#define SMB_ACL_READ ACL_READ
++#define SMB_ACL_WRITE ACL_WRITE
++#define SMB_ACL_EXECUTE ACL_EXECUTE
++
++/* Types of ACLs. */
++#define SMB_ACL_USER ACL_USER
++#define SMB_ACL_USER_OBJ ACL_USER_OBJ
++#define SMB_ACL_GROUP ACL_GROUP
++#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ
++#define SMB_ACL_OTHER ACL_OTHER_OBJ
++#define SMB_ACL_MASK ACL_MASK
++
++typedef struct SMB_ACL_T {
++ int next;
++ BOOL freeaclp;
++ struct acl *aclp;
++} *SMB_ACL_T;
++
++#define SMB_ACL_ENTRY_T acl_entry_t
++
++#define SMB_ACL_FIRST_ENTRY 0
++#define SMB_ACL_NEXT_ENTRY 1
++
++#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS
++#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT
++
++#elif defined HAVE_AIX_ACLS
++
++/* Donated by Medha Date, mdate@austin.ibm.com, for IBM */
++
++#include "/usr/include/acl.h"
++
++typedef uint *SMB_ACL_PERMSET_T;
++
++struct acl_entry_link{
++ struct acl_entry_link *prevp;
++ struct new_acl_entry *entryp;
++ struct acl_entry_link *nextp;
++ int count;
++};
++
++struct new_acl_entry{
++ unsigned short ace_len;
++ unsigned short ace_type;
++ unsigned int ace_access;
++ struct ace_id ace_id[1];
++};
++
++#define SMB_ACL_ENTRY_T struct new_acl_entry*
++#define SMB_ACL_T struct acl_entry_link*
++
++#define SMB_ACL_TAG_T unsigned short
++#define SMB_ACL_TYPE_T int
++#define SMB_ACL_PERM_T uint
++#define SMB_ACL_READ S_IRUSR
++#define SMB_ACL_WRITE S_IWUSR
++#define SMB_ACL_EXECUTE S_IXUSR
++
++/* Types of ACLs. */
++#define SMB_ACL_USER ACEID_USER
++#define SMB_ACL_USER_OBJ 3
++#define SMB_ACL_GROUP ACEID_GROUP
++#define SMB_ACL_GROUP_OBJ 4
++#define SMB_ACL_OTHER 5
++#define SMB_ACL_MASK 6
++
++
++#define SMB_ACL_FIRST_ENTRY 1
++#define SMB_ACL_NEXT_ENTRY 2
++
++#define SMB_ACL_TYPE_ACCESS 0
++#define SMB_ACL_TYPE_DEFAULT 1
++
++#else /* No ACLs. */
++
++/* No ACLS - fake it. */
++#define SMB_ACL_TAG_T int
++#define SMB_ACL_TYPE_T int
++#define SMB_ACL_PERMSET_T mode_t
++#define SMB_ACL_PERM_T mode_t
++#define SMB_ACL_READ S_IRUSR
++#define SMB_ACL_WRITE S_IWUSR
++#define SMB_ACL_EXECUTE S_IXUSR
++
++/* Types of ACLs. */
++#define SMB_ACL_USER 0
++#define SMB_ACL_USER_OBJ 1
++#define SMB_ACL_GROUP 2
++#define SMB_ACL_GROUP_OBJ 3
++#define SMB_ACL_OTHER 4
++#define SMB_ACL_MASK 5
++
++typedef struct SMB_ACL_T {
++ int dummy;
++} *SMB_ACL_T;
++
++typedef struct SMB_ACL_ENTRY_T {
++ int dummy;
++} *SMB_ACL_ENTRY_T;
++
++#define SMB_ACL_FIRST_ENTRY 0
++#define SMB_ACL_NEXT_ENTRY 1
++
++#define SMB_ACL_TYPE_ACCESS 0
++#define SMB_ACL_TYPE_DEFAULT 1
++
++#endif /* No ACLs. */
++#endif /* _SMB_ACLS_H */
+--- old/testsuite/default-acls.test
++++ new/testsuite/default-acls.test
+@@ -0,0 +1,55 @@
++#! /bin/sh
++
++# This program is distributable under the terms of the GNU GPL see
++# COPYING).
++
++# Test that rsync obeys default ACLs. -- Matt McCutchen
++
++. $srcdir/testsuite/rsync.fns
++
++$RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
++setfacl -dm u::rwx,g::---,o::--- "$scratchdir" || test_skipped "Your filesystem has ACLs disabled"
++
++# Call as: testit <dirname> <default-acl> <file-expected> <program-expected>
++testit() {
++ todir="$scratchdir/$1"
++ mkdir "$todir"
++ # FIXME This doesn't work on solaris...
++ setfacl -k "$todir"
++ [ "$2" ] && setfacl -dm "$2" "$todir"
++ # Make sure we obey ACLs 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" $4 "Target $1"
++ check_perms "$todir/to/dir" $4 "Target $1"
++ check_perms "$todir/to/file" $3 "Target $1"
++ check_perms "$todir/to/program" $4 "Target $1"
++ # Make sure get_local_name doesn't mess us up when transferring only one file
++ $RSYNC -rvv "$scratchdir/file" "$todir/to/anotherfile"
++ check_perms "$todir/to/anotherfile" $3 "Target $1"
++ # Make sure we obey default ACLs when not transferring a regular file
++ $RSYNC -rvv "$scratchdir/dir/" "$todir/to/anotherdir/"
++ check_perms "$todir/to/anotherdir" $4 "Target $1"
++}
++
++mkdir "$scratchdir/dir"
++echo "File!" >"$scratchdir/file"
++echo "#!/bin/sh" >"$scratchdir/program"
++chmod 777 "$scratchdir/dir"
++chmod 666 "$scratchdir/file"
++chmod 777 "$scratchdir/program"
++
++# Test some target directories
++umask 0077
++testit da777 u::rwx,g::rwx,o::rwx rw-rw-rw- rwxrwxrwx
++testit da775 u::rwx,g::rwx,o::r-x rw-rw-r-- rwxrwxr-x
++testit da750 u::rwx,g::r-x,o::--- rw-r----- rwxr-x---
++testit da770mask u::rwx,g::---,m::rwx,o::--- rw-rw---- rwxrwx---
++testit noda1 '' rw------- rwx------
++umask 0000
++testit noda2 '' rw-rw-rw- rwxrwxrwx
++umask 0022
++testit noda3 '' rw-r--r-- rwxr-xr-x
++
++# Hooray
++exit 0
+--- old/uidlist.c
++++ new/uidlist.c
+@@ -34,6 +34,7 @@
+ extern int verbose;
+ extern int preserve_uid;
+ extern int preserve_gid;
++extern int preserve_acls;
+ extern int numeric_ids;
+ extern int am_root;
+
+@@ -274,7 +275,7 @@ void send_uid_list(int f)
+ if (numeric_ids)
+ return;