After applying this patch, run these commands for a successful build:
- autoconf
- autoheader
+ ./prepare-source
./configure --enable-acl-support
- make proto
make
The program currently complains when the --acls (-A) option is used to copy
notice that no ACLs are available to copy. Of course, trying to write out
ACLs to a non-ACL-supporting disk should complain.
---- orig/Makefile.in 2006-01-14 08:14:29
-+++ Makefile.in 2005-11-07 04:31:05
+--- old/Makefile.in
++++ new/Makefile.in
@@ -25,15 +25,15 @@ VERSION=@VERSION@
.SUFFIXES:
.SUFFIXES: .c .o
OBJS3=progress.o pipe.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
---- orig/acls.c 2006-01-31 19:25:53
-+++ acls.c 2006-01-31 19:25:53
+--- old/acls.c
++++ new/acls.c
@@ -0,0 +1,1202 @@
+/* -*- c-file-style: "linux" -*-
+ Copyright (C) Andrew Tridgell 1996
+}
+
+#endif /* SUPPORT_ACLS */
---- orig/backup.c 2006-01-30 07:18:27
-+++ backup.c 2004-10-06 00:13:09
-@@ -135,6 +135,7 @@ static int make_bak_dir(char *fullpath)
+--- old/backup.c
++++ new/backup.c
+@@ -132,6 +132,7 @@ static int make_bak_dir(char *fullpath)
} else {
do_lchown(fullpath, st.st_uid, st.st_gid);
do_chmod(fullpath, st.st_mode);
}
}
*p = '/';
-@@ -188,6 +189,8 @@ static int keep_backup(char *fname)
+@@ -185,6 +186,8 @@ static int keep_backup(char *fname)
if (!(buf = get_backup_name(fname)))
return 0;
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
|| (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -263,6 +266,7 @@ static int keep_backup(char *fname)
+@@ -260,6 +263,7 @@ static int keep_backup(char *fname)
}
}
set_file_attrs(buf, file, NULL, 0);
free(file);
if (verbose > 1) {
---- orig/configure.in 2006-02-02 02:41:09
-+++ configure.in 2004-08-19 19:53:27
-@@ -478,6 +478,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
+--- old/configure.in
++++ new/configure.in
+@@ -482,6 +482,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
AC_CHECK_LIB(resolv, strcasecmp)
fi
dnl At the moment we don't test for a broken memcmp(), because all we
dnl need to do is test for equality, not comparison, and it seems that
dnl every platform has a memcmp that can do at least that.
-@@ -751,6 +756,77 @@ AC_SUBST(OBJ_RESTORE)
+@@ -738,6 +743,77 @@ AC_SUBST(OBJ_RESTORE)
AC_SUBST(CC_SHOBJ_FLAG)
AC_SUBST(BUILD_POPT)
AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
AC_OUTPUT
---- orig/flist.c 2006-01-31 02:30:18
-+++ flist.c 2006-01-31 02:37:33
-@@ -967,6 +967,8 @@ static struct file_struct *send_file_nam
+--- old/flist.c
++++ new/flist.c
+@@ -966,6 +966,8 @@ static struct file_struct *send_file_nam
f == -2 ? SERVER_FILTERS : ALL_FILTERS);
if (!file)
return NULL;
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
-@@ -978,6 +980,10 @@ static struct file_struct *send_file_nam
+@@ -977,6 +979,10 @@ static struct file_struct *send_file_nam
if (file->basename[0]) {
flist->files[flist->count++] = file;
send_file_entry(file, f);
}
return file;
}
-@@ -1366,6 +1372,8 @@ struct file_list *recv_file_list(int f)
+@@ -1365,6 +1371,8 @@ struct file_list *recv_file_list(int f)
flags |= read_byte(f) << 8;
file = receive_file_entry(flist, flags, f);
+ RECEIVE_ACL(file, f);
+
- if (S_ISREG(file->mode))
+ if (S_ISREG(file->mode) || S_ISLNK(file->mode))
stats.total_size += file->length;
-@@ -1388,6 +1396,8 @@ struct file_list *recv_file_list(int f)
+@@ -1387,6 +1395,8 @@ struct file_list *recv_file_list(int f)
clean_flist(flist, relative_paths, 1);
if (f >= 0) {
recv_uid_list(f, flist);
---- orig/generator.c 2006-01-31 18:59:39
-+++ generator.c 2006-02-03 05:44:04
-@@ -756,6 +756,7 @@ static int try_dests_non(struct file_str
+--- old/generator.c
++++ new/generator.c
+@@ -85,6 +85,7 @@ extern long block_size; /* "long" becaus
+ extern int max_delete;
+ extern int force_delete;
+ extern int one_file_system;
++extern mode_t orig_umask;
+ extern struct stats stats;
+ extern dev_t filesystem_dev;
+ extern char *backup_dir;
+@@ -753,6 +754,7 @@ static int try_dests_non(struct file_str
}
static int phase = 0;
/* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir,
* make sure it exists, and has the right permissions/timestamp info. For
-@@ -772,7 +773,7 @@ static void recv_generator(char *fname,
- enum logcode code, int f_out)
- {
- static int missing_below = -1, excluded_below = -1;
-- static char *fuzzy_dirname = "";
-+ static char *parent_dirname = "";
- static struct file_list *fuzzy_dirlist = NULL;
- struct file_struct *fuzzy_file = NULL;
- int fd = -1, f_copy = -1;
-@@ -791,12 +792,12 @@ static void recv_generator(char *fname,
- if (fuzzy_dirlist) {
- flist_free(fuzzy_dirlist);
- fuzzy_dirlist = NULL;
-- fuzzy_dirname = "";
- }
- if (missing_below >= 0) {
- dry_run--;
- missing_below = -1;
- }
-+ parent_dirname = "";
- return;
- }
-
-@@ -831,15 +832,20 @@ static void recv_generator(char *fname,
- statret = -1;
- stat_errno = ENOENT;
- } else {
-- if (fuzzy_basis && S_ISREG(file->mode)) {
-+ if ((fuzzy_basis || !preserve_perms) && S_ISREG(file->mode)) {
- char *dn = file->dirname ? file->dirname : ".";
-- if (fuzzy_dirname != dn
-- && strcmp(fuzzy_dirname, dn) != 0) {
-+ if (parent_dirname != dn
-+ && strcmp(parent_dirname, dn) != 0) {
- if (fuzzy_dirlist)
- flist_free(fuzzy_dirlist);
-- fuzzy_dirlist = get_dirlist(dn, -1, 1);
-+ if (fuzzy_basis)
-+ fuzzy_dirlist = get_dirlist(dn, -1, 1);
+@@ -844,6 +846,10 @@ static void recv_generator(char *fname,
+ }
+ if (fuzzy_basis)
+ need_fuzzy_dirlist = 1;
+#ifdef SUPPORT_ACLS
-+ if (!preserve_perms)
-+ dflt_perms = default_perms_for_dir(dn);
++ if (!preserve_perms)
++ dflt_perms = default_perms_for_dir(dn);
+#endif
- }
-- fuzzy_dirname = dn;
-+ parent_dirname = dn;
}
+ parent_dirname = dn;
- statret = link_stat(fname, &st,
-@@ -861,7 +867,8 @@ static void recv_generator(char *fname,
+@@ -871,7 +877,8 @@ static void recv_generator(char *fname,
if (!preserve_perms) {
int exists = statret == 0
&& S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
}
if (S_ISDIR(file->mode)) {
-@@ -895,6 +902,10 @@ static void recv_generator(char *fname,
+@@ -905,6 +912,10 @@ static void recv_generator(char *fname,
if (set_file_attrs(fname, file, statret ? NULL : &st, 0)
&& verbose && code && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
delete_in_dir(the_file_list, fname, file, &st);
-@@ -1330,6 +1341,8 @@ void generate_files(int f_out, struct fi
+@@ -1342,6 +1353,8 @@ void generate_files(int f_out, struct fi
* notice that and let us know via the redo pipe (or its closing). */
ignore_timeout = 1;
for (i = 0; i < flist->count; i++) {
struct file_struct *file = flist->files[i];
---- orig/lib/sysacls.c 2005-05-16 23:27:53
-+++ lib/sysacls.c 2005-05-16 23:27:53
+--- old/lib/sysacls.c
++++ new/lib/sysacls.c
@@ -0,0 +1,3242 @@
+/*
+ Unix SMB/CIFS implementation.
+#endif
+ return 0;
+}
---- orig/lib/sysacls.h 2005-05-16 23:25:51
-+++ lib/sysacls.h 2005-05-16 23:25:51
+--- old/lib/sysacls.h
++++ new/lib/sysacls.h
@@ -0,0 +1,28 @@
+#define SMB_MALLOC(cnt) new_array(char, cnt)
+#define SMB_MALLOC_P(obj) new_array(obj, 1)
+int sys_acl_free_text(char *text);
+int sys_acl_free_acl(SMB_ACL_T the_acl);
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
---- orig/mkproto.awk 2006-02-02 02:41:09
-+++ mkproto.awk 2006-02-02 02:41:47
+--- old/mkproto.awk
++++ new/mkproto.awk
@@ -58,7 +58,7 @@ BEGIN {
next;
}
next;
}
---- orig/options.c 2006-02-02 11:40:45
-+++ options.c 2006-02-02 11:45:46
-@@ -44,6 +44,7 @@ int keep_dirlinks = 0;
+--- 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_perms = 0;
int preserve_executability = 0;
int preserve_devices = 0;
-@@ -193,6 +194,7 @@ static void print_rsync_version(enum log
+@@ -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 *links = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
-@@ -209,6 +211,10 @@ static void print_rsync_version(enum log
+@@ -210,6 +212,10 @@ static void print_rsync_version(enum log
hardlinks = "";
#endif
#ifdef SUPPORT_LINKS
links = "";
#endif
-@@ -222,9 +228,9 @@ static void print_rsync_version(enum log
+@@ -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, "
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
-@@ -293,6 +299,7 @@ void usage(enum logcode F)
- rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
+@@ -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");
-@@ -409,6 +416,9 @@ static struct poptOption long_options[]
+@@ -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 },
{"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 },
-@@ -1057,6 +1067,24 @@ int parse_arguments(int *argc, const cha
+@@ -1068,6 +1080,23 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
+ case 'A':
+#ifdef SUPPORT_ACLS
-+ preserve_acls = 1;
-+ preserve_perms = 1;
++ preserve_acls = preserve_perms = 1;
+ break;
+#else
+ /* FIXME: this should probably be ignored with a
+ "ACLs are not supported on this %s\n",
+ am_server ? "server" : "client");
+ return 0;
-+#endif /* SUPPORT_ACLS */
++#endif
+
+
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1497,6 +1525,8 @@ void server_options(char **args,int *arg
+@@ -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)
---- orig/receiver.c 2006-01-31 02:30:18
-+++ receiver.c 2006-02-03 05:46:43
-@@ -410,6 +410,10 @@ int recv_files(int f_in, struct file_lis
+--- 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 i, recv_ok;
if (verbose > 2)
-@@ -607,7 +611,16 @@ int recv_files(int f_in, struct file_lis
+@@ -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;
}
/* We now check to see if we are writing file "inplace" */
---- orig/rsync.c 2006-02-02 02:41:09
-+++ rsync.c 2006-01-31 19:35:44
-@@ -53,7 +53,8 @@ void free_sums(struct sum_struct *s)
+--- old/rsync.c
++++ new/rsync.c
+@@ -101,7 +101,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 dest_mode, int exists)
-+mode_t dest_mode(mode_t flist_mode, mode_t dest_mode, int dflt_perms,
+-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,
+ /* If the file already exists, we'll return the local permissions,
* possibly tweaked by the --executability option. */
-@@ -68,7 +69,7 @@ mode_t dest_mode(mode_t flist_mode, mode
- dest_mode |= (dest_mode & 0444) >> 2;
+@@ -116,7 +117,7 @@ mode_t dest_mode(mode_t flist_mode, mode
+ cur_mode |= (cur_mode & 0444) >> 2;
}
} else
-- dest_mode = flist_mode & ~orig_umask;
-+ dest_mode = ((flist_mode & CHMOD_BITS) & dflt_perms) | S_IWUSR;
- return (flist_mode & ~CHMOD_BITS) | (dest_mode & CHMOD_BITS);
- }
-
-@@ -161,6 +162,14 @@ int set_file_attrs(char *fname, struct f
+- cur_mode = flist_mode & ACCESSPERMS & ~orig_umask;
++ cur_mode = (flist_mode & ACCESSPERMS & dflt_perms) | S_IWUSR;
+ 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);
+@@ -217,6 +218,14 @@ int set_file_attrs(char *fname, struct f
}
#endif
if (verbose > 1 && flags & ATTRS_REPORT) {
enum logcode code = daemon_log_format_has_i || dry_run
? FCLIENT : FINFO;
---- orig/rsync.h 2006-02-03 05:40:23
-+++ rsync.h 2006-01-31 19:27:00
-@@ -657,6 +657,44 @@ struct chmod_mode_struct;
+--- old/rsync.h
++++ new/rsync.h
+@@ -658,6 +658,44 @@ struct chmod_mode_struct;
#define UNUSED(x) x __attribute__((__unused__))
#include "proto.h"
/* We have replacement versions of these if they're missing. */
---- orig/rsync.yo 2006-01-31 03:05:44
-+++ rsync.yo 2006-01-31 03:14:05
-@@ -317,6 +317,7 @@ to the detailed description below for a
- -K, --keep-dirlinks treat symlinked dir on receiver as dir
+--- 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
-@@ -691,14 +692,23 @@ quote(itemize(
+@@ -742,7 +743,9 @@ quote(itemize(
permissions, though the bf(--executability) option might change just
the execute permission for the file.
- it() Each new file gets its permissions set based on the source file's
-- permissions, but masked by the receiving end's umask setting (including
-+ permissions, but masked by the receiving end's destination-default
-+ permissions (which is either based on the ACL of the destination
-+ directory, if available, or the receiving end's umask setting) and
-+ includes
- the stripping of the three special permission bits).
-+ Hint: Using bf(--chmod=ugo=rwX) without bf(--perms) will cause new
-+ files to get all the destination-default permissions.
+ 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.
))
-
- Thus, when bf(--perms) and bf(--executability) are both disabled,
- rsync's behavior is the same as that of other file-copy utilities,
- such as bf(cp)(1) and bf(tar)(1).
+@@ -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.)
-+This version of rsync observes default ACLs; patched versions of rsync only
-+applied the umask, and could thus set wrong permissions in the presence of
-+default ACLs.
-+
dit(bf(-E, --executability)) This option causes rsync to preserve the
executability (or non-executability) of regular files when bf(--perms) is
- not enabled. A regular file is considered to be executable if at least one
-@@ -713,6 +723,10 @@ quote(itemize(
+@@ -793,6 +798,10 @@ quote(itemize(
If bf(--perms) is enabled, this option is ignored.
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
---- orig/smb_acls.h 2004-06-30 00:04:07
-+++ smb_acls.h 2004-06-30 00:04:07
+--- old/smb_acls.h
++++ new/smb_acls.h
@@ -0,0 +1,277 @@
+/*
+ Unix SMB/Netbios implementation.
+
+#endif /* No ACLs. */
+#endif /* _SMB_ACLS_H */
---- orig/testsuite/default-acls-obey.test 2006-02-03 17:57:15
-+++ testsuite/default-acls-obey.test 2006-02-03 17:57:15
-@@ -0,0 +1,49 @@
+--- 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
+
+. $srcdir/testsuite/rsync.fns
+
-+$RSYNC --help | grep "ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
++$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>
-+function testit {
++testit() {
+ todir="$scratchdir/$1"
+ mkdir "$todir"
++ # FIXME This doesn't work on solaris...
+ setfacl -k "$todir"
-+ chmod g-s "$todir" ### Don't let directory setgid interfere
+ [ "$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/file" "$scratchdir/program" "$todir/to/"
++ $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/bash" >"$scratchdir/program"
++echo "#!/bin/sh" >"$scratchdir/program"
++chmod 777 "$scratchdir/dir"
+chmod 666 "$scratchdir/file"
+chmod 777 "$scratchdir/program"
+
+
+# Hooray
+exit 0
---- orig/uidlist.c 2006-01-25 17:15:13
-+++ uidlist.c 2006-01-25 17:45:21
+--- old/uidlist.c
++++ new/uidlist.c
@@ -34,6 +34,7 @@
extern int verbose;
extern int preserve_uid;