/* The server makes sure that if either side only supports a pre-release
* version of a protocol, that both sides must speak a compatible version
-@@ -99,6 +100,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -105,6 +106,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
if (preserve_xattrs)
--- old/flist.c
+++ new/flist.c
-@@ -52,6 +52,7 @@ extern int preserve_devices;
- extern int preserve_specials;
+@@ -53,6 +53,7 @@ extern int preserve_specials;
extern int uid_ndx;
extern int gid_ndx;
+ extern int eol_nulls;
+extern int atimes_ndx;
extern int relative_paths;
extern int implied_dirs;
extern int file_extra_cnt;
-@@ -170,6 +171,7 @@ void show_flist_stats(void)
+@@ -172,6 +173,7 @@ void show_flist_stats(void)
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
double len;
if (!F_IS_ACTIVE(f)) {
-@@ -184,14 +186,16 @@ static void list_file_entry(struct file_
+@@ -186,14 +188,16 @@ static void list_file_entry(struct file_
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
f_name(f, NULL));
}
}
-@@ -359,6 +363,7 @@ int push_pathname(const char *dir, int l
+@@ -361,6 +365,7 @@ int push_pathname(const char *dir, int l
static void send_file_entry(int f, struct file_struct *file, int ndx, int first_ndx)
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -458,6 +463,13 @@ static void send_file_entry(int f, struc
+@@ -460,6 +465,13 @@ static void send_file_entry(int f, struc
xflags |= XMIT_SAME_TIME;
else
modtime = file->modtime;
#ifdef SUPPORT_HARD_LINKS
if (tmp_dev != 0) {
-@@ -530,6 +542,8 @@ static void send_file_entry(int f, struc
+@@ -532,6 +544,8 @@ static void send_file_entry(int f, struc
}
if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -616,7 +630,7 @@ static void send_file_entry(int f, struc
+@@ -618,7 +632,7 @@ static void send_file_entry(int f, struc
static struct file_struct *recv_file_entry(struct file_list *flist,
int xflags, int f)
{
static mode_t mode;
static int64 dev;
static dev_t rdev;
-@@ -753,6 +767,16 @@ static struct file_struct *recv_file_ent
+@@ -755,6 +769,16 @@ static struct file_struct *recv_file_ent
}
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (chmod_modes && !S_ISLNK(mode))
mode = tweak_mode(mode, chmod_modes);
-@@ -881,6 +905,8 @@ static struct file_struct *recv_file_ent
+@@ -883,6 +907,8 @@ static struct file_struct *recv_file_ent
F_GROUP(file) = gid;
file->flags |= gid_flags;
}
#ifdef ICONV_OPTION
if (ic_ndx)
F_NDX(file) = flist->used + flist->ndx_start;
-@@ -1196,6 +1222,8 @@ struct file_struct *make_file(const char
+@@ -1198,6 +1224,8 @@ struct file_struct *make_file(const char
F_OWNER(file) = st.st_uid;
if (gid_ndx)
F_GROUP(file) = st.st_gid;
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -344,6 +345,7 @@ void usage(enum logcode F)
+@@ -345,6 +346,7 @@ void usage(enum logcode F)
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
rprintf(F," -O, --omit-dir-times omit directories from --times\n");
rprintf(F," --super receiver attempts super-user activities\n");
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
-@@ -477,6 +479,9 @@ static struct poptOption long_options[]
+@@ -479,6 +481,9 @@ static struct poptOption long_options[]
{"times", 't', POPT_ARG_VAL, &preserve_times, 2, 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, 1, 0, 0 },
{"no-omit-dir-times",0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 },
{"no-O", 0, POPT_ARG_VAL, &omit_dir_times, 0, 0, 0 },
-@@ -1691,6 +1696,8 @@ void server_options(char **args,int *arg
+@@ -1707,6 +1712,8 @@ void server_options(char **args, int *ar
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-@@ -947,6 +948,12 @@ it is preserving modification times (see
+@@ -948,6 +949,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
-@@ -1609,8 +1616,10 @@ quote(itemization(
+@@ -1610,8 +1617,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).
extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_perms;
-@@ -1476,7 +1477,7 @@ static void recv_generator(char *fname,
+@@ -1480,7 +1481,7 @@ static void recv_generator(char *fname,
goto cleanup;
}
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -340,6 +341,7 @@ void usage(enum logcode F)
+@@ -341,6 +342,7 @@ void usage(enum logcode F)
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");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," -t, --times preserve modification times\n");
-@@ -494,6 +496,7 @@ static struct poptOption long_options[]
+@@ -496,6 +498,7 @@ static struct poptOption long_options[]
{"no-D", 0, POPT_ARG_NONE, 0, OPT_NO_D, 0, 0 },
{"devices", 0, POPT_ARG_VAL, &preserve_devices, 1, 0, 0 },
{"no-devices", 0, POPT_ARG_VAL, &preserve_devices, 0, 0, 0 },
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
-@@ -1962,6 +1965,9 @@ void server_options(char **args,int *arg
+@@ -1978,6 +1981,9 @@ void server_options(char **args, int *ar
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
+ if (copy_devices)
+ args[ac++] = "--copy-devices";
+
- *argc = ac;
+ *argc_p = ac;
return;
--- old/rsync.c
/* The server makes sure that if either side only supports a pre-release
* version of a protocol, that both sides must speak a compatible version
-@@ -99,6 +100,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -105,6 +106,8 @@ void setup_protocol(int f_out,int f_in)
uid_ndx = ++file_extra_cnt;
if (preserve_gid)
gid_ndx = ++file_extra_cnt;
AC_CHECK_FUNCS(getpgrp tcgetpgrp)
--- old/flist.c
+++ new/flist.c
-@@ -52,6 +52,7 @@ extern int preserve_devices;
+@@ -50,6 +50,7 @@ extern int preserve_links;
+ extern int preserve_hard_links;
+ extern int preserve_devices;
extern int preserve_specials;
++extern int fileflags_ndx;
extern int uid_ndx;
extern int gid_ndx;
-+extern int fileflags_ndx;
- extern int relative_paths;
- extern int implied_dirs;
- extern int file_extra_cnt;
-@@ -360,6 +361,9 @@ static void send_file_entry(int f, struc
+ extern int eol_nulls;
+@@ -362,6 +363,9 @@ static void send_file_entry(int f, struc
{
static time_t modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -408,6 +412,12 @@ static void send_file_entry(int f, struc
+@@ -410,6 +414,12 @@ static void send_file_entry(int f, struc
xflags |= XMIT_SAME_MODE;
else
mode = file->mode;
if (protocol_version >= 30 && S_ISDIR(mode) && !(file->flags & FLAG_XFER_DIR))
xflags |= XMIT_NON_XFER_DIR;
-@@ -530,6 +540,10 @@ static void send_file_entry(int f, struc
+@@ -532,6 +542,10 @@ static void send_file_entry(int f, struc
}
if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -618,6 +632,9 @@ static struct file_struct *recv_file_ent
+@@ -620,6 +634,9 @@ static struct file_struct *recv_file_ent
{
static int64 modtime;
static mode_t mode;
static int64 dev;
static dev_t rdev;
static uint32 rdev_major;
-@@ -753,9 +770,12 @@ static struct file_struct *recv_file_ent
+@@ -755,9 +772,12 @@ static struct file_struct *recv_file_ent
}
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
-@@ -875,6 +895,10 @@ static struct file_struct *recv_file_ent
+@@ -877,6 +897,10 @@ static struct file_struct *recv_file_ent
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
}
file->mode = mode;
if (uid_ndx)
F_OWNER(file) = uid;
if (gid_ndx) {
-@@ -1192,6 +1216,10 @@ struct file_struct *make_file(const char
+@@ -1194,6 +1218,10 @@ struct file_struct *make_file(const char
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
}
file->mode = st.st_mode;
int preserve_executability = 0;
int preserve_devices = 0;
int preserve_specials = 0;
-@@ -219,6 +220,7 @@ static void print_rsync_version(enum log
+@@ -220,6 +221,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
-@@ -248,6 +250,9 @@ static void print_rsync_version(enum log
+@@ -249,6 +251,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);
-@@ -261,8 +266,8 @@ static void print_rsync_version(enum log
+@@ -262,8 +267,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());
-@@ -329,6 +334,7 @@ void usage(enum logcode F)
+@@ -330,6 +335,7 @@ void usage(enum logcode F)
rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
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");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
#ifdef SUPPORT_ACLS
-@@ -467,6 +473,8 @@ static struct poptOption long_options[]
+@@ -469,6 +475,8 @@ static struct poptOption long_options[]
{"perms", 'p', POPT_ARG_VAL, &preserve_perms, 1, 0, 0 },
{"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 },
{"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
{"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
-@@ -1263,6 +1271,15 @@ int parse_arguments(int *argc, const cha
+@@ -1279,6 +1287,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");
-@@ -1754,6 +1771,9 @@ void server_options(char **args,int *arg
+@@ -1770,6 +1787,9 @@ void server_options(char **args, int *ar
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
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-":
-@@ -882,6 +885,13 @@ dit(bf(-X, --xattrs)) This option causes
+@@ -883,6 +886,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.
--- old/options.c
+++ new/options.c
-@@ -44,6 +44,7 @@ int append_mode = 0;
+@@ -45,6 +45,7 @@ int append_mode = 0;
int keep_dirlinks = 0;
int copy_dirlinks = 0;
int copy_links = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_acls = 0;
-@@ -367,6 +368,7 @@ void usage(enum logcode F)
+@@ -375,6 +376,7 @@ void usage(enum logcode F)
rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
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");
-@@ -580,6 +582,7 @@ static struct poptOption long_options[]
- {"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
- {"from0", '0', POPT_ARG_VAL, &eol_nulls, 1, 0, 0},
- {"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
-+ {"fsync", 0, POPT_ARG_NONE, &do_fsync, 0, 0, 0 },
- {"numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 1, 0, 0 },
+@@ -600,6 +602,7 @@ static struct poptOption long_options[]
{"no-numeric-ids", 0, POPT_ARG_VAL, &numeric_ids, 0, 0, 0 },
{"timeout", 0, POPT_ARG_INT, &io_timeout, 0, 0, 0 },
-@@ -1885,6 +1888,9 @@ void server_options(char **args,int *arg
+ {"no-timeout", 0, POPT_ARG_VAL, &io_timeout, 0, 0, 0 },
++ {"fsync", 0, POPT_ARG_NONE, &do_fsync, 0, 0, 0 },
+ {"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
+ {"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
+ {"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
+@@ -1934,6 +1937,9 @@ void server_options(char **args, int *ar
args[ac++] = tmpdir;
}
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
-@@ -259,6 +260,12 @@ static int receive_data(int f_in, char *
+@@ -261,6 +262,12 @@ static int receive_data(int f_in, char *
exit_cleanup(RERR_FILEIO);
}
extern int modify_window;
extern int relative_paths;
extern int human_readable;
-@@ -309,6 +310,13 @@ int copy_file(const char *source, const
+@@ -310,6 +311,13 @@ int copy_file(const char *source, const
full_fname(source));
}
extern int delete_mode;
extern int delete_excluded;
extern int cvs_exclude;
-@@ -580,16 +581,17 @@ static int rule_matches(char *name, stru
+@@ -583,16 +584,17 @@ static int rule_matches(char *name, stru
if (litmatch_array(pattern, strings, slash_handling))
return ret_match;
} else if (anchored_match) {
extern int ignore_errors;
extern int numeric_ids;
extern int recurse;
-@@ -2454,7 +2455,7 @@ enum fnc_type { t_PATH, t_ITEM };
- int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
+@@ -2493,7 +2494,7 @@ static int found_prefix;
+ int f_name_cmp(const struct file_struct *f1, const struct file_struct *f2)
{
int dif;
- const uchar *c1, *c2;
enum fnc_state state1, state2;
enum fnc_type type1, type2;
enum fnc_type t_path = protocol_version >= 29 ? t_PATH : t_ITEM;
-@@ -2564,7 +2565,15 @@ int f_name_cmp(struct file_struct *f1, s
+@@ -2604,7 +2605,15 @@ int f_name_cmp(const struct file_struct
if (type1 != type2)
return type1 == t_PATH ? 1 : -1;
}
int blocking_io = -1;
int checksum_seed = 0;
int inplace = 0;
-@@ -389,6 +390,7 @@ void usage(enum logcode F)
+@@ -396,6 +397,7 @@ void usage(enum logcode F)
+ rprintf(F," --exclude-from=FILE read exclude patterns from FILE\n");
+ rprintf(F," --include=PATTERN don't exclude files matching PATTERN\n");
rprintf(F," --include-from=FILE read include patterns from FILE\n");
++ rprintf(F," --ignore-case ignore case when comparing filenames\n");
rprintf(F," --files-from=FILE read list of source-file names from FILE\n");
rprintf(F," -0, --from0 all *-from/filter files are delimited by 0s\n");
-+ rprintf(F," --ignore-case ignore case when comparing filenames\n");
- rprintf(F," --address=ADDRESS bind address for outgoing socket to daemon\n");
- rprintf(F," --port=PORT specify double-colon alternate port number\n");
- rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
-@@ -577,6 +579,8 @@ static struct poptOption long_options[]
+ rprintf(F," -s, --protect-args no space-splitting; only wildcard special-chars\n");
+@@ -590,6 +592,8 @@ static struct poptOption long_options[]
{"read-batch", 0, POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 },
{"write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_WRITE_BATCH, 0, 0 },
{"only-write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_ONLY_WRITE_BATCH, 0, 0 },
{"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
{"from0", '0', POPT_ARG_VAL, &eol_nulls, 1, 0, 0},
{"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
-@@ -1850,6 +1854,9 @@ void server_options(char **args,int *arg
+@@ -1896,6 +1900,9 @@ void server_options(char **args, int *ar
args[ac++] = arg;
}
+++ new/Makefile.in
@@ -35,7 +35,7 @@ OBJS1=flist.o rsync.o generator.o receiv
util.o main.o checksum.o match.o syscall.o log.o backup.o
- OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o \
+ OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
-OBJS3=progress.o pipe.o
+OBJS3=progress.o pipe.o hashlink.o
popt/popthelp.o popt/poptparse.o
--- old/flist.c
+++ new/flist.c
-@@ -63,6 +63,7 @@ extern int copy_unsafe_links;
- extern int protocol_version;
+@@ -65,6 +65,7 @@ extern int protocol_version;
extern int sanitize_paths;
extern struct stats stats;
+ extern char *filesfrom_host;
+extern char *link_by_hash_dir;
extern char curr_dir[MAXPATHLEN];
-@@ -818,7 +819,7 @@ static struct file_struct *recv_file_ent
+@@ -834,7 +835,7 @@ static struct file_struct *recv_file_ent
extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN;
#endif
char *config_file = NULL;
char *shell_cmd = NULL;
char *logfile_name = NULL;
-@@ -384,6 +385,7 @@ void usage(enum logcode F)
+@@ -385,6 +386,7 @@ void usage(enum logcode F)
rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n");
rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n");
rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n");
rprintf(F," -z, --compress compress file data during the transfer\n");
rprintf(F," --compress-level=NUM explicitly set compression level\n");
rprintf(F," --skip-compress=LIST skip compressing files with a suffix in LIST\n");
-@@ -435,7 +437,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -437,7 +439,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[] = {
-@@ -554,6 +556,7 @@ static struct poptOption long_options[]
+@@ -558,6 +560,7 @@ static struct poptOption long_options[]
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
{"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
{"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"no-compress", 0, POPT_ARG_VAL, &do_compression, 0, 0, 0 },
-@@ -1205,6 +1208,21 @@ int parse_arguments(int *argc, const cha
+@@ -1216,6 +1219,21 @@ 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. */
-@@ -1929,6 +1947,11 @@ void server_options(char **args,int *arg
+@@ -1954,6 +1972,11 @@ void server_options(char **args, int *ar
} else if (inplace)
args[ac++] = "--inplace";
--- old/rsync.c
+++ new/rsync.c
-@@ -48,6 +48,7 @@ extern int inplace;
+@@ -47,6 +47,7 @@ extern int inplace;
extern int flist_eof;
extern int keep_dirlinks;
extern int make_backups;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
-@@ -458,8 +459,15 @@ void finish_transfer(const char *fname,
+@@ -457,8 +458,15 @@ void finish_transfer(const char *fname,
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
ret == -2 ? "copy" : "rename",
--- old/rsync.h
+++ new/rsync.h
-@@ -778,6 +778,14 @@ struct stats {
+@@ -768,6 +768,14 @@ struct stats {
int current_file_index;
};
extern int rsync_port;
extern int ignore_errors;
extern int kluge_around_eof;
-@@ -109,8 +112,18 @@ int start_socket_client(char *host, char
+@@ -112,8 +115,18 @@ int start_socket_client(char *host, int
set_socket_options(fd, sockopts);
- ret = start_inband_exchange(user, path, fd, fd, argc);
+ ret = start_inband_exchange(fd, fd, user, remote_argc, remote_argv);
+ if (ret)
+ return ret;
+ return client_run(fd, fd, -1, argc, argv);
}
- int start_inband_exchange(const char *user, char *path, int f_in, int f_out,
-@@ -171,6 +184,33 @@ int start_inband_exchange(const char *us
+ 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);
+ if (use_ssl) {
+ io_printf(f_out, "#starttls\n");
+ while (1) {
-+ if (!read_line(f_in, line, sizeof(line)-1)) {
++ if (!read_line_old(f_in, line, sizeof line)) {
+ rprintf(FERROR, "rsync: did not receive reply to #starttls\n");
+ return -1;
+ }
+ rprintf(FERROR, "%s\n", line);
+ return -1;
+ }
-+ if (strcmp(line, "@RSYNCD: starttls") == 0) {
++ if (strcmp(line, "@RSYNCD: starttls") == 0)
+ break;
-+ }
+ rprintf(FINFO, "%s\n", line);
+ }
+ if (start_tls(f_in, f_out)) {
+ }
+#endif
+
- p = strchr(path,'/');
- if (p) *p = 0;
+ p = strchr(path, '/');
+ if (p) *p = '\0';
io_printf(f_out, "%s\n", path);
-@@ -199,6 +239,10 @@ int start_inband_exchange(const char *us
+@@ -272,6 +311,10 @@ int start_inband_exchange(int f_in, int
* server to terminate the listing of modules.
* We don't want to go on and transfer
* anything; just exit. */
exit(0);
}
-@@ -206,6 +250,10 @@ int start_inband_exchange(const char *us
+@@ -279,6 +322,10 @@ int start_inband_exchange(int f_in, int
rprintf(FERROR, "%s\n", line);
/* This is always fatal; the server will now
* close the socket. */
return -1;
}
-@@ -796,6 +844,9 @@ int start_daemon(int f_in, int f_out)
- if (protocol_version > remote_protocol)
- protocol_version = remote_protocol;
+@@ -807,6 +854,9 @@ int start_daemon(int f_in, int f_out)
+ if (exchange_protocols(f_in, f_out, line, sizeof line, 0) < 0)
+ return -1;
+#ifdef HAVE_OPENSSL
+retry:
+#endif
line[0] = 0;
- if (!read_line(f_in, line, sizeof line - 1))
+ if (!read_line_old(f_in, line, sizeof line))
return -1;
-@@ -807,6 +858,20 @@ int start_daemon(int f_in, int f_out)
+@@ -818,6 +868,20 @@ int start_daemon(int f_in, int f_out)
return -1;
}
*cygwin* ) AC_MSG_RESULT(yes)
--- old/options.c
+++ new/options.c
-@@ -180,6 +180,14 @@ int logfile_format_has_o_or_i = 0;
+@@ -181,6 +181,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;
-@@ -219,6 +227,7 @@ static void print_rsync_version(enum log
+@@ -220,6 +228,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
-@@ -248,6 +257,9 @@ static void print_rsync_version(enum log
+@@ -249,6 +258,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);
-@@ -261,8 +273,8 @@ static void print_rsync_version(enum log
+@@ -262,8 +274,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());
-@@ -422,6 +434,13 @@ void usage(enum logcode F)
+@@ -424,6 +436,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");
-@@ -435,7 +454,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OP
+@@ -437,7 +456,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[] = {
-@@ -615,6 +634,13 @@ static struct poptOption long_options[]
+@@ -620,6 +639,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 },
-@@ -640,6 +666,13 @@ static void daemon_usage(enum logcode F)
+@@ -645,6 +671,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");
-@@ -664,6 +697,13 @@ static struct poptOption long_daemon_opt
+@@ -669,6 +702,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 },
-@@ -934,6 +974,12 @@ int parse_arguments(int *argc, const cha
+@@ -943,6 +983,12 @@ int parse_arguments(int *argc_p, const c
verbose++;
break;
default:
rprintf(FERROR,
"rsync: %s: %s (in daemon mode)\n",
-@@ -957,6 +1003,17 @@ int parse_arguments(int *argc, const cha
+@@ -966,6 +1012,17 @@ int parse_arguments(int *argc_p, const c
exit_cleanup(RERR_SYNTAX);
}
+ }
+#endif
+
- *argv = poptGetArgs(pc);
- *argc = count_args(*argv);
+ *argv_p = argv = poptGetArgs(pc);
+ *argc_p = argc = count_args(argv);
am_starting_up = 0;
-@@ -1207,6 +1264,12 @@ int parse_arguments(int *argc, const cha
+@@ -1216,6 +1273,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. */
-@@ -1514,6 +1577,17 @@ int parse_arguments(int *argc, const cha
+@@ -1530,6 +1593,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) {
-@@ -1981,10 +2055,27 @@ char *check_for_hostspec(char *s, char *
+@@ -1997,10 +2071,27 @@ char *check_for_hostspec(char *s, char *
char *p;
int not_host;
int hostlen;
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
-@@ -212,6 +213,7 @@ static void print_rsync_version(enum log
+@@ -220,6 +221,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
-@@ -241,6 +243,9 @@ static void print_rsync_version(enum log
+@@ -249,6 +251,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);
-@@ -254,8 +259,8 @@ static void print_rsync_version(enum log
+@@ -262,8 +267,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());
-@@ -341,6 +346,9 @@ void usage(enum logcode F)
+@@ -350,6 +355,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");
-@@ -512,6 +520,7 @@ static struct poptOption long_options[]
+@@ -525,6 +533,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 },
+ {"preallocate", 0, POPT_ARG_NONE, &preallocate_files, 0, 0, 0},
{"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
- {"append", 0, POPT_ARG_VAL, &append_mode, 1, 0, 0 },
- {"del", 0, POPT_ARG_NONE, &delete_during, 0, 0, 0 },
-@@ -1236,6 +1245,15 @@ int parse_arguments(int *argc, const cha
+ {"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
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1911,6 +1929,9 @@ void server_options(char **args,int *arg
+@@ -1978,6 +1996,9 @@ void server_options(char **args, int *ar
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
+ if (preallocate_files && am_sender)
+ args[ac++] = "--preallocate";
+
- *argc = ac;
+ *argc_p = ac;
return;
--- old/receiver.c
read_sum_head(f_in, &sum);
if (fd_r >= 0 && size_r > 0) {
-@@ -245,8 +259,18 @@ static int receive_data(int f_in, char *
+@@ -247,8 +261,18 @@ static int receive_data(int f_in, char *
goto report_write_error;
#ifdef HAVE_FTRUNCATE
if (do_progress)
--- old/rsync.h
+++ new/rsync.h
-@@ -565,6 +565,10 @@ struct idev_node {
+@@ -555,6 +555,10 @@ struct ht_int64_node {
#define ACLS_NEED_MASK 1
#endif
uint32 unum;
--- old/rsync.yo
+++ new/rsync.yo
-@@ -341,6 +341,7 @@ to the detailed description below for a
+@@ -357,6 +357,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
-@@ -962,6 +963,19 @@ NOTE: Don't use this option when the des
+@@ -993,6 +994,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.
extern int module_id;
extern int modify_window;
extern int relative_paths;
-@@ -269,6 +270,10 @@ int copy_file(const char *source, const
+@@ -270,6 +271,10 @@ int copy_file(const char *source, const
int ofd;
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
ifd = do_open(source, O_RDONLY, 0);
if (ifd == -1) {
-@@ -288,7 +293,27 @@ int copy_file(const char *source, const
+@@ -289,7 +294,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);
-@@ -309,6 +334,16 @@ int copy_file(const char *source, const
+@@ -310,6 +335,16 @@ int copy_file(const char *source, const
full_fname(source));
}
INSTALLCMD=@INSTALL@
INSTALLMAN=@INSTALL@
@@ -36,7 +38,7 @@ OBJS1=flist.o rsync.o generator.o receiv
- OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o \
+ OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
OBJS3=progress.o pipe.o
-DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
--- old/clientserver.c
+++ new/clientserver.c
-@@ -858,6 +858,13 @@ int daemon_main(void)
+@@ -876,6 +876,13 @@ int daemon_main(void)
* address too. In fact, why not just do inet_ntop on the
* local address??? */
#include <sys/types.h>
--- old/loadparm.c
+++ new/loadparm.c
-@@ -107,6 +107,9 @@ typedef struct
+@@ -110,6 +110,9 @@ typedef struct
char *socket_options;
int rsync_port;
} global;
static global Globals;
-@@ -292,6 +295,9 @@ static struct parm_struct parm_table[] =
+@@ -295,6 +298,9 @@ static struct parm_struct parm_table[] =
{"motd file", P_STRING, P_GLOBAL,&Globals.motd_file, NULL,0},
{"pid file", P_STRING, P_GLOBAL,&Globals.pid_file, NULL,0},
{"port", P_INTEGER,P_GLOBAL,&Globals.rsync_port, NULL,0},
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
-@@ -383,6 +389,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
+@@ -386,6 +392,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
FN_LOCAL_STRING(lp_comment, comment)
--- old/main.c
+++ new/main.c
-@@ -1076,6 +1076,18 @@ static int start_client(int argc, char *
+@@ -1099,6 +1099,18 @@ static int start_client(int argc, char *
if (!read_batch) { /* for read_batch, NO source is specified */
- shell_path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
+ char *path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
+
+ if (shell_machine && !shell_machine[0]) {
+#ifdef HAVE_LIBSLP
+#endif
+ }
+
- if (shell_path) { /* source is remote */
+ if (path) { /* source is remote */
char *dummy1;
int dummy2;
--- old/options.c
+++ new/options.c
-@@ -212,6 +212,7 @@ static void print_rsync_version(enum log
+@@ -220,6 +220,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
-@@ -241,6 +242,9 @@ static void print_rsync_version(enum log
+@@ -249,6 +250,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);
-@@ -254,8 +258,8 @@ static void print_rsync_version(enum log
+@@ -262,8 +266,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);
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
--- old/rsync.h
+++ new/rsync.h
-@@ -179,6 +179,9 @@
+@@ -182,6 +182,9 @@
#define SIGNIFICANT_ITEM_FLAGS (~(\
ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
* but FLOG and FSOCKERR can be sent over the receiver -> generator pipe.
--- old/rsync.yo
+++ new/rsync.yo
-@@ -139,7 +139,12 @@ particular rsync daemon by leaving off t
+@@ -145,7 +145,12 @@ particular rsync daemon by leaving off t
quote(tt(rsync somehost.mydomain.com::))
enddit()
-@@ -561,6 +570,7 @@ use chroot = no
+@@ -564,6 +573,7 @@ use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
path = /var/ftp/pub
--- old/socket.c
+++ new/socket.c
-@@ -465,6 +465,16 @@ void start_accept_loop(int port, int (*f
+@@ -501,6 +501,16 @@ void start_accept_loop(int port, int (*f
{
fd_set deffds;
int *sp, maxfd, i;
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
-@@ -493,14 +503,25 @@ void start_accept_loop(int port, int (*f
+@@ -529,14 +539,25 @@ void start_accept_loop(int port, int (*f
maxfd = sp[i];
}
/* close log file before the potentially very long select so
* file can be trimmed by another process instead of growing
-@@ -512,8 +533,18 @@ void start_accept_loop(int port, int (*f
+@@ -548,8 +569,18 @@ void start_accept_loop(int port, int (*f
#else
fds = deffds;
#endif