#ifdef HAVE_PUTENV
if (*lp_prexfer_exec(i) || *lp_postxfer_exec(i)) {
-@@ -638,6 +641,9 @@ static int rsync_module(int f_in, int f_
+@@ -642,6 +645,9 @@ static int rsync_module(int f_in, int f_
rprintf(FLOG, "rsync %s %s from %s@%s (%s)\n",
am_sender ? "on" : "to",
request, auth_user, host, addr);
am_sender ? "on" : "to",
--- old/configure.in
+++ new/configure.in
-@@ -642,6 +642,12 @@ if test x"$with_included_popt" != x"yes"
+@@ -643,6 +643,12 @@ if test x"$with_included_popt" != x"yes"
AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
fi
char *filter;
char *gid;
char *hosts_allow;
-@@ -141,14 +148,20 @@ typedef struct
+@@ -141,15 +148,21 @@ typedef struct
char *prexfer_exec;
char *refuse_options;
char *secrets_file;
int timeout;
+ BOOL database_logging;
+ BOOL fake_super;
+ BOOL get_custom_id_before_insert;
BOOL ignore_errors;
BOOL ignore_nonreadable;
BOOL list;
-@@ -168,9 +181,16 @@ static service sDefault =
+@@ -169,9 +182,16 @@ static service sDefault =
{
/* auth_users; */ NULL,
/* comment; */ NULL,
/* filter; */ NULL,
/* gid; */ NOBODY_GROUP,
/* hosts_allow; */ NULL,
-@@ -188,14 +208,20 @@ static service sDefault =
+@@ -189,15 +209,21 @@ static service sDefault =
/* prexfer_exec; */ NULL,
/* refuse_options; */ NULL,
/* secrets_file; */ NULL,
/* timeout; */ 0,
+ /* database_logging; */ False,
+ /* fake_super; */ False,
+ /* get_custom_id_before_insert; */ True,
/* ignore_errors; */ False,
/* ignore_nonreadable; */ False,
/* list; */ True,
-@@ -294,10 +320,19 @@ static struct parm_struct parm_table[] =
+@@ -296,11 +322,20 @@ static struct parm_struct parm_table[] =
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL,0},
{"exclude from", P_STRING, P_LOCAL, &sDefault.exclude_from, NULL,0},
{"exclude", P_STRING, P_LOCAL, &sDefault.exclude, NULL,0},
+ {"exit table name", P_STRING, P_LOCAL, &sDefault.exit_table_name, NULL,0},
+ {"fake super", P_BOOL, P_LOCAL, &sDefault.fake_super, NULL,0},
{"filter", P_STRING, P_LOCAL, &sDefault.filter, NULL,0},
+ {"get custom id before insert",P_BOOL,P_LOCAL,&sDefault.get_custom_id_before_insert,NULL,0},
{"gid", P_STRING, P_LOCAL, &sDefault.gid, NULL,0},
{"hosts allow", P_STRING, P_LOCAL, &sDefault.hosts_allow, NULL,0},
{"hosts deny", P_STRING, P_LOCAL, &sDefault.hosts_deny, NULL,0},
-@@ -322,12 +357,16 @@ static struct parm_struct parm_table[] =
+@@ -325,12 +360,16 @@ static struct parm_struct parm_table[] =
{"read only", P_BOOL, P_LOCAL, &sDefault.read_only, NULL,0},
{"refuse options", P_STRING, P_LOCAL, &sDefault.refuse_options, NULL,0},
{"secrets file", P_STRING, P_LOCAL, &sDefault.secrets_file, NULL,0},
{"use chroot", P_BOOL, P_LOCAL, &sDefault.use_chroot, NULL,0},
{"write only", P_BOOL, P_LOCAL, &sDefault.write_only, NULL,0},
{NULL, P_BOOL, P_NONE, NULL, NULL,0}
-@@ -383,9 +422,16 @@ FN_GLOBAL_INTEGER(lp_rsync_port, &Global
+@@ -386,9 +425,16 @@ FN_GLOBAL_INTEGER(lp_rsync_port, &Global
FN_LOCAL_STRING(lp_auth_users, auth_users)
FN_LOCAL_STRING(lp_comment, comment)
FN_LOCAL_STRING(lp_filter, filter)
FN_LOCAL_STRING(lp_gid, gid)
FN_LOCAL_STRING(lp_hosts_allow, hosts_allow)
-@@ -403,14 +449,20 @@ FN_LOCAL_STRING(lp_postxfer_exec, postxf
+@@ -406,15 +452,21 @@ FN_LOCAL_STRING(lp_postxfer_exec, postxf
FN_LOCAL_STRING(lp_prexfer_exec, prexfer_exec)
FN_LOCAL_STRING(lp_refuse_options, refuse_options)
FN_LOCAL_STRING(lp_secrets_file, secrets_file)
FN_LOCAL_INTEGER(lp_timeout, timeout)
+FN_LOCAL_BOOL(lp_database_logging, database_logging)
+ FN_LOCAL_BOOL(lp_fake_super, fake_super)
+FN_LOCAL_BOOL(lp_get_custom_id_before_insert,get_custom_id_before_insert)
FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
--- old/acls.c
+++ new/acls.c
-@@ -307,6 +307,9 @@ static BOOL unpack_smb_acl(SMB_ACL_T sac
+@@ -306,6 +306,9 @@ static BOOL unpack_smb_acl(SMB_ACL_T sac
}
access = (sys_acl_get_perm(permset, SMB_ACL_READ) ? 4 : 0)
| (sys_acl_get_perm(permset, SMB_ACL_WRITE) ? 2 : 0)
| (sys_acl_get_perm(permset, SMB_ACL_EXECUTE) ? 1 : 0);
/* continue == done with entry; break == store in temporary ida list */
switch (tag_type) {
-@@ -401,6 +404,12 @@ static int store_access_in_entry(uchar a
+@@ -400,6 +403,12 @@ static int store_access_in_entry(uchar a
COE( sys_acl_get_permset,(entry, &permset) );
COE( sys_acl_clear_perms,(permset) );
if (access & 4)
COE( sys_acl_add_perm,(permset, SMB_ACL_READ) );
if (access & 2)
-@@ -434,7 +443,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+@@ -433,7 +442,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
COE( sys_acl_create_entry,(smb_acl, &entry) );
COE( sys_acl_set_tag_type,(entry, SMB_ACL_USER_OBJ) );
for (ida = racl->users.idas, count = racl->users.count; count--; ida++) {
COE( sys_acl_create_entry,(smb_acl, &entry) );
-@@ -445,7 +454,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+@@ -444,7 +453,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
COE( sys_acl_create_entry,(smb_acl, &entry) );
COE( sys_acl_set_tag_type,(entry, SMB_ACL_GROUP_OBJ) );
for (ida = racl->groups.idas, count = racl->groups.count; count--; ida++) {
COE( sys_acl_create_entry,(smb_acl, &entry) );
-@@ -455,7 +464,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+@@ -454,7 +463,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
}
#ifdef ACLS_NEED_MASK
COE( sys_acl_create_entry,(smb_acl, &entry) );
COE( sys_acl_set_tag_type,(entry, SMB_ACL_MASK) );
COE2( store_access_in_entry,(mask_bits, entry) );
-@@ -469,7 +478,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
+@@ -468,7 +477,7 @@ static BOOL pack_smb_acl(SMB_ACL_T *smb_
COE( sys_acl_create_entry,(smb_acl, &entry) );
COE( sys_acl_set_tag_type,(entry, SMB_ACL_OTHER) );
#ifdef DEBUG
if (sys_acl_valid(*smb_acl) < 0)
-@@ -766,7 +775,7 @@ static void old_recv_rsync_acl(rsync_acl
+@@ -765,7 +774,7 @@ static void old_recv_rsync_acl(rsync_acl
while (count--) {
char tag = read_byte(f);
uchar access = read_byte(f);
rprintf(FERROR, "old_recv_rsync_acl: bogus permset %o\n",
access);
exit_cleanup(RERR_STREAMIO);
-@@ -832,7 +841,7 @@ static void old_recv_rsync_acl(rsync_acl
+@@ -831,7 +840,7 @@ static void old_recv_rsync_acl(rsync_acl
racl->mask_obj = NO_ENTRY;
}
} else if (racl->mask_obj == NO_ENTRY) /* Must be non-empty with lists. */
}
/* Receive the ACL info the sender has included for this file-list entry. */
-@@ -904,7 +913,7 @@ static uchar recv_acl_access(uchar *name
+@@ -903,7 +912,7 @@ static uchar recv_acl_access(uchar *name
*name_follows_val = 0;
}
rprintf(FERROR, "recv_acl_access: bogus permset %o\n", access);
exit_cleanup(RERR_STREAMIO);
}
---- old/smb_acls.h
-+++ new/smb_acls.h
-@@ -33,6 +33,11 @@
+--- old/lib/sysacls.h
++++ new/lib/sysacls.h
+@@ -45,6 +45,11 @@
#define SMB_ACL_READ ACL_READ
#define SMB_ACL_WRITE ACL_WRITE
#define SMB_ACL_EXECUTE ACL_EXECUTE
--- old/compat.c
+++ new/compat.c
-@@ -64,6 +64,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -94,6 +94,8 @@ void setup_protocol(int f_out,int f_in)
preserve_uid = ++file_extra_cnt;
if (preserve_gid)
preserve_gid = ++file_extra_cnt;
f_name(f, NULL));
}
}
-@@ -353,6 +357,7 @@ int push_flist_dir(const char *dir, int
+@@ -333,6 +337,7 @@ int push_flist_dir(const char *dir, int
static void send_file_entry(int f, struct file_struct *file, int ndx)
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -420,6 +425,13 @@ static void send_file_entry(int f, struc
+@@ -400,6 +405,13 @@ static void send_file_entry(int f, struc
flags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
#ifdef SUPPORT_HARD_LINKS
if (tmp_dev != 0) {
-@@ -491,6 +503,8 @@ static void send_file_entry(int f, struc
+@@ -471,6 +483,8 @@ static void send_file_entry(int f, struc
}
if (!(flags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (preserve_uid && !(flags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -577,7 +591,7 @@ static void send_file_entry(int f, struc
+@@ -557,7 +571,7 @@ static void send_file_entry(int f, struc
static struct file_struct *recv_file_entry(struct file_list *flist,
int flags, int f)
{
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -686,6 +700,16 @@ static struct file_struct *recv_file_ent
+@@ -666,6 +680,16 @@ static struct file_struct *recv_file_ent
}
if (!(flags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
-@@ -810,6 +834,8 @@ static struct file_struct *recv_file_ent
+@@ -790,6 +814,8 @@ static struct file_struct *recv_file_ent
F_OWNER(file) = uid;
if (preserve_gid)
F_GROUP(file) = gid;
if (basename != thisname) {
file->dirname = lastdir;
-@@ -1119,6 +1145,8 @@ struct file_struct *make_file(const char
+@@ -1099,6 +1125,8 @@ struct file_struct *make_file(const char
F_OWNER(file) = st.st_uid;
if (preserve_gid)
F_GROUP(file) = st.st_gid;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -323,8 +324,9 @@ void usage(enum logcode F)
+@@ -325,8 +326,9 @@ void usage(enum logcode F)
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
- rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
+ rprintf(F," -t, --times preserve modify times\n");
+ rprintf(F," -O, --omit-dir-times omit directories when preserving modify times\n");
-+ rprintf(F," -U, --atimes preserve access (use) times\n");
++ rprintf(F," -U, --atimes preserve access (last-used) times\n");
rprintf(F," --super receiver attempts super-user activities\n");
- rprintf(F," -S, --sparse handle sparse files efficiently\n");
- rprintf(F," -n, --dry-run show what would have been transferred\n");
-@@ -451,6 +453,9 @@ static struct poptOption long_options[]
+ #ifdef SUPPORT_XATTRS
+ rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
+@@ -456,6 +458,9 @@ static struct poptOption long_options[]
{"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 },
{"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
-@@ -1603,6 +1608,8 @@ void server_options(char **args,int *arg
+@@ -1617,6 +1622,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
mode_t new_mode = file->mode;
if (!sxp) {
-@@ -259,18 +261,36 @@ int set_file_attrs(const char *fname, st
- set_xattr(fname, file, fnamecmp, sxp);
+@@ -261,18 +263,36 @@ int set_file_attrs(const char *fname, st
+ set_stat_xattr(fname, file);
#endif
+ /* This code must be the first update in the function due to
/* These flags are used in the live flist data. */
-@@ -136,6 +137,7 @@
+@@ -141,6 +142,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -568,6 +570,7 @@ struct file_struct {
+@@ -573,6 +575,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int preserve_xattrs;
-@@ -602,6 +605,7 @@ extern int preserve_xattrs;
+@@ -607,6 +610,7 @@ extern int preserve_xattrs;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
+ -O, --omit-dir-times omit directories when preserving mod-times
+ -U, --atimes preserve access (use) times
--super receiver attempts super-user activities
+ --fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
- -n, --dry-run show what would have been transferred
-@@ -908,6 +909,12 @@ it is preserving modification times (see
+@@ -909,6 +910,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
dit(bf(--super)) This tells the receiving side to attempt super-user
activities even if the receiving rsync wasn't run by the super-user. These
activities include: preserving users via the bf(--owner) option, preserving
-@@ -1494,7 +1501,7 @@ quote(itemization(
+@@ -1523,7 +1530,7 @@ quote(itemization(
by the file transfer.
it() A bf(t) means the modification time is different and is being updated
to the sender's value (requires bf(--times)). An alternate value of bf(T)
anytime a symlink is transferred, or when a file or device is transferred
without bf(--times).
it() A bf(p) means the permissions are different and are being updated to
-@@ -1503,8 +1510,10 @@ quote(itemization(
+@@ -1532,8 +1539,10 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
+exit 0
--- old/testsuite/rsync.fns
+++ new/testsuite/rsync.fns
-@@ -66,7 +66,7 @@ printmsg() {
- }
-
- rsync_ls_lR() {
-- find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls"
-+ find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS
- }
-
- check_perms() {
@@ -184,6 +184,10 @@ checkit() {
# We can just write everything to stdout/stderr, because the
# wrapper hides it unless there is a problem.
--- old/tls.c
+++ new/tls.c
-@@ -34,6 +34,7 @@
- * change. */
-
- #include "rsync.h"
-+#include "popt.h"
-
- #define PROGRAM "tls"
-
-@@ -43,6 +44,8 @@ int read_only = 1;
- int list_only = 0;
- int preserve_perms = 0;
+@@ -94,6 +94,8 @@ static int stat_xattr(const char *fname,
+ return 0;
+ }
+static int display_atime = 0;
+
static void failed(char const *what, char const *where)
{
fprintf(stderr, PROGRAM ": %s %s: %s\n",
-@@ -50,12 +53,29 @@ static void failed(char const *what, cha
+@@ -101,12 +103,29 @@ static void failed(char const *what, cha
exit(1);
}
char linkbuf[4096];
if (do_lstat(fname, &buf) < 0)
-@@ -88,19 +108,8 @@ static void list_file(const char *fname)
+@@ -141,19 +160,8 @@ static void list_file(const char *fname)
permstring(permbuf, buf.st_mode);
/* TODO: Perhaps escape special characters in fname? */
-@@ -111,23 +120,55 @@ static void list_file(const char *fname)
+@@ -164,13 +172,15 @@ static void list_file(const char *fname)
(long)minor(buf.st_rdev));
} else /* NB: use double for size since it might not fit in a long. */
printf("%12.0f", (double)buf.st_size);
- datebuf, fname, linkbuf);
+ mtimebuf, display_atime && !S_ISDIR(buf.st_mode) ? atimebuf : "",
+ fname, linkbuf);
-+}
-+
-+static struct poptOption long_options[] = {
-+ /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-+ {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
-+ {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0},
-+ {0,0,0,0,0,0,0}
-+};
-+
-+static void tls_usage(int ret)
-+{
-+ fprintf(stderr, "usage: " PROGRAM " [--atime | -u] FILE ...\n"
-+ "Trivial file listing program for portably checking rsync\n");
-+ exit(ret);
}
- int
- main(int argc, char *argv[])
- {
-- if (argc < 2) {
-- fprintf(stderr, "usage: " PROGRAM " FILE ...\n"
-- "Trivial file listing program for portably checking rsync\n");
-- return 1;
-- }
-+ poptContext pc;
-+ const char **extra_args;
-+ int opt;
-
-- for (argv++; *argv; argv++) {
-- list_file(*argv);
-+ pc = poptGetContext(PROGRAM, argc, (const char **)argv,
-+ long_options, 0);
-+ while ((opt = poptGetNextOpt(pc)) != -1) {
-+ switch (opt) {
-+ case 'h':
-+ tls_usage(0);
-+ default:
-+ fprintf(stderr,
-+ "%s: %s\n",
-+ poptBadOption(pc, POPT_BADOPTION_NOALIAS),
-+ poptStrerror(opt));
-+ tls_usage(1);
-+ }
- }
-
-+ extra_args = poptGetArgs(pc);
-+ if (*extra_args == NULL)
-+ tls_usage(1);
-+
-+ for (; *extra_args; extra_args++)
-+ list_file(*extra_args);
-+ poptFreeContext(pc);
-+
- return 0;
- }
+ static struct poptOption long_options[] = {
+ /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
++ {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
+ {"fake-super", 'f', POPT_ARG_VAL, &am_root, -1, 0, 0 },
+ {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 },
+ {0,0,0,0,0,0,0}
+@@ -182,6 +192,7 @@ static void tls_usage(int ret)
+ fprintf(F,"usage: " PROGRAM " [OPTIONS] FILE ...\n");
+ fprintf(F,"Trivial file listing program for portably checking rsync\n");
+ fprintf(F,"\nOptions:\n");
++ rprintf(F," -U, --atimes display access (last-used) times\n");
+ fprintf(F," -f, --fake-super display attributes including fake-super xattrs\n");
+ fprintf(F," -h, --help show this help\n");
+ exit(ret);
--- old/util.c
+++ new/util.c
@@ -120,7 +120,7 @@ NORETURN void overflow_exit(const char *
--- old/compat.c
+++ new/compat.c
-@@ -115,13 +115,6 @@ void setup_protocol(int f_out,int f_in)
+@@ -147,13 +147,6 @@ void setup_protocol(int f_out,int f_in)
protocol_version);
exit_cleanup(RERR_PROTOCOL);
}
#define RSYNC_XAL_INITIAL 5
#define RSYNC_XAL_LIST_INITIAL 100
-@@ -222,7 +224,7 @@ static int rsync_xal_get(const char *fna
+@@ -231,7 +233,7 @@ static int rsync_xal_get(const char *fna
if (!(ptr = get_xattr_data(fname, name, &datum_len, 0)))
return -1;
/* For large datums, we store a flag and a checksum. */
name_offset = 1 + MAX_DIGEST_LEN;
sum_init(checksum_seed);
-@@ -278,7 +280,7 @@ static int find_matching_xattr(item_list
+@@ -295,7 +297,7 @@ static int find_matching_xattr(item_list
|| rxas1[j].datum_len != rxas2[j].datum_len
|| strcmp(rxas1[j].name, rxas2[j].name))
break;
if (memcmp(rxas1[j].datum + 1,
rxas2[j].datum + 1,
MAX_DIGEST_LEN) != 0)
-@@ -315,34 +317,43 @@ int send_xattr(statx *sxp, int f)
+@@ -332,34 +334,43 @@ int send_xattr(statx *sxp, int f)
{
int ndx = find_matching_xattr(sxp->xattr);
write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN);
else
write_buf(f, rxa->datum, rxa->datum_len);
-@@ -392,7 +403,7 @@ int xattr_diff(struct file_struct *file,
+@@ -409,7 +420,7 @@ int xattr_diff(struct file_struct *file,
cmp = rec_cnt ? strcmp(snd_rxa->name, rec_rxa->name) : -1;
if (cmp > 0)
same = 0;
same = cmp == 0 && snd_rxa->datum_len == rec_rxa->datum_len
&& memcmp(snd_rxa->datum + 1, rec_rxa->datum + 1,
MAX_DIGEST_LEN) == 0;
-@@ -435,6 +446,9 @@ void send_xattr_request(const char *fnam
+@@ -452,6 +463,9 @@ void send_xattr_request(const char *fnam
int j, cnt, prior_req = -1;
rsync_xa *rxa;
lst += F_XATTR(file);
cnt = lst->count;
for (rxa = lst->items, j = 0; j < cnt; rxa++, j++) {
-@@ -506,6 +520,9 @@ void recv_xattr_request(struct file_stru
+@@ -523,6 +537,9 @@ void recv_xattr_request(struct file_stru
rsync_xa *rxa;
int rel_pos, cnt;
if (F_XATTR(file) < 0) {
rprintf(FERROR, "recv_xattr_request: internal data error!\n");
exit_cleanup(RERR_STREAMIO);
-@@ -552,7 +569,22 @@ void receive_xattr(struct file_struct *f
+@@ -569,7 +586,22 @@ void receive_xattr(struct file_struct *f
{
static item_list temp_xattr = EMPTY_ITEM_LIST;
int count;
if (ndx < 0 || (size_t)ndx > rsync_xal_l.count) {
rprintf(FERROR, "receive_xattr: xa index %d out of"
-@@ -565,7 +597,7 @@ void receive_xattr(struct file_struct *f
+@@ -582,7 +614,7 @@ void receive_xattr(struct file_struct *f
return;
}
(void)EXPAND_ITEM_LIST(&temp_xattr, rsync_xa, count);
temp_xattr.count = 0;
}
-@@ -573,9 +605,10 @@ void receive_xattr(struct file_struct *f
+@@ -590,9 +622,10 @@ void receive_xattr(struct file_struct *f
while (count--) {
char *ptr, *name;
rsync_xa *rxa;
+ size_t datum_len = read_varint30(f);
+ size_t dget_len = datum_len > MAX_FULL_DATUM && protocol_version >= 30
+ ? 1 + MAX_DIGEST_LEN : datum_len;
- #ifdef HAVE_LINUX_XATTRS
- size_t extra_len = 0;
- #else
+ size_t extra_len = MIGHT_NEED_RPRE ? RPRE_LEN : 0;
+ if (dget_len + extra_len < dget_len)
+ out_of_memory("receive_xattr"); /* overflow */