-After applying this patch, run these commands for a successful build:
+To use this patch, run these commands for a successful build:
+ patch -p1 <patches/acls.diff
./prepare-source
./configure --enable-acl-support
make
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
--- old/acls.c
+++ new/acls.c
-@@ -0,0 +1,1092 @@
+@@ -0,0 +1,1098 @@
+/*
+ * Handle passing Access Control Lists between systems.
+ *
+
+#ifdef SUPPORT_ACLS
+
-+extern int am_root;
+extern int dry_run;
++extern int read_only;
++extern int list_only;
+extern int orig_umask;
+extern int preserve_acls;
+extern unsigned int file_struct_len;
+ SMB_ACL_TYPE_T type;
+ char *ndx_ptr;
+
++ if (!dry_run && (read_only || list_only)) {
++ errno = EROFS;
++ return -1;
++ }
++
+ if (S_ISLNK(file->mode))
+ return 1;
+
AC_SUBST(CC_SHOBJ_FLAG)
AC_SUBST(BUILD_POPT)
-+AC_CHECK_HEADERS(sys/acl.h)
++AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
+AC_CHECK_FUNCS(_acl __acl _facl __facl)
+#################################################
+# check for ACL support
SIVAL(numbuf, 0, ndx);
--- old/lib/sysacls.c
+++ new/lib/sysacls.c
-@@ -0,0 +1,3247 @@
+@@ -0,0 +1,3251 @@
+/*
+ Unix SMB/CIFS implementation.
+ Samba system utilities for ACL support.
+#include "rsync.h"
+#include "sysacls.h" /****** ADDED ******/
+
++#ifdef SUPPORT_ACLS
++
+/****** EXTRAS -- THESE ITEMS ARE NOT FROM THE SAMBA SOURCE ******/
+#ifdef DEBUG
+#undef DEBUG
+#endif
+ return 0;
+}
++
++#endif /* SUPPORT_ACLS */
--- old/lib/sysacls.h
+++ new/lib/sysacls.h
-@@ -0,0 +1,33 @@
-+#if defined SUPPORT_ACLS && defined HAVE_SYS_ACL_H
+@@ -0,0 +1,40 @@
++#ifdef SUPPORT_ACLS
++
++#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif
++#ifdef HAVE_ACL_LIBACL_H
++#include <acl/libacl.h>
++#endif
+#include "smb_acls.h"
+
+#define SMB_MALLOC(cnt) new_array(char, cnt)
+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);
++
++#endif /* SUPPORT_ACLS */
--- old/log.c
+++ new/log.c
@@ -606,8 +606,10 @@ static void log_formatted(enum logcode c
#ifdef SUPPORT_LINKS
links = "";
#endif
-@@ -228,9 +234,9 @@ static void print_rsync_version(enum log
+@@ -227,17 +233,16 @@ static void print_rsync_version(enum log
+ RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
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, "
+- rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, "
- "%shard links, %ssymlinks, batchfiles,\n",
-+ "%shard links, %sACLs, %ssymlinks, batchfiles,\n",
- (int) (sizeof (OFF_T) * 8),
+- (int) (sizeof (OFF_T) * 8),
- got_socketpair, hardlinks, links);
-+ got_socketpair, hardlinks, acls, links);
++ rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, %shard links, %ssymlinks,\n",
++ (int) (sizeof (OFF_T) * 8), got_socketpair, hardlinks, links);
++
++ rprintf(f, " batchfiles, %sinplace, %sIPv6, %sACLs,\n",
++ have_inplace, ipv6, acls);
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
-@@ -284,7 +290,7 @@ void usage(enum logcode F)
+ * macros. */
+- rprintf(f, " %sinplace, %sIPv6, "
+- "%d-bit system inums, %d-bit internal inums\n",
+- have_inplace, ipv6,
++ rprintf(f, " %d-bit system inums, %d-bit internal inums\n",
+ (int) (sizeof dumstat->st_ino * 8),
+ (int) (sizeof (int64) * 8));
+ #ifdef MAINTAINER_MODE
+@@ -284,7 +289,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
rprintf(F," -R, --relative use relative path names\n");
-@@ -306,6 +312,9 @@ void usage(enum logcode F)
+@@ -306,6 +311,9 @@ void usage(enum logcode F)
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
-@@ -425,6 +434,9 @@ static struct poptOption long_options[]
+@@ -425,6 +433,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 },
-@@ -1089,6 +1101,24 @@ int parse_arguments(int *argc, const cha
+@@ -1089,6 +1100,24 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1530,6 +1560,10 @@ void server_options(char **args,int *arg
+@@ -1530,6 +1559,10 @@ void server_options(char **args,int *arg
if (preserve_hard_links)
argstr[x++] = 'H';
extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
-@@ -100,7 +101,8 @@ void free_sums(struct sum_struct *s)
+@@ -47,7 +48,6 @@ extern int preserve_gid;
+ extern int inplace;
+ extern int keep_dirlinks;
+ extern int make_backups;
+-extern mode_t orig_umask;
+ extern struct stats stats;
+ extern struct chmod_mode_struct *daemon_chmod_modes;
+
+@@ -100,7 +100,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. */
{
int new_mode;
/* If the file already exists, we'll return the local permissions,
-@@ -117,56 +119,65 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -117,56 +118,65 @@ mode_t dest_mode(mode_t flist_mode, mode
new_mode |= (new_mode & 0444) >> 2;
}
} else {
;
else
#endif
-@@ -176,45 +187,57 @@ int set_file_attrs(char *fname, struct f
+@@ -176,45 +186,57 @@ int set_file_attrs(char *fname, struct f
rprintf(FINFO,
"set uid of %s from %ld to %ld\n",
fname,
}
if (ret == 0) /* ret == 1 if symlink could not be set */
updated = 1;
-@@ -227,6 +250,11 @@ int set_file_attrs(char *fname, struct f
+@@ -227,6 +249,11 @@ int set_file_attrs(char *fname, struct f
else
rprintf(FCLIENT, "%s is uptodate\n", fname);
}
--- old/rsync.h
+++ new/rsync.h
-@@ -492,6 +492,15 @@ struct idev {
+@@ -492,6 +492,14 @@ struct idev {
#define IN_LOOPBACKNET 127
#endif
-+#if HAVE_POSIX_ACLS|HAVE_UNIXWARE_ACLS|HAVE_SOLARIS_ACLS|\
-+ HAVE_HPUX_ACLS|HAVE_IRIX_ACLS|HAVE_AIX_ACLS|HAVE_TRU64_ACLS
++#ifndef HAVE_NO_ACLS
+#define SUPPORT_ACLS 1
+#endif
+
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -653,6 +662,17 @@ struct stats {
+@@ -653,6 +661,17 @@ struct stats {
struct chmod_mode_struct;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -669,6 +689,16 @@ struct chmod_mode_struct;
+@@ -669,6 +688,16 @@ struct chmod_mode_struct;
#define UNUSED(x) x __attribute__((__unused__))
#define NORETURN __attribute__((__noreturn__))