--- old/Makefile.in
+++ new/Makefile.in
-@@ -27,13 +27,13 @@ VERSION=@VERSION@
+@@ -28,13 +28,13 @@ VERSION=@VERSION@
HEADERS=byteorder.h config.h errcode.h proto.h rsync.h smb_acls.h lib/pool_alloc.h
LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
--- old/configure.in
+++ new/configure.in
-@@ -823,6 +823,30 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
+@@ -856,6 +856,30 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_
AC_MSG_RESULT(no)
)
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -494,7 +495,7 @@ static struct file_struct *receive_file_
+@@ -498,7 +499,7 @@ static struct file_struct *receive_file_
char thisname[MAXPATHLEN];
unsigned int l1 = 0, l2 = 0;
int alloc_len, basename_len, dirname_len, linkname_len, sum_len;
int xtra_len;
#endif
OFF_T file_length;
-@@ -606,10 +607,16 @@ static struct file_struct *receive_file_
+@@ -610,10 +611,16 @@ static struct file_struct *receive_file_
xtra_len = (S_ISDIR(mode) ? 2 : 1) * 4;
else
xtra_len = 0;
+ xtra_len
#endif
+ linkname_len + sum_len;
-@@ -618,7 +625,7 @@ static struct file_struct *receive_file_
+@@ -622,7 +629,7 @@ static struct file_struct *receive_file_
file = (struct file_struct *)bp;
memset(bp, 0, file_struct_len);
bp += file_struct_len;
bp += xtra_len;
#endif
-@@ -717,6 +724,10 @@ static struct file_struct *receive_file_
+@@ -723,6 +730,10 @@ static struct file_struct *receive_file_
if (preserve_acls)
receive_acl(file, f);
#endif
return file;
}
-@@ -987,6 +998,13 @@ static struct file_struct *send_file_nam
+@@ -994,6 +1005,13 @@ static struct file_struct *send_file_nam
return NULL;
}
#endif
maybe_emit_filelist_progress(flist->count + flist_count_offset);
-@@ -999,11 +1017,19 @@ static struct file_struct *send_file_nam
+@@ -1006,11 +1024,19 @@ static struct file_struct *send_file_nam
if (preserve_acls)
send_acl(&sx, f);
#endif
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature
-@@ -284,7 +288,7 @@ void usage(enum logcode F)
+@@ -288,7 +292,7 @@ void usage(enum logcode F)
rprintf(F," -v, --verbose increase verbosity\n");
rprintf(F," -q, --quiet suppress non-error messages\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");
-@@ -308,6 +312,9 @@ void usage(enum logcode F)
+@@ -313,6 +317,9 @@ void usage(enum logcode F)
#ifdef SUPPORT_ACLS
rprintf(F," -A, --acls preserve ACLs (implies --perms)\n");
#endif
+#ifdef SUPPORT_XATTRS
+ rprintf(F," -X, --xattrs preserve extended attributes (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");
-@@ -428,6 +435,9 @@ static struct poptOption long_options[]
+ rprintf(F," --devices preserve device files (super-user only)\n");
+@@ -433,6 +440,9 @@ static struct poptOption long_options[]
{"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 },
-@@ -1105,6 +1115,17 @@ int parse_arguments(int *argc, const cha
+@@ -1114,6 +1124,17 @@ int parse_arguments(int *argc, const cha
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
-@@ -1555,6 +1576,10 @@ void server_options(char **args,int *arg
+@@ -1560,6 +1581,10 @@ void server_options(char **args,int *arg
if (preserve_acls)
argstr[x++] = 'A';
#endif
if (preserve_gid)
--- old/rsync.c
+++ new/rsync.c
-@@ -34,6 +34,7 @@ extern int verbose;
+@@ -33,6 +33,7 @@
+ extern int verbose;
extern int dry_run;
- extern int logfile_format_has_i;
extern int preserve_acls;
+extern int preserve_xattrs;
extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
-@@ -223,6 +224,10 @@ int set_file_attrs(char *fname, struct f
+@@ -229,6 +230,10 @@ int set_file_attrs(char *fname, struct f
if (preserve_acls && set_acl(fname, file, sxp) == 0)
updated = 1;
#endif
+#endif
#ifdef HAVE_CHMOD
- if ((sxp->st.st_mode & CHMOD_BITS) != (file->mode & CHMOD_BITS)) {
+ if ((sxp->st.st_mode & CHMOD_BITS) != (new_mode & CHMOD_BITS)) {
--- old/rsync.h
+++ new/rsync.h
-@@ -495,6 +495,10 @@ struct idev {
+@@ -501,6 +501,10 @@ struct idev {
#define ACLS_NEED_MASK 1
#endif
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -687,6 +691,9 @@ typedef struct {
+@@ -695,6 +699,9 @@ typedef struct {
struct rsync_acl *acc_acl; /* access ACL */
struct rsync_acl *def_acl; /* default ACL */
#endif
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-R, --relative use relative path names
-@@ -322,6 +322,7 @@ to the detailed description below for a
- -p, --perms preserve permissions
+@@ -323,6 +323,7 @@ to the detailed description below for a
-E, --executability preserve executability
+ --chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p) [non-standard]
+ -X, --xattrs preserve extended attrs (implies -p) [n.s.]
- --chmod=CHMOD change destination permissions
-o, --owner preserve owner (super-user only)
-g, --group preserve group
-@@ -811,6 +812,11 @@ version makes it incompatible with sendi
+ --devices preserve device files (super-user only)
+@@ -810,6 +811,11 @@ version makes it incompatible with sendi
rsync unless you double the bf(--acls) option (e.g. bf(-AA)). This
doubling is not needed when pulling files from an older rsync.
transfer. The resulting value is treated as though it was the permissions
--- old/xattr.c
+++ new/xattr.c
-@@ -0,0 +1,358 @@
+@@ -0,0 +1,360 @@
+/*
+ * Extended Attribute support for rsync.
+ * Written by Jay Fenlason, vaguely based on the ACLs patch.
+static void rsync_xal_store(item_list *xalp)
+{
+ item_list *new_lst = EXPAND_ITEM_LIST(&rsync_xal_l, item_list, RSYNC_XAL_LIST_INITIAL);
-+ EXPAND_ITEM_LIST(new_lst, item_list, xalp->count);
++ /* Since the following call starts a new list, we know it will hold the
++ * entire initial-count, not just enough space for one new item. */
++ (void)EXPAND_ITEM_LIST(new_lst, item_list, xalp->count);
+ memcpy(new_lst->items, xalp->items, xalp->count * sizeof (item_list));
+ new_lst->count = xalp->count;
+ xalp->count = 0;