*
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002-2015 Wayne Davison
+ * Copyright (C) 2002-2019 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
- rprintf(f, "Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.\n");
+ rprintf(f, "Copyright (C) 1996-2019 by Andrew Tridgell, Wayne Davison, and others.\n");
rprintf(f, "Web site: http://rsync.samba.org/\n");
rprintf(f, "Capabilities:\n");
rprintf(f, " %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
#ifdef SUPPORT_XATTRS
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
#endif
- rprintf(F," -S, --sparse handle sparse files efficiently\n");
+ rprintf(F," -S, --sparse turn sequences of nulls into sparse blocks\n");
#ifdef SUPPORT_PREALLOCATION
rprintf(F," --preallocate allocate dest files before writing them\n");
#else
}
}
+/* This is used to make sure that --daemon & --server cannot be aliased to
+ * something else. These options have always disabled popt aliases for the
+ * parsing of a daemon or server command-line, but we have to make sure that
+ * these options cannot vanish so that the alias disabling can take effect. */
+static void popt_unalias(poptContext con, const char *opt)
+{
+ struct poptAlias unalias;
+
+ unalias.longName = opt + 2; /* point past the leading "--" */
+ unalias.shortName = '\0';
+ unalias.argc = 1;
+ unalias.argv = new_array(const char*, 1);
+ unalias.argv[0] = strdup(opt);
+
+ poptAddAlias(con, unalias, 0);
+}
/**
* Process command line arguments. Called on both local and remote.
const char *arg, **argv = *argv_p;
int argc = *argc_p;
int opt;
+ int orig_protect_args = protect_args;
+ if (argc == 0) {
+ strlcpy(err_buf, "argc is zero!\n", sizeof err_buf);
+ return 0;
+ }
if (ref && *ref)
set_refuse_options(ref);
if (am_daemon) {
if (pc)
poptFreeContext(pc);
pc = poptGetContext(RSYNC_NAME, argc, argv, long_options, 0);
- if (!am_server)
+ if (!am_server) {
poptReadDefaultConfig(pc, 0);
+ popt_unalias(pc, "--daemon");
+ popt_unalias(pc, "--server");
+ }
while ((opt = poptGetNextOpt(pc)) != -1) {
/* most options are handled automatically by popt;
if (fuzzy_basis > 1)
fuzzy_basis = basis_dir_cnt + 1;
+ /* Don't let the client reset protect_args if it was already processed */
+ if (orig_protect_args == 2 && am_server)
+ protect_args = orig_protect_args;
+
if (protect_args == 1 && am_server)
return 1;
bwlimit_writemax = 512;
}
- if (sparse_files && inplace) {
- /* Note: we don't check for this below, because --append is
- * OK with --sparse (as long as redos are handled right). */
- snprintf(err_buf, sizeof err_buf,
- "--sparse cannot be used with --inplace\n");
- return 0;
- }
-
if (append_mode) {
if (whole_file > 0) {
snprintf(err_buf, sizeof err_buf,