patch -p1 <patches/remote-option.diff
patch -p1 <patches/db.diff
- ./configure (optional if already run)
+ ./configure
make
+based-on: patch/b3.0.x/remote-option
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
extern int protocol_version;
+extern int use_db;
- int csum_length = SHORT_SUM_LENGTH; /* initial value */
-
-@@ -100,10 +101,10 @@ void get_checksum2(char *buf, int32 len, char *sum)
+ /*
+ a simple 32 bit checksum that can be upadted from either end
+@@ -98,10 +99,10 @@ void get_checksum2(char *buf, int32 len, char *sum)
}
}
md_context m;
int32 remainder;
int fd;
-@@ -114,7 +115,7 @@ void file_checksum(char *fname, char *sum, OFF_T size)
+@@ -112,7 +113,7 @@ void file_checksum(char *fname, char *sum, OFF_T size)
if (fd == -1)
return;
if (protocol_version >= 30) {
md5_begin(&m);
-@@ -148,6 +149,9 @@ void file_checksum(char *fname, char *sum, OFF_T size)
+@@ -146,6 +147,9 @@ void file_checksum(char *fname, char *sum, OFF_T size)
mdfour_result(&m, (uchar *)sum);
}
diff --git a/cleanup.c b/cleanup.c
--- a/cleanup.c
+++ b/cleanup.c
-@@ -27,6 +27,7 @@ extern int am_daemon;
+@@ -28,6 +28,7 @@ extern int am_receiver;
extern int io_error;
extern int keep_partial;
extern int got_xfer_error;
extern char *partial_dir;
extern char *logfile_name;
-@@ -124,6 +125,12 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
- /* FALLTHROUGH */
+@@ -133,6 +134,12 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
#include "case_N.h"
+ switch_step++;
+ if (use_db)
+ db_disconnect();
extern mode_t orig_umask;
+extern char *db_config;
extern char *bind_address;
- extern char *sockopts;
extern char *config_file;
-@@ -564,6 +567,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+ extern char *logfile_format;
+@@ -570,6 +573,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
log_init(1);
#ifdef HAVE_PUTENV
if (*lp_prexfer_exec(i) || *lp_postxfer_exec(i)) {
char *modname, *modpath, *hostaddr, *hostname, *username;
-@@ -767,6 +773,10 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -777,6 +783,10 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
am_server = 1; /* Don't let someone try to be tricky. */
quiet = 0;
if (lp_ignore_errors(module_id))
ignore_errors = 1;
if (write_batch < 0)
-diff --git a/configure.in b/configure.in
---- a/configure.in
-+++ b/configure.in
-@@ -312,7 +312,7 @@ AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -326,6 +326,7 @@ AC_HEADER_DIRENT
+ AC_HEADER_TIME
+ AC_HEADER_SYS_WAIT
+ AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
++ mysql/mysql.h sqlite3.h \
+ unistd.h utime.h grp.h compat.h sys/param.h ctype.h sys/wait.h \
+ sys/ioctl.h sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h \
sys/un.h sys/attr.h mcheck.h arpa/inet.h arpa/nameser.h locale.h \
- netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
- sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
-- popt.h popt/popt.h)
-+ popt.h popt/popt.h mysql/mysql.h sqlite3.h)
- AC_HEADER_MAJOR
-
- AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
-@@ -976,6 +976,29 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"
+@@ -1008,6 +1009,29 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"
fi
fi
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -54,6 +54,7 @@ extern int preserve_devices;
+@@ -52,6 +52,7 @@ extern int preserve_hard_links;
+ extern int preserve_devices;
extern int preserve_specials;
- extern int uid_ndx;
- extern int gid_ndx;
+ extern int delete_during;
+extern int use_db;
extern int eol_nulls;
extern int relative_paths;
extern int implied_dirs;
-@@ -1296,14 +1297,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1298,14 +1299,16 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
memcpy(bp + basename_len, linkname, linkname_len);
#endif
if (basename_len == 0+1) {
if (!pool)
unmake_file(file);
-@@ -1966,6 +1969,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+@@ -1990,6 +1993,9 @@ 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;
diff --git a/generator.c b/generator.c
--- a/generator.c
+++ b/generator.c
-@@ -58,6 +58,7 @@ extern int update_only;
+@@ -56,6 +56,7 @@ extern int update_only;
extern int ignore_existing;
extern int ignore_non_existing;
extern int inplace;
extern int append_mode;
extern int make_backups;
extern int csum_length;
-@@ -724,7 +725,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
+@@ -758,7 +759,8 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
of the file time to determine whether to sync */
if (always_checksum > 0 && S_ISREG(st->st_mode)) {
char sum[MAX_DIGEST_LEN];
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -2209,6 +2211,9 @@ void generate_files(int f_out, const char *local_name)
- : "enabled");
- }
+@@ -2279,6 +2281,9 @@ void generate_files(int f_out, const char *local_name)
+ * notice that and let us know via the message pipe (or its closing). */
+ ignore_timeout = 1;
+ if (use_db && always_checksum)
+ db_connect();
+
- /* Since we often fill up the outgoing socket and then just sit around
- * waiting for the other 2 processes to do their thing, we don't want
- * to exit on a timeout. If the data stops flowing, the receiver will
+ dflt_perms = (ACCESSPERMS & ~orig_umask);
+
+ do {
diff --git a/loadparm.c b/loadparm.c
--- a/loadparm.c
+++ b/loadparm.c
diff --git a/main.c b/main.c
--- a/main.c
+++ b/main.c
-@@ -49,6 +49,7 @@ extern int copy_unsafe_links;
+@@ -48,6 +48,7 @@ extern int copy_unsafe_links;
extern int keep_dirlinks;
extern int preserve_hard_links;
extern int protocol_version;
extern int xfer_dirs;
@@ -73,6 +74,7 @@ extern char *partial_dir;
extern char *dest_option;
- extern char *basis_dir[];
+ extern char *basis_dir[MAX_BASIS_DIRS+1];
extern char *rsync_path;
+extern char *db_config;
extern char *shell_cmd;
extern char *batch_name;
extern char *password_file;
-@@ -1490,6 +1492,9 @@ int main(int argc,char *argv[])
+@@ -1503,6 +1505,9 @@ int main(int argc,char *argv[])
exit_cleanup(RERR_SYNTAX);
}
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -92,6 +92,7 @@ int use_qsort = 0;
+@@ -90,6 +90,7 @@ int use_qsort = 0;
char *files_from = NULL;
int filesfrom_fd = -1;
char *filesfrom_host = NULL;
int eol_nulls = 0;
int protect_args = 0;
int human_readable = 0;
-@@ -229,6 +230,7 @@ static void print_rsync_version(enum logcode f)
+@@ -227,6 +228,7 @@ static void print_rsync_version(enum logcode f)
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -262,6 +264,11 @@ static void print_rsync_version(enum logcode f)
- #if defined HAVE_LUTIMES && defined HAVE_UTIMES
+@@ -260,6 +262,11 @@ static void print_rsync_version(enum logcode f)
+ #ifdef CAN_SET_SYMLINK_TIMES
symtimes = "";
#endif
+#if defined HAVE_MYSQL_MYSQL_H && defined HAVE_LIBMYSQLCLIENT
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -275,8 +282,8 @@ static void print_rsync_version(enum logcode f)
+@@ -273,8 +280,8 @@ static void print_rsync_version(enum logcode f)
(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());
-@@ -322,6 +329,7 @@ void usage(enum logcode F)
+@@ -320,6 +327,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
-@@ -580,6 +588,7 @@ static struct poptOption long_options[] = {
+@@ -578,6 +586,7 @@ static struct poptOption long_options[] = {
{"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
{"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
{"no-c", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
-@@ -321,6 +321,7 @@ to the detailed description below for a complete description. verb(
+@@ -334,6 +334,7 @@ to the detailed description below for a complete description. verb(
-q, --quiet suppress non-error messages
--no-motd suppress daemon-mode MOTD (see caveat)
-c, --checksum skip based on checksum, not mod-time & size
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
-r, --recursive recurse into directories
-@@ -540,6 +541,47 @@ option's before-the-transfer "Does this file need to be updated?" check.
+@@ -559,6 +560,47 @@ option's before-the-transfer "Does this file need to be updated?" check.
For protocol 30 and beyond (first supported in 3.0.0), the checksum used is
MD5. For older protocols, the checksum used is MD4.
diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
--- a/rsyncd.conf.yo
+++ b/rsyncd.conf.yo
-@@ -270,6 +270,18 @@ is daemon. This setting has no effect if the "log file" setting is a
+@@ -276,6 +276,18 @@ is daemon. This setting has no effect if the "log file" setting is a
non-empty string (either set in the per-modules settings, or inherited
from the global settings).