--- old/acls.c
+++ new/acls.c
-@@ -98,6 +98,18 @@ static const char *str_acl_type(SMB_ACL_
+@@ -97,6 +97,18 @@ static const char *str_acl_type(SMB_ACL_
: "unknown SMB_ACL_TYPE_T";
}
static int calc_sacl_entries(const rsync_acl *racl)
{
/* A System ACL always gets user/group/other permission entries. */
-@@ -522,6 +534,96 @@ int get_acl(const char *fname, statx *sx
+@@ -545,6 +557,96 @@ int get_acl(const char *fname, stat_x *s
return 0;
}
+
/* === Send functions === */
- /* The general strategy with the tag_type <-> character mapping is that
-@@ -604,6 +706,11 @@ static void send_rsync_acl(rsync_acl *ra
+ /* Send the ida list over the file descriptor. */
+@@ -620,6 +722,11 @@ static void send_rsync_acl(rsync_acl *ra
* This also frees the ACL data. */
- void send_acl(statx *sxp, int f)
+ void send_acl(stat_x *sxp, int f)
{
+ if (protocol_version < 30) {
+ old_send_acl(sxp, f);
if (!sxp->acc_acl) {
sxp->acc_acl = create_racl();
rsync_acl_fake_perms(sxp->acc_acl, sxp->st.st_mode);
-@@ -621,6 +728,160 @@ void send_acl(statx *sxp, int f)
+@@ -637,6 +744,160 @@ void send_acl(stat_x *sxp, int f)
}
}
/* === Receive functions === */
static uint32 recv_acl_access(uchar *name_follows_ptr, int f)
-@@ -738,6 +999,11 @@ static int recv_rsync_acl(item_list *rac
+@@ -759,6 +1020,11 @@ static int recv_rsync_acl(item_list *rac
/* Receive the ACL info the sender has included for this file-list entry. */
void receive_acl(struct file_struct *file, int f)
{
if (S_ISDIR(file->mode))
--- old/compat.c
+++ new/compat.c
-@@ -163,13 +163,6 @@ void setup_protocol(int f_out,int f_in)
+@@ -160,13 +160,6 @@ void setup_protocol(int f_out,int f_in)
if (protocol_version < 30) {
if (append_mode == 1)
append_mode = 2;
extern int am_server;
@@ -343,6 +344,7 @@ int set_file_attrs(const char *fname, st
int updated = 0;
- statx sx2;
+ stat_x sx2;
int change_uid, change_gid;
+ time_t atime, mtime;
mode_t new_mode = file->mode;
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -579,6 +581,7 @@ extern int file_extra_cnt;
+@@ -582,6 +584,7 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -616,6 +619,7 @@ extern int xattrs_ndx;
+@@ -619,6 +622,7 @@ extern int xattrs_ndx;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
#define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
#define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
-@@ -354,6 +354,7 @@ to the detailed description below for a
+@@ -350,6 +350,7 @@ to the detailed description below for a
-D same as --devices --specials
-t, --times preserve modification times
-O, --omit-dir-times omit directories from --times
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -956,6 +957,12 @@ it is preserving modification times (see
+@@ -960,6 +961,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
-@@ -1633,8 +1640,10 @@ quote(itemization(
+@@ -1641,8 +1648,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).
backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len;
@@ -1451,6 +1481,31 @@ int parse_arguments(int *argc_p, const c
"P *%s", backup_suffix);
- parse_rule(&filter_list, backup_dir_buf, 0, 0);
+ parse_rule(&filter_list, backup_dir_buf, 0, 0);
}
+ /* If backup_dir_dels not supplied default to backup_dir if it has been supplied */
+ if (backup_dir && !backup_dir_dels) {
extern int size_only;
extern OFF_T max_size;
extern OFF_T min_size;
-@@ -571,6 +572,9 @@ void itemize(struct file_struct *file, i
+@@ -619,6 +620,9 @@ void itemize(const char *fnamecmp, struc
/* Perform our quick-check heuristic for determining if a file is unchanged. */
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
{
--- old/options.c
+++ new/options.c
-@@ -99,6 +99,7 @@ int keep_partial = 0;
+@@ -103,6 +103,7 @@ int keep_partial = 0;
int safe_symlinks = 0;
int copy_unsafe_links = 0;
int size_only = 0;
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
-@@ -340,6 +341,7 @@ void usage(enum logcode F)
+@@ -380,6 +381,7 @@ void usage(enum logcode F)
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
rprintf(F," --modify-window=NUM compare mod-times with reduced accuracy\n");
rprintf(F," -T, --temp-dir=DIR create temporary files in directory DIR\n");
rprintf(F," -y, --fuzzy find similar file for basis if no dest file\n");
-@@ -460,6 +462,7 @@ static struct poptOption long_options[]
+@@ -520,6 +522,7 @@ static struct poptOption long_options[]
{"chmod", 0, POPT_ARG_STRING, 0, OPT_CHMOD, 0, 0 },
{"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 },
{"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 },
{"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
-@@ -1692,6 +1695,9 @@ void server_options(char **args,int *arg
- args[ac++] = "--size-only";
+@@ -1897,6 +1900,9 @@ void server_options(char **args, int *ar
+ }
}
+ if (date_only)
goto oom;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -361,6 +361,7 @@ to the detailed description below for a
+@@ -382,6 +382,7 @@ to the detailed description below for a
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
--modify-window=NUM compare mod-times with reduced accuracy
-T, --temp-dir=DIR create temporary files in directory DIR
-y, --fuzzy find similar file for basis if no dest file
-@@ -478,6 +479,12 @@ regardless of timestamp. This is useful
- after using another mirroring system which may not preserve timestamps
- exactly.
+@@ -502,6 +503,12 @@ time to just looking for files that have
+ when starting to use rsync after using another mirroring system which may
+ not preserve timestamps exactly.
+dit(bf(--date-only)) Normally rsync will skip any files that are
+already the same size and have the same modification time-stamp. With the
+++ new/fileio.c
@@ -30,6 +30,12 @@ extern int sparse_files;
static char last_byte;
- static int last_sparse;
+ static size_t sparse_seek = 0;
+#ifdef HAVE_POSIX_FADVISE64
+#define close(fd) fadv_close(fd)
+
int sparse_end(int f)
{
- if (last_sparse) {
+ int ret;
--- old/generator.c
+++ new/generator.c
-@@ -115,6 +115,10 @@ static int dir_tweaking;
- static int need_retouch_dir_times;
+@@ -114,6 +114,10 @@ static int need_retouch_dir_times;
+ static int need_retouch_dir_perms;
static const char *solo_file = NULL;
+#ifdef HAVE_POSIX_FADVISE64
#define DEL_DIR_IS_EMPTY (1<<2) /* internal delete_FUNCTIONS use only */
--- old/options.c
+++ new/options.c
-@@ -57,6 +57,7 @@ int preserve_gid = 0;
+@@ -58,6 +58,7 @@ int preserve_uid = 0;
+ int preserve_gid = 0;
int preserve_times = 0;
- int omit_dir_times = 0;
int update_only = 0;
+int drop_cache = 0;
int cvs_exclude = 0;
int dry_run = 0;
int do_xfers = 1;
-@@ -310,6 +311,9 @@ void usage(enum logcode F)
+@@ -319,6 +320,9 @@ void usage(enum logcode F)
rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n");
rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
rprintf(F," -u, --update skip files that are newer on the receiver\n");
+#endif
rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n");
rprintf(F," --append append data onto shorter files\n");
- rprintf(F," -d, --dirs transfer directories without recursing\n");
-@@ -506,6 +510,9 @@ static struct poptOption long_options[]
+ rprintf(F," --append-verify like --append, but with old data in file checksum\n");
+@@ -522,6 +526,9 @@ static struct poptOption long_options[]
{"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 },
{"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
{"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
{"existing", 0, POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
{"ignore-non-existing",0,POPT_ARG_NONE, &ignore_non_existing, 0, 0, 0 },
{"ignore-existing", 0, POPT_ARG_NONE, &ignore_existing, 0, 0, 0 },
-@@ -1603,6 +1610,11 @@ void server_options(char **args,int *arg
+@@ -1664,6 +1671,11 @@ void server_options(char **args, int *ar
if (!am_sender)
args[ac++] = "--sender";
+
x = 1;
argstr[0] = '-';
- for (i = 0; i < verbose; i++)
+
--- old/receiver.c
+++ new/receiver.c
@@ -62,6 +62,10 @@ static int phase = 0, redoing = 0;
*
--- old/rsync.yo
+++ new/rsync.yo
-@@ -335,6 +335,7 @@ to the detailed description below for a
+@@ -353,6 +353,7 @@ to the detailed description below for a
--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
-W, --whole-file copy files whole (without rsync algorithm)
-x, --one-file-system don't cross filesystem boundaries
-@@ -956,6 +957,10 @@ NOTE: Don't use this option when the des
+@@ -1009,6 +1010,10 @@ NOTE: Don't use this option when the des
filesystem. It doesn't seem to handle seeks over null regions
correctly and ends up corrupting the files.
+++ new/sender.c
@@ -46,6 +46,10 @@ extern int write_batch;
extern struct stats stats;
- extern struct file_list *cur_flist, *first_flist;
+ extern struct file_list *cur_flist, *first_flist, *dir_flist;
+#ifdef HAVE_POSIX_FADVISE64
+#define close(fd) fadv_close(fd)
int
--- old/util.c
+++ new/util.c
-@@ -25,6 +25,7 @@
+@@ -26,6 +26,7 @@
extern int verbose;
extern int dry_run;
extern int module_id;
extern int modify_window;
extern int relative_paths;
extern int human_readable;
-@@ -39,6 +40,131 @@ char curr_dir[MAXPATHLEN];
+@@ -41,6 +42,131 @@ char curr_dir[MAXPATHLEN];
unsigned int curr_dir_len;
int curr_dir_depth; /* This is only set for a sanitizing daemon. */
--- old/flist.c
+++ new/flist.c
-@@ -33,6 +33,7 @@ extern int am_generator;
+@@ -34,6 +34,7 @@ extern int am_generator;
extern int inc_recurse;
extern int do_progress;
extern int always_checksum;
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -955,6 +956,15 @@ static struct file_struct *recv_file_ent
+@@ -949,6 +950,15 @@ static struct file_struct *recv_file_ent
memcpy(bp, F_SUM(first), checksum_len);
} else
read_buf(f, bp, checksum_len);
extern int checksum_len;
extern char *partial_dir;
extern char *basis_dir[];
-@@ -618,7 +619,8 @@ void itemize(const char *fnamecmp, struc
+@@ -617,7 +618,8 @@ void itemize(const char *fnamecmp, struc
/* Perform our quick-check heuristic for determining if a file is unchanged. */
{
if (st->st_size != F_LENGTH(file))
return 0;
-@@ -627,6 +629,8 @@ int unchanged_file(char *fn, struct file
+@@ -626,6 +628,8 @@ int unchanged_file(char *fn, struct file
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
file_checksum(fn, sum, st->st_size);
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -847,7 +851,7 @@ static int try_dests_reg(struct file_str
+@@ -846,7 +850,7 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1575,7 +1579,7 @@ static void recv_generator(char *fname,
+@@ -1638,7 +1642,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -392,7 +392,7 @@ int hard_link_check(struct file_struct *
+@@ -353,7 +353,7 @@ int hard_link_check(struct file_struct *
}
break;
}
if (unchanged_attrs(cmpbuf, file, &alt_sx))
--- old/main.c
+++ new/main.c
-@@ -45,6 +45,7 @@ extern int module_id;
+@@ -46,6 +46,7 @@ extern int module_id;
extern int copy_links;
extern int copy_dirlinks;
extern int keep_dirlinks;
extern int preserve_hard_links;
extern int protocol_version;
extern int file_total;
-@@ -72,6 +73,9 @@ extern char *password_file;
- extern char curr_dir[MAXPATHLEN];
- extern struct filter_list_struct server_filter_list;
+@@ -78,6 +79,9 @@ extern struct filter_list_struct server_
+ extern iconv_t ic_send;
+ #endif
+extern char curr_dir[MAXPATHLEN];
+
+int pre_checksum = 0;
int local_server = 0;
- int new_root_dir = 0;
+ int daemon_over_rsh = 0;
mode_t orig_umask = 0;
-@@ -792,6 +796,7 @@ static void do_server_recv(int f_in, int
+@@ -850,6 +854,7 @@ static void do_server_recv(int f_in, int
struct file_list *flist;
char *local_name = NULL;
char *dir = NULL;
int save_verbose = verbose;
if (filesfrom_fd >= 0) {
-@@ -838,6 +843,10 @@ static void do_server_recv(int f_in, int
+@@ -896,6 +901,10 @@ static void do_server_recv(int f_in, int
filesfrom_fd = -1;
}
flist = recv_file_list(f_in);
if (!flist) {
rprintf(FERROR,"server_recv: recv_file_list error\n");
-@@ -847,6 +856,9 @@ static void do_server_recv(int f_in, int
+@@ -905,6 +914,9 @@ static void do_server_recv(int f_in, int
recv_additional_file_list(f_in);
verbose = save_verbose;
if (argc > 0)
local_name = get_local_name(flist,argv[0]);
-@@ -926,6 +938,7 @@ int client_run(int f_in, int f_out, pid_
+@@ -981,6 +993,7 @@ int client_run(int f_in, int f_out, pid_
{
struct file_list *flist = NULL;
int exit_code = 0, exit_code2 = 0;
char *local_name = NULL;
cleanup_child_pid = pid;
-@@ -1006,12 +1019,19 @@ int client_run(int f_in, int f_out, pid_
+@@ -1058,12 +1071,19 @@ int client_run(int f_in, int f_out, pid_
filesfrom_fd = -1;
}
--- old/rsync.h
+++ new/rsync.h
-@@ -71,6 +71,7 @@
+@@ -73,6 +73,7 @@
#define FLAG_HLINK_DONE (1<<8) /* receiver/generator */
#define FLAG_LENGTH64 (1<<9) /* sender/receiver/generator */
#define FLAG_SKIP_GROUP (1<<10) /* receiver/generator */
#define F_NDX(f) REQ_EXTRA(f, ic_ndx)->num
--- old/rsync.yo
+++ new/rsync.yo
-@@ -343,6 +343,7 @@ to the detailed description below for a
+@@ -339,6 +339,7 @@ to the detailed description below for a
-K, --keep-dirlinks treat symlinked dir on receiver as dir
-H, --hard-links preserve hard links
-p, --perms preserve permissions
-E, --executability preserve executability
--chmod=CHMOD affect file and/or directory permissions
-A, --acls preserve ACLs (implies -p)
-@@ -544,7 +545,9 @@ specified, in which case bf(-r) is not i
+@@ -540,7 +541,9 @@ specified, in which case bf(-r) is not i
Note that bf(-a) bf(does not preserve hardlinks), because
finding multiply-linked files is expensive. You must separately
dit(--no-OPTION) You may turn off one or more implied options by prefixing
the option name with "no-". Not all options may be prefixed with a "no-":
-@@ -891,6 +894,13 @@ dit(bf(-X, --xattrs)) This option causes
- extended attributes to be the same as the local ones. This will work
- only if the remote machine's rsync also supports this option.
+@@ -895,6 +898,13 @@ super-user copies all namespaces except
+ the user.* namespace. To be able to backup and restore non-user namespaces as
+ a normal user, see the bf(--fake-super) option.
+dit(bf(--flags)) This option causes rsync to update the change file flags
+to be the same as the source file, if your OS supports the bf(chflags)(2)
extern int keep_partial;
extern int log_got_error;
extern char *partial_dir;
-@@ -116,6 +119,14 @@ NORETURN void _exit_cleanup(int code, co
+@@ -121,6 +124,14 @@ NORETURN void _exit_cleanup(int code, co
code, file, line);
}
static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int am_client)
@@ -244,6 +257,32 @@ int start_inband_exchange(int f_in, int
if (verbose > 1)
- print_child_argv(sargs);
+ print_child_argv("sending daemon args:", sargs);
+#ifdef HAVE_OPENSSL
+ if (use_ssl) {
*cygwin* ) AC_MSG_RESULT(yes)
--- old/options.c
+++ new/options.c
-@@ -181,6 +181,14 @@ int logfile_format_has_o_or_i = 0;
+@@ -182,6 +182,14 @@ int logfile_format_has_o_or_i = 0;
int always_checksum = 0;
int list_only = 0;
#define MAX_BATCH_NAME_LEN 256 /* Must be less than MAXPATHLEN-13 */
char *batch_name = NULL;
-@@ -220,6 +228,7 @@ static void print_rsync_version(enum log
+@@ -221,6 +229,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -249,6 +258,9 @@ static void print_rsync_version(enum log
+@@ -250,6 +259,9 @@ static void print_rsync_version(enum log
#ifdef ICONV_OPTION
iconv = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -262,8 +274,8 @@ static void print_rsync_version(enum log
+@@ -263,8 +275,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -424,6 +436,13 @@ void usage(enum logcode F)
+@@ -425,6 +437,13 @@ void usage(enum logcode F)
#endif
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
rprintf(F," --version print version number\n");
rprintf(F,"(-h) --help show this help (-h works with no other options)\n");
-@@ -437,7 +456,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -438,7 +457,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -620,6 +639,13 @@ static struct poptOption long_options[]
+@@ -623,6 +642,13 @@ static struct poptOption long_options[]
{"checksum-seed", 0, POPT_ARG_INT, &checksum_seed, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, 0, OPT_SERVER, 0, 0 },
{"sender", 0, POPT_ARG_NONE, 0, OPT_SENDER, 0, 0 },
/* All the following options switch us into daemon-mode option-parsing. */
{"config", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 },
{"daemon", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 },
-@@ -645,6 +671,13 @@ static void daemon_usage(enum logcode F)
+@@ -648,6 +674,13 @@ static void daemon_usage(enum logcode F)
rprintf(F," -v, --verbose increase verbosity\n");
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
rprintf(F," --help show this help screen\n");
rprintf(F,"\n");
-@@ -669,6 +702,13 @@ static struct poptOption long_daemon_opt
+@@ -672,6 +705,13 @@ static struct poptOption long_daemon_opt
{"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 },
{"server", 0, POPT_ARG_NONE, &am_server, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
{"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
{"no-verbose", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"no-v", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
-@@ -943,6 +983,12 @@ int parse_arguments(int *argc_p, const c
+@@ -946,6 +986,12 @@ int parse_arguments(int *argc_p, const c
verbose++;
break;
default:
rprintf(FERROR,
"rsync: %s: %s (in daemon mode)\n",
-@@ -966,6 +1012,17 @@ int parse_arguments(int *argc_p, const c
+@@ -969,6 +1015,17 @@ int parse_arguments(int *argc_p, const c
exit_cleanup(RERR_SYNTAX);
}
*argv_p = argv = poptGetArgs(pc);
*argc_p = argc = count_args(argv);
am_starting_up = 0;
-@@ -1216,6 +1273,12 @@ int parse_arguments(int *argc_p, const c
+@@ -1221,6 +1278,12 @@ int parse_arguments(int *argc_p, const c
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1530,6 +1593,17 @@ int parse_arguments(int *argc_p, const c
+@@ -1536,6 +1599,17 @@ int parse_arguments(int *argc_p, const c
if (delay_updates && !partial_dir)
partial_dir = tmp_partialdir;
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -1997,10 +2071,27 @@ char *check_for_hostspec(char *s, char *
+@@ -2011,10 +2085,27 @@ char *check_for_hostspec(char *s, char *
char *p;
int not_host;
int hostlen;
#define BACKUP_SUFFIX "~"
-@@ -491,6 +492,11 @@ enum msgcode {
+@@ -500,6 +501,11 @@ enum msgcode {
# define SIZEOF_INT64 SIZEOF_OFF_T
#endif
if test $ac_cv_func_getpgrp = yes; then
--- old/options.c
+++ new/options.c
-@@ -70,6 +70,7 @@ int remove_source_files = 0;
+@@ -71,6 +71,7 @@ int remove_source_files = 0;
int one_file_system = 0;
int protocol_version = PROTOCOL_VERSION;
int sparse_files = 0;
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
-@@ -220,6 +221,7 @@ static void print_rsync_version(enum log
+@@ -221,6 +222,7 @@ static void print_rsync_version(enum log
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -249,6 +251,9 @@ static void print_rsync_version(enum log
+@@ -250,6 +252,9 @@ static void print_rsync_version(enum log
#ifdef ICONV_OPTION
iconv = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -262,8 +267,8 @@ static void print_rsync_version(enum log
+@@ -263,8 +268,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -350,6 +355,9 @@ void usage(enum logcode F)
+@@ -351,6 +356,9 @@ void usage(enum logcode F)
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
#endif
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run show what would have been transferred\n");
rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
-@@ -525,6 +533,7 @@ static struct poptOption long_options[]
+@@ -528,6 +536,7 @@ static struct poptOption long_options[]
{"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
{"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
{"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
{"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 },
{"append-verify", 0, POPT_ARG_VAL, &append_mode, 2, 0, 0 },
-@@ -1279,6 +1288,15 @@ int parse_arguments(int *argc_p, const c
+@@ -1285,6 +1294,15 @@ int parse_arguments(int *argc_p, const c
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1978,6 +1996,9 @@ void server_options(char **args, int *ar
+@@ -1992,6 +2010,9 @@ void server_options(char **args, int *ar
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
if (do_progress)
--- old/rsync.h
+++ new/rsync.h
-@@ -555,6 +555,10 @@ struct ht_int64_node {
+@@ -564,6 +564,10 @@ struct ht_int64_node {
#define ACLS_NEED_MASK 1
#endif
uint32 unum;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -357,6 +357,7 @@ to the detailed description below for a
+@@ -353,6 +353,7 @@ to the detailed description below for a
--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
-W, --whole-file copy files whole (without rsync algorithm)
-x, --one-file-system don't cross filesystem boundaries
-@@ -993,6 +994,19 @@ NOTE: Don't use this option when the des
+@@ -1009,6 +1010,19 @@ NOTE: Don't use this option when the des
filesystem. It doesn't seem to handle seeks over null regions
correctly and ends up corrupting the files.
int human_readable = 0;
--- old/util.c
+++ new/util.c
-@@ -24,6 +24,7 @@
+@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
extern int module_id;
extern int modify_window;
extern int relative_paths;
-@@ -270,6 +271,10 @@ int copy_file(const char *source, const
+@@ -271,6 +272,10 @@ int copy_file(const char *source, const
int ofd;
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
+ int offset = 0;
+#endif
- ifd = do_open(source, O_RDONLY, 0);
- if (ifd == -1) {
-@@ -289,7 +294,27 @@ int copy_file(const char *source, const
+ if ((ifd = do_open(source, O_RDONLY, 0)) < 0) {
+ rsyserr(FERROR, errno, "open %s", full_fname(source));
+@@ -290,7 +295,27 @@ int copy_file(const char *source, const
return -1;
}
if (full_write(ofd, buf, len) < 0) {
rsyserr(FERROR, errno, "write %s", full_fname(dest));
close(ifd);
-@@ -310,6 +335,16 @@ int copy_file(const char *source, const
+@@ -311,6 +336,16 @@ int copy_file(const char *source, const
full_fname(source));
}
--- old/flist.c
+++ new/flist.c
-@@ -61,6 +61,7 @@ extern int copy_links;
+@@ -63,6 +63,7 @@ extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
+extern unsigned long sleep_asec;
extern struct stats stats;
+ extern char *filesfrom_host;
- extern char curr_dir[MAXPATHLEN];
-@@ -1470,6 +1471,9 @@ static void send_directory(int f, struct
+@@ -1465,6 +1466,9 @@ static void send_directory(int f, struct
}
send_file_name(f, flist, fbuf, NULL, flags, filter_level);
fbuf[len] = '\0';
--- old/options.c
+++ new/options.c
-@@ -104,6 +104,7 @@ int size_only = 0;
+@@ -106,6 +106,7 @@ int size_only = 0;
int daemon_bwlimit = 0;
int bwlimit = 0;
int fuzzy_basis = 0;
size_t bwlimit_writemax = 0;
int ignore_existing = 0;
int ignore_non_existing = 0;
-@@ -404,6 +405,7 @@ void usage(enum logcode F)
+@@ -416,6 +417,7 @@ void usage(enum logcode F)
rprintf(F," --password-file=FILE read daemon-access password from FILE\n");
rprintf(F," --list-only list the files instead of copying them\n");
rprintf(F," --bwlimit=KBPS limit I/O bandwidth; KBytes per second\n");
rprintf(F," --write-batch=FILE write a batched update to FILE\n");
rprintf(F," --only-write-batch=FILE like --write-batch but w/o updating destination\n");
rprintf(F," --read-batch=FILE read a batched update from FILE\n");
-@@ -566,6 +568,7 @@ static struct poptOption long_options[]
+@@ -583,6 +585,7 @@ static struct poptOption long_options[]
{"itemize-changes", 'i', POPT_ARG_NONE, 0, 'i', 0, 0 },
{"no-itemize-changes",0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
{"no-i", 0, POPT_ARG_VAL, &itemize_changes, 0, 0, 0 },
--- old/lib/getaddrinfo.c
+++ new/lib/getaddrinfo.c
-@@ -41,6 +41,20 @@
-
- #include <rsync.h>
+@@ -42,6 +42,20 @@
+ #include "rsync.h"
+ #include "ifuncs.h"
+/****** Start Zoong added here */
+
#endif
--- old/syscall.c
+++ new/syscall.c
-@@ -24,6 +24,7 @@
+@@ -23,6 +23,7 @@
#include "rsync.h"
#if !defined MKNOD_CREATES_SOCKETS && defined HAVE_SYS_UN_H
--- old/flist.c
+++ new/flist.c
-@@ -61,6 +61,8 @@ extern int copy_links;
+@@ -63,6 +63,8 @@ extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
+extern char *usermap;
+extern char *groupmap;
extern struct stats stats;
+ extern char *filesfrom_host;
- extern char curr_dir[MAXPATHLEN];
-@@ -745,7 +747,7 @@ static struct file_struct *recv_file_ent
+@@ -733,7 +735,7 @@ static struct file_struct *recv_file_ent
uid = (uid_t)read_varint(f);
if (xflags & XMIT_USER_NAME_FOLLOWS)
uid = recv_user_name(f, uid);
uid = match_uid(uid);
}
}
-@@ -757,7 +759,7 @@ static struct file_struct *recv_file_ent
+@@ -745,7 +747,7 @@ static struct file_struct *recv_file_ent
gid_flags = 0;
if (xflags & XMIT_GROUP_NAME_FOLLOWS)
gid = recv_group_name(f, gid, &gid_flags);
gid = match_gid(gid, &gid_flags);
}
}
-@@ -1935,8 +1937,13 @@ struct file_list *recv_file_list(int f)
+@@ -2045,8 +2047,13 @@ struct file_list *recv_file_list(int f)
int dstart, flags;
int64 start_read;
else if (inc_recurse && verbose && !am_server && !first_flist)
--- old/options.c
+++ new/options.c
-@@ -156,6 +156,8 @@ char *rsync_path = RSYNC_PATH;
+@@ -164,6 +164,8 @@ char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char backup_dir_buf[MAXPATHLEN];
char *sockopts = NULL;
int rsync_port = 0;
int compare_dest = 0;
int copy_dest = 0;
-@@ -367,6 +369,8 @@ void usage(enum logcode F)
+@@ -377,6 +379,8 @@ void usage(enum logcode F)
rprintf(F," --delay-updates put all updated files into place at transfer's end\n");
rprintf(F," -m, --prune-empty-dirs prune empty directory chains from the file-list\n");
rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
rprintf(F," -I, --ignore-times don't skip files that match in size and mod-time\n");
rprintf(F," --size-only skip files that match in size\n");
-@@ -581,6 +585,8 @@ static struct poptOption long_options[]
- {"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
+@@ -601,6 +605,8 @@ static struct poptOption long_options[]
+ {"no-s", 0, POPT_ARG_VAL, &protect_args, 0, 0, 0},
{"numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 1, 0, 0 },
{"no-numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 0, 0, 0 },
+ {"usermap", 0, POPT_ARG_STRING, &usermap, 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
{"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
-@@ -1875,6 +1881,18 @@ void server_options(char **args,int *arg
- args[ac++] = "--numeric-ids";
+@@ -1935,6 +1941,18 @@ void server_options(char **args, int *ar
+ args[ac++] = "--no-i-r";
if (am_sender) {
+ if (usermap) {
--- old/rsync.yo
+++ new/rsync.yo
-@@ -367,6 +367,8 @@ to the detailed description below for a
+@@ -379,6 +379,8 @@ to the detailed description below for a
--delay-updates put all updated files into place at end
-m, --prune-empty-dirs prune empty directory chains from file-list
--numeric-ids don't map uid/gid values by user/group name
--timeout=TIME set I/O timeout in seconds
-I, --ignore-times don't skip files that match size and time
--size-only skip files that match in size
-@@ -1451,6 +1453,46 @@ from the source system is used instead.
+@@ -1553,6 +1555,46 @@ from the source system is used instead.
the chroot setting affects rsync's ability to look up the names of the
users and groups and what you can do about it.
then rsync will exit. The default is 0, which means no timeout.
--- old/uidlist.c
+++ new/uidlist.c
-@@ -31,6 +31,8 @@ extern int preserve_uid;
+@@ -32,6 +32,8 @@ extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int numeric_ids;
#ifdef HAVE_GETGROUPS
# ifndef GETGROUPS_T
-@@ -40,6 +42,9 @@ extern int numeric_ids;
+@@ -41,6 +43,9 @@ extern int numeric_ids;
#define GID_NONE ((gid_t)-1)
struct idlist {
struct idlist *next;
char *name;
-@@ -47,8 +52,8 @@ struct idlist {
+@@ -48,8 +53,8 @@ struct idlist {
uint16 flags;
};
static struct idlist *add_to_list(struct idlist **root, id_t id, char *name,
id_t id2, uint16 flags)
-@@ -83,22 +88,6 @@ static char *gid_to_name(gid_t gid)
+@@ -84,22 +89,6 @@ static char *gid_to_name(gid_t gid)
return NULL;
}
static int is_in_group(gid_t gid)
{
#ifdef HAVE_GETGROUPS
-@@ -158,34 +147,49 @@ static int is_in_group(gid_t gid)
+@@ -159,34 +148,49 @@ static int is_in_group(gid_t gid)
#endif
}
}
return node;
-@@ -194,12 +198,9 @@ static struct idlist *recv_add_gid(gid_t
+@@ -195,12 +199,9 @@ static struct idlist *recv_add_gid(gid_t
/* this function is a definate candidate for a faster algorithm */
uid_t match_uid(uid_t uid)
{
if (uid == last_in)
return last_out;
-@@ -207,10 +208,13 @@ uid_t match_uid(uid_t uid)
+@@ -208,10 +209,13 @@ uid_t match_uid(uid_t uid)
for (list = uidlist; list; list = list->next) {
if (list->id == uid)
}
gid_t match_gid(gid_t gid, uint16 *flags_ptr)
-@@ -226,7 +230,7 @@ gid_t match_gid(gid_t gid, uint16 *flags
+@@ -227,7 +231,7 @@ gid_t match_gid(gid_t gid, uint16 *flags
break;
}
if (!list)
last = list;
}
-@@ -315,7 +319,7 @@ uid_t recv_user_name(int f, uid_t uid)
+@@ -316,7 +320,7 @@ uid_t recv_user_name(int f, uid_t uid)
if (!name)
out_of_memory("recv_user_name");
read_sbuf(f, name, len);
return node->id2;
}
-@@ -327,7 +331,7 @@ gid_t recv_group_name(int f, gid_t gid,
+@@ -328,7 +332,7 @@ gid_t recv_group_name(int f, gid_t gid,
if (!name)
out_of_memory("recv_group_name");
read_sbuf(f, name, len);
if (flags_ptr && node->flags & FLAG_SKIP_GROUP)
*flags_ptr |= FLAG_SKIP_GROUP;
return node->id2;
-@@ -354,17 +358,96 @@ void recv_id_list(int f, struct file_lis
+@@ -355,17 +359,96 @@ void recv_id_list(int f, struct file_lis
/* Now convert all the uids/gids from sender values to our values. */
#ifdef SUPPORT_ACLS