+ int checksum_updates;
} *csum_cache = NULL;
- static void flist_sort_and_clean(struct file_list *flist, int flags);
-@@ -344,7 +353,79 @@ static void flist_done_allocating(struct file_list *flist)
+ static struct file_list *flist_new(int flags, const char *msg);
+@@ -345,7 +354,79 @@ static void flist_done_allocating(struct file_list *flist)
flist->pool_boundary = ptr;
}
{
int slot, slots = am_sender ? 1 : basis_dir_cnt + 1;
-@@ -355,6 +436,9 @@ void reset_checksum_cache()
+@@ -356,6 +437,9 @@ void reset_checksum_cache()
struct file_list *flist = csum_cache[slot].flist;
if (flist) {
/* Reset the pool memory and empty the file-list array. */
pool_free_old(flist->file_pool,
pool_boundary(flist->file_pool, 0));
-@@ -365,6 +449,10 @@ void reset_checksum_cache()
+@@ -366,6 +450,10 @@ void reset_checksum_cache()
flist->low = 0;
flist->high = -1;
flist->next = NULL;
}
}
-@@ -372,7 +460,7 @@ void reset_checksum_cache()
+@@ -373,7 +461,7 @@ void reset_checksum_cache()
static int add_checksum(struct file_list *flist, const char *dirname,
const char *basename, int basename_len, OFF_T file_length,
time_t mtime, uint32 ctime, uint32 inode,
{
struct file_struct *file;
int alloc_len, extra_len;
-@@ -389,7 +477,7 @@ static int add_checksum(struct file_list *flist, const char *dirname,
+@@ -390,7 +478,7 @@ static int add_checksum(struct file_list *flist, const char *dirname,
if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
extra_len = (extra_len | (EXTRA_ROUNDING * EXTRA_LEN)) + EXTRA_LEN;
#endif
bp = pool_alloc(flist->file_pool, alloc_len, "add_checksum");
memset(bp, 0, extra_len + FILE_STRUCT_LEN);
-@@ -398,7 +486,14 @@ static int add_checksum(struct file_list *flist, const char *dirname,
+@@ -399,7 +487,14 @@ static int add_checksum(struct file_list *flist, const char *dirname,
bp += FILE_STRUCT_LEN;
memcpy(bp, basename, basename_len);
file->mode = S_IFREG;
file->modtime = mtime;
file->len32 = (uint32)file_length;
-@@ -427,10 +522,11 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
+@@ -428,10 +523,11 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
char line[MAXPATHLEN+1024], fbuf[MAXPATHLEN], sum[MAX_DIGEST_LEN];
FILE *fp;
char *cp;
int dlen = dirname ? strlcpy(fbuf, dirname, sizeof fbuf) : 0;
if (dlen >= (int)(sizeof fbuf - 1 - RSYNCSUMS_LEN))
-@@ -451,7 +547,7 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
+@@ -452,7 +548,7 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
while (fgets(line, sizeof line, fp)) {
cp = line;
if (checksum_type == 5) {
if (*cp == '=')
while (*++cp == '=') {}
else
-@@ -462,7 +558,14 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
+@@ -463,7 +559,14 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
}
if (*cp == '=') {
} else {
for (i = 0; i < flist_csum_len*2; i++, cp++) {
int x;
-@@ -480,13 +583,14 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
+@@ -481,13 +584,14 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
else
sum[i/2] = x << 4;
}
if (*cp == '=')
while (*++cp == '=') {}
else
-@@ -536,24 +640,112 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
+@@ -537,24 +641,112 @@ static void read_checksums(int slot, struct file_list *flist, const char *dirnam
continue;
strlcpy(fbuf+dlen, cp, sizeof fbuf - dlen);
read_checksums(slot, flist, file->dirname);
}
-@@ -565,12 +757,31 @@ void get_cached_checksum(int slot, const char *fname, struct file_struct *file,
+@@ -566,12 +758,31 @@ void get_cached_checksum(int slot, const char *fname, struct file_struct *file,
&& (checksum_files & CSF_LAX
|| (F_CTIME(fp) == (uint32)stp->st_ctime
&& F_INODE(fp) == (uint32)stp->st_ino))) {
}
/* Call this with EITHER (1) "file, NULL, 0" to chdir() to the file's
-@@ -1502,6 +1713,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1511,6 +1722,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
if (ignore_perishable)
non_perishable_cnt++;
return NULL;
}
-@@ -1548,13 +1761,13 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1557,13 +1770,13 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
lastdir[len] = '\0';
lastdir_len = len;
if (checksum_files && am_sender && flist)
}
}
basename_len = strlen(basename) + 1; /* count the '\0' */
-@@ -1662,7 +1875,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1671,7 +1884,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
if (always_checksum && am_sender && S_ISREG(st.st_mode)) {
if (flist && checksum_files)
else
file_checksum(thisname, &st, tmp_sum);
if (sender_keeps_checksum)
-@@ -2054,6 +2267,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
+@@ -2063,6 +2276,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
closedir(d);
if (f >= 0 && recurse && !divert_dirs) {
int i, end = flist->used - 1;
/* send_if_directory() bumps flist->used, so use "end". */
-@@ -2719,6 +2935,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2726,6 +2942,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i());
}
extern int protocol_version;
extern int remove_source_files;
extern int preserve_hard_links;
-@@ -1056,6 +1057,9 @@ static void got_flist_entry_status(enum festatus status, int ndx)
+@@ -1061,6 +1062,9 @@ static void got_flist_entry_status(enum festatus status, int ndx)
if (inc_recurse)
flist->in_progress++;
}
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -1755,7 +1755,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -1939,7 +1939,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
case OPT_SUMFILES:
arg = poptGetOptArg(pc);
diff --git a/rsync.1.md b/rsync.1.md
--- a/rsync.1.md
+++ b/rsync.1.md
-@@ -705,9 +705,13 @@ your home directory (remove the '=' for that).
+@@ -707,9 +707,13 @@ your home directory (remove the '=' for that).
The MODE value is either "lax", for relaxed checking (which compares size
and mtime), "strict" (which also compares ctime and inode), or "none" to
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -1044,6 +1044,8 @@ typedef struct {
+@@ -1088,6 +1088,8 @@ typedef struct {
#define CSF_ENABLE (1<<1)
#define CSF_LAX (1<<2)
diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
--- a/rsyncd.conf.5.md
+++ b/rsyncd.conf.5.md
-@@ -409,13 +409,15 @@ the values of parameters. See the GLOBAL PARAMETERS section for more details.
+@@ -424,13 +424,15 @@ the values of parameters. See the GLOBAL PARAMETERS section for more details.
This parameter tells rsync to make use of any cached checksum information
it finds in per-directory .rsyncsums files when the current transfer is
using the `--checksum` option. The value can be set to either "lax",
-- "strict", or "none" -- see the client's `--sumfiles` option for what these
+- "strict", or "none". See the client's `--sumfiles` option for what these
- choices do.
+ "strict", "+lax", "+strict", "++lax", "++strict", or +"none". See the
+ client's `--sumfiles` option for what these choices do.
./configure
make
-based-on: af531cf787995f6a3bc381cd1da1988192e7ef59
+based-on: 5eda68f11bf6efe782cca60a2415191f4532c3b5
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
@@ -75,10 +77,12 @@ install: all
- -${MKDIR_P} ${DESTDIR}${bindir}
- ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
- ${INSTALLCMD} -m 755 $(srcdir)/rsync-ssl ${DESTDIR}${bindir}
-+ rsync -ilt rsyncdb$(EXEEXT) ${DESTDIR}${bindir}/
- -${MKDIR_P} ${DESTDIR}${mandir}/man1
- -${MKDIR_P} ${DESTDIR}${mandir}/man5
- if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
- if test -f rsync-ssl.1; then ${INSTALLMAN} -m 644 rsync-ssl.1 ${DESTDIR}${mandir}/man1; fi
-+ if test -f rsyncdb.1; then ${INSTALLMAN} -m 644 rsyncdb.1 ${DESTDIR}${mandir}/man1; fi
- if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
+ -$(MKDIR_P) $(DESTDIR)$(bindir)
+ $(INSTALLCMD) $(INSTALL_STRIP) -m 755 rsync$(EXEEXT) $(DESTDIR)$(bindir)
+ $(INSTALLCMD) -m 755 $(srcdir)/rsync-ssl $(DESTDIR)$(bindir)
++ rsync -ilt rsyncdb$(EXEEXT) $(DESTDIR)$(bindir)/
+ -$(MKDIR_P) $(DESTDIR)$(mandir)/man1
+ -$(MKDIR_P) $(DESTDIR)$(mandir)/man5
+ if test -f rsync.1; then $(INSTALLMAN) -m 644 rsync.1 $(DESTDIR)$(mandir)/man1; fi
+ if test -f rsync-ssl.1; then $(INSTALLMAN) -m 644 rsync-ssl.1 $(DESTDIR)$(mandir)/man1; fi
++ if test -f rsyncdb.1; then $(INSTALLMAN) -m 644 rsyncdb.1 $(DESTDIR)$(mandir)/man1; fi
+ if test -f rsyncd.conf.5; then $(INSTALLMAN) -m 644 rsyncd.conf.5 $(DESTDIR)$(mandir)/man5; fi
install-ssl-daemon: stunnel-rsyncd.conf
@@ -96,10 +100,13 @@ install-strip:
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -44,12 +44,15 @@ extern int numeric_ids;
+@@ -45,12 +45,15 @@ extern int numeric_ids;
extern int filesfrom_fd;
extern int remote_protocol;
extern int protocol_version;
extern char *bind_address;
extern char *config_file;
extern char *logfile_format;
-@@ -810,6 +813,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -814,6 +817,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
log_init(1);
+ }
+
#ifdef HAVE_PUTENV
- if ((*lp_early_exec(module_id) || *lp_prexfer_exec(module_id) || *lp_postxfer_exec(module_id))
- && !getenv("RSYNC_NO_XFER_EXEC")) {
-@@ -1009,6 +1017,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+ if ((*lp_early_exec(module_id) || *lp_prexfer_exec(module_id)
+ || *lp_postxfer_exec(module_id) || *lp_name_converter(module_id))
+@@ -1026,6 +1034,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
am_server = 1; /* Don't let someone try to be tricky. */
quiet = 0;
STRING dont_compress DEFAULT_DONT_COMPRESS
STRING early_exec NULL
STRING exclude NULL
-@@ -50,6 +51,7 @@ INTEGER timeout 0
+@@ -51,6 +52,7 @@ INTEGER timeout 0
ENUM syslog_facility LOG_DAEMON
extern int eol_nulls;
extern int atimes_ndx;
extern int relative_paths;
-@@ -1324,11 +1325,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1325,11 +1326,8 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
extra_len += EXTRA_LEN;
#endif
#if EXTRA_ROUNDING > 0
if (extra_len & (EXTRA_ROUNDING * EXTRA_LEN))
-@@ -1413,8 +1411,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1414,8 +1412,12 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
return NULL;
}
if (unsort_ndx)
F_NDX(file) = stats.num_dirs;
-@@ -2098,6 +2100,9 @@ void send_extra_file_list(int f, int at_least)
+@@ -2099,6 +2101,9 @@ void send_extra_file_list(int f, int at_least)
finish:
if (io_error != save_io_error && protocol_version == 30 && !ignore_errors)
send_msg_int(MSG_IO_ERROR, io_error);
}
struct file_list *send_file_list(int f, int argc, char *argv[])
-@@ -2121,6 +2126,13 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2122,6 +2127,13 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
| (eol_nulls || reading_remotely ? RL_EOL_NULLS : 0);
int implied_dot_dir = 0;
rprintf(FLOG, "building file list\n");
if (show_filelist_progress)
start_filelist_progress("building file list");
-@@ -2464,6 +2476,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -2465,6 +2477,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
rprintf(FINFO, "[%s] flist_eof=1\n", who_am_i());
}
#define NDX_DONE -1
#define NDX_FLIST_EOF -2
#define NDX_DEL_STATS -3
-@@ -1399,7 +1403,8 @@ extern short info_levels[], debug_levels[];
+@@ -1406,7 +1410,8 @@ extern short info_levels[], debug_levels[];
#define DEBUG_CHDIR (DEBUG_BIND+1)
#define DEBUG_CONNECT (DEBUG_CHDIR+1)
#define DEBUG_CMD (DEBUG_CONNECT+1)