extern int module_id;
extern int sanitize_paths;
extern int daemon_over_rsh;
+extern unsigned int module_dirlen;
extern struct filter_list_struct filter_list;
extern struct filter_list_struct server_filter_list;
static int refused_delete, refused_archive_part, refused_compress;
static int refused_partial, refused_progress, refused_delete_before;
static int refused_delete_during;
-static int refused_inplace;
+static int refused_inplace, refused_no_iconv;
static char *max_size_arg, *min_size_arg;
static char tmp_partialdir[] = ".~tmp~";
char const *got_socketpair = "no ";
char const *have_inplace = "no ";
char const *hardlinks = "no ";
+ char const *symtimes = "no ";
char const *acls = "no ";
char const *xattrs = "no ";
char const *links = "no ";
#ifdef ICONV_OPTION
iconv = "";
#endif
+#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+ symtimes = "";
+#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
- rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv\n",
- have_inplace, acls, xattrs, iconv);
+ rprintf(f, " %sappend, %sACLs, %sxattrs, %siconv, %ssymtimes\n",
+ have_inplace, acls, xattrs, iconv, symtimes);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
#endif
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run perform a trial run with no changes made\n");
- rprintf(F," -W, --whole-file copy files whole (without rsync algorithm)\n");
+ rprintf(F," -W, --whole-file copy files whole (without delta-xfer algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
rprintf(F," -B, --block-size=SIZE force a fixed checksum block-size\n");
rprintf(F," -e, --rsh=COMMAND specify the remote shell to use\n");
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_NO_D, OPT_APPEND,
+ OPT_NO_D, OPT_APPEND, OPT_NO_ICONV,
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
{"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 },
+ {"no-one-file-system",'x',POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
+ {"no-x", 'x', POPT_ARG_VAL, &one_file_system, 0, 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 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
#ifdef ICONV_OPTION
{"iconv", 0, POPT_ARG_STRING, &iconv_opt, 0, 0, 0 },
+ {"no-iconv", 0, POPT_ARG_NONE, 0, OPT_NO_ICONV, 0, 0 },
#endif
{"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 },
{"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 },
refused_progress = op->val;
else if (wildmatch("inplace", op->longName))
refused_inplace = op->val;
+ else if (wildmatch("no-iconv", op->longName))
+ refused_no_iconv = op->val;
break;
}
if (!is_wild)
if (ref && *ref)
set_refuse_options(ref);
- if (am_daemon)
+ if (am_daemon) {
set_refuse_options("log-file*");
+ if (!*lp_charset(module_id))
+ set_refuse_options("iconv");
+ }
#ifdef ICONV_OPTION
if (!am_daemon && !protect_args && (arg = getenv("RSYNC_ICONV")) != NULL && *arg)
arg = sanitize_path(NULL, arg, NULL, 0);
if (server_filter_list.head) {
int rej;
- char *cp = strdup(arg);
+ char *dir, *cp = strdup(arg);
if (!cp)
out_of_memory("parse_arguments");
if (!*cp)
goto options_rejected;
- clean_fname(cp, CFN_COLLAPSE_DOT_DOT_DIRS);
- rej = check_filter(&server_filter_list, cp, 0) < 0;
+ dir = cp + (*cp == '/' ? module_dirlen : 0);
+ clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
+ rej = check_filter(&server_filter_list, dir, 0) < 0;
free(cp);
if (rej)
goto options_rejected;
read_batch = 1;
break;
+ case OPT_NO_ICONV:
+#ifdef ICONV_OPTION
+ iconv_opt = NULL;
+#endif
+ break;
+
case OPT_MAX_SIZE:
if ((max_size = parse_size_arg(&max_size_arg, 'b')) <= 0) {
snprintf(err_buf, sizeof err_buf,
else
need_unsorted_flist = 1;
}
+ if (refused_no_iconv && !iconv_opt) {
+ create_refuse_error(refused_no_iconv);
+ return 0;
+ }
#endif
if (protect_args == 1) {
batch_name = NULL;
} else if (dry_run)
write_batch = 0;
- }
+ } else if (write_batch < 0 && dry_run)
+ write_batch = 0;
if (read_batch && files_from) {
snprintf(err_buf, sizeof err_buf,
"--read-batch cannot be used with --files-from\n");
if (server_filter_list.head && !am_sender) {
struct filter_list_struct *elp = &server_filter_list;
if (tmpdir) {
+ char *dir;
if (!*tmpdir)
goto options_rejected;
- clean_fname(tmpdir, CFN_COLLAPSE_DOT_DOT_DIRS);
- if (check_filter(elp, tmpdir, 1) < 0)
+ dir = tmpdir + (*tmpdir == '/' ? module_dirlen : 0);
+ clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
+ if (check_filter(elp, dir, 1) < 0)
goto options_rejected;
}
if (backup_dir) {
+ char *dir;
if (!*backup_dir)
goto options_rejected;
- clean_fname(backup_dir, CFN_COLLAPSE_DOT_DOT_DIRS);
- if (check_filter(elp, backup_dir, 1) < 0)
+ dir = backup_dir + (*backup_dir == '/' ? module_dirlen : 0);
+ clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
+ if (check_filter(elp, dir, 1) < 0)
goto options_rejected;
}
}
if (sanitize_paths)
files_from = sanitize_path(NULL, files_from, NULL, 0);
if (server_filter_list.head) {
+ char *dir;
if (!*files_from)
goto options_rejected;
- clean_fname(files_from, CFN_COLLAPSE_DOT_DOT_DIRS);
- if (check_filter(&server_filter_list, files_from, 0) < 0)
+ dir = files_from + (*files_from == '/' ? module_dirlen : 0);
+ clean_fname(dir, CFN_COLLAPSE_DOT_DOT_DIRS);
+ if (check_filter(&server_filter_list, dir, 0) < 0)
goto options_rejected;
}
filesfrom_fd = open(files_from, O_RDONLY|O_BINARY);
argstr[x++] = 'z';
/* We make use of the -e option to let the server know about any
- * pre-release protocol version && our allow_inc_recurse status. */
- set_allow_inc_recurse();
+ * pre-release protocol version && some behavior flags. */
+ argstr[x++] = 'e';
#if SUBPROTOCOL_VERSION != 0
if (protocol_version == PROTOCOL_VERSION) {
x += snprintf(argstr+x, sizeof argstr - x,
- "e%d.%d%s", PROTOCOL_VERSION, SUBPROTOCOL_VERSION,
- allow_inc_recurse ? "i" : "");
+ "%d.%d", PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
} else
#endif
- if (allow_inc_recurse) {
- argstr[x++] = 'e';
+ argstr[x++] = '.';
+ set_allow_inc_recurse();
+ if (allow_inc_recurse)
argstr[x++] = 'i';
- }
-
+#if defined HAVE_LUTIMES && defined HAVE_UTIMES
+ argstr[x++] = 'L';
+#endif
argstr[x] = '\0';
- if (x != 1)
- args[ac++] = argstr;
+ args[ac++] = argstr;
#ifdef ICONV_OPTION
if (iconv_opt) {