Compare commits

...

17 Commits

Author SHA1 Message Date
Wayne Davison
194cee671d Preparing for release of 3.2.2 2020-07-04 23:12:59 -07:00
Wayne Davison
b7c5520add Handle tweaked NEWS headings & protocol change. 2020-07-04 23:11:46 -07:00
Wayne Davison
2bee307592 Get rid of some superfluous lz4 code. 2020-07-04 16:13:00 -07:00
Wayne Davison
85e62c330d Tweak indentation. 2020-07-04 16:10:37 -07:00
Wayne Davison
0add026a5d Initialize values string in a more consistent spot. 2020-07-04 14:21:15 -07:00
Wayne Davison
f4184849c4 Use module_id more consistently after it is set. 2020-07-04 10:28:39 -07:00
Wayne Davison
565cde84a7 Don't turn off the user's open-noatime unless the module is forcing the value. 2020-07-04 10:28:38 -07:00
Paul Slootman
f0e670b4c6 Add "open noatime" module option to rsyncd.conf 2020-07-04 09:30:35 -07:00
Wayne Davison
ef8951779d Fix issue in --compress-level doc. 2020-07-03 11:58:36 -07:00
Wayne Davison
e285f8f9d2 Some NEWS and man page tweaks. 2020-07-02 22:33:40 -07:00
Wayne Davison
cb383673f6 Tweak a var name. 2020-07-02 09:34:08 -07:00
Wayne Davison
0768d620a5 Another table tweak. 2020-07-01 14:20:14 -07:00
Wayne Davison
d640d78f91 Change how protocol changes are mentioned; fix table in html. 2020-07-01 14:14:24 -07:00
Wayne Davison
544b3d8b3b A few more systemd tweaks. 2020-07-01 12:10:14 -07:00
Wayne Davison
ce12142c45 Don't set systemd ProtectHome=on by default. 2020-07-01 10:41:13 -07:00
Wayne Davison
c83a81ca38 Move name exceptions into the txt file. 2020-07-01 09:05:21 -07:00
Wayne Davison
d88db22ae8 Add support for the remaining parser types. 2020-07-01 08:15:12 -07:00
16 changed files with 318 additions and 366 deletions

179
NEWS.md
View File

@@ -1,10 +1,8 @@
<a name="3.2.2"></a>
# NEWS for rsync 3.2.2 (UNRELEASED)
# NEWS for rsync 3.2.2 (4 Jul 2020)
Protocol: 31 (unchanged)
## Changes since 3.2.1:
## Changes in this version:
### BUG FIXES:
@@ -27,7 +25,7 @@ Protocol: 31 (unchanged)
apply to both.
- Simplify how the negotiation environment variables apply when interacting
with an older rsync version and when they contain only invalid names.
with an older rsync and also when a list contains only invalid names.
- Do not allow a negotiated checksum or compression choice of "none" unless
the user authorized it via an environment variable or command-line option.
@@ -39,6 +37,15 @@ Protocol: 31 (unchanged)
also allows you to specify the value via the RSYNC_MAX_ALLOC environment
variable.
- Add the "open atime" daemon parameter to allow a daemon to always enable or
disable the use of O_NOATIME (the default is to let the user control it).
- The default systemd config was changed to remove the `ProtectHome=on`
setting since rsync is often used to serve files in /home and /root and this
seemed a bit too strict. Feel free to use `systemctl edit rsync` to add
that restriction (or maybe `ProtectHome=read-only`), if you like. See the
3.2.0 NEWS for the other restrictions that were added compared to 3.1.3.
- The memory allocation functions now automatically check for a failure and
die when out of memory. This eliminated some caller-side check-and-die
code and added some missing sanity-checking of allocations.
@@ -71,9 +78,7 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.2.1 (22 Jun 2020)
Protocol: 31 (unchanged)
## Changes since 3.2.0:
## Changes in this version:
### BUG FIXES:
@@ -136,9 +141,7 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.2.0 (19 Jun 2020)
Protocol: 31 (unchanged)
## Changes since 3.1.3:
## Changes in this version:
### BUG FIXES:
@@ -191,6 +194,13 @@ Protocol: 31 (unchanged)
### ENHANCEMENTS:
- The default systemd config was made stricter by default. For instance,
`ProtectHome=on` (which hides content in /root and /home/USER dirs),
`ProtectSystem=full` (which makes /usr, /boot, & /etc dirs read-only), and
`PrivateDevices=on` (which hides devices). You can override any of these
using the standard `systemctl edit rsync` and add one or more directives
under a `[Service]` heading (and restart the rsync service).
- Various checksum enhancements, including the optional use of openssl's MD4 &
MD5 checksum algorithms, some x86-64 optimizations for the rolling checksum,
some x86-64 optimizations for the (non-openssl) MD5 checksum, the addition
@@ -343,9 +353,7 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.1.3 (28 Jan 2018)
Protocol: 31 (unchanged)
## Changes since 3.1.2:
## Changes in this version:
### SECURITY FIXES:
@@ -415,9 +423,7 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.1.2 (21 Dec 2015)
Protocol: 31 (unchanged)
## Changes since 3.1.1:
## Changes in this version:
### SECURITY FIXES:
@@ -483,9 +489,7 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.1.1 (22 Jun 2014)
Protocol: 31 (unchanged)
## Changes since 3.1.0:
## Changes in this version:
### BUG FIXES:
@@ -605,9 +609,11 @@ Protocol: 31 (unchanged)
# NEWS for rsync 3.1.0 (28 Sep 2013)
Protocol: 31 (changed)
## Changes in this version:
## Changes since 3.0.9:
### PROTOCOL NUMBER:
- The protocol number was changed to 31.
### OUTPUT CHANGES:
@@ -854,9 +860,7 @@ Protocol: 31 (changed)
# NEWS for rsync 3.0.9 (23 Sep 2011)
Protocol: 30 (unchanged)
## Changes since 3.0.8:
## Changes in this version:
### BUG FIXES:
@@ -916,9 +920,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.8 (26 Mar 2011)
Protocol: 30 (unchanged)
## Changes since 3.0.7:
## Changes in this version:
### BUG FIXES:
@@ -1057,9 +1059,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.7 (31 Dec 2009)
Protocol: 30 (unchanged)
## Changes since 3.0.6:
## Changes in this version:
### BUG FIXES:
@@ -1127,9 +1127,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.6 (8 May 2009)
Protocol: 30 (unchanged)
## Changes since 3.0.5:
## Changes in this version:
### BUG FIXES:
@@ -1188,9 +1186,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.5 (28 Dec 2008)
Protocol: 30 (unchanged)
## Changes since 3.0.4:
## Changes in this version:
### BUG FIXES:
@@ -1255,9 +1251,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.4 (6 Sep 2008)
Protocol: 30 (unchanged)
## Changes since 3.0.3:
## Changes in this version:
### BUG FIXES:
@@ -1325,9 +1319,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.3 (29 Jun 2008)
Protocol: 30 (unchanged)
## Changes since 3.0.2:
## Changes in this version:
### BUG FIXES:
@@ -1418,9 +1410,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.2 (8 Apr 2008)
Protocol: 30 (unchanged)
## Changes since 3.0.1:
## Changes in this version:
### BUG FIXES:
@@ -1442,9 +1432,7 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.1 (3 Apr 2008)
Protocol: 30 (unchanged)
## Changes since 3.0.0:
## Changes in this version:
### NOTABLE CHANGES IN BEHAVIOR:
@@ -1582,9 +1570,11 @@ Protocol: 30 (unchanged)
# NEWS for rsync 3.0.0 (1 Mar 2008)
Protocol: 30 (changed)
## Changes in this version:
## Changes since 2.6.9:
### PROTOCOL NUMBER:
- The protocol number was changed to 30.
### NOTABLE CHANGES IN BEHAVIOR:
@@ -1931,9 +1921,7 @@ Protocol: 30 (changed)
# NEWS for rsync 2.6.9 (6 Nov 2006)
Protocol: 29 (unchanged)
## Changes since 2.6.8:
## Changes in this version:
### BUG FIXES:
@@ -2093,9 +2081,7 @@ Protocol: 29 (unchanged)
# NEWS for rsync 2.6.8 (22 Apr 2006)
Protocol: 29 (unchanged)
## Changes since 2.6.7:
## Changes in this version:
### BUG FIXES:
@@ -2165,9 +2151,7 @@ Protocol: 29 (unchanged)
# NEWS for rsync 2.6.7 (11 Mar 2006)
Protocol: 29 (unchanged)
## Changes since 2.6.6:
## Changes in this version:
### OUTPUT CHANGES:
@@ -2491,9 +2475,7 @@ Protocol: 29 (unchanged)
# NEWS for rsync 2.6.6 (28 Jul 2005)
Protocol: 29 (unchanged)
## Changes since 2.6.5:
## Changes in this version:
### SECURITY FIXES:
@@ -2559,9 +2541,7 @@ Protocol: 29 (unchanged)
# NEWS for rsync 2.6.5 (1 Jun 2005)
Protocol: 29 (unchanged)
## Changes since 2.6.4:
## Changes in this version:
### OUTPUT CHANGES:
@@ -2742,9 +2722,11 @@ Protocol: 29 (unchanged)
# NEWS for rsync 2.6.4 (30 March 2005)
Protocol: 29 (changed)
## Changes in this version:
## Changes since 2.6.3:
### PROTOCOL NUMBER:
- The protocol number was changed to 29.
### OUTPUT CHANGES:
@@ -3122,9 +3104,7 @@ Protocol: 29 (changed)
# NEWS for rsync 2.6.3 (30 Sep 2004)
Protocol: 28 (unchanged)
## Changes since 2.6.2:
## Changes in this version:
### SECURITY FIXES:
@@ -3368,9 +3348,7 @@ Protocol: 28 (unchanged)
# NEWS for rsync 2.6.2 (30 Apr 2004)
Protocol: 28 (unchanged)
## Changes since 2.6.1:
## Changes in this version:
### BUG FIXES:
@@ -3412,9 +3390,11 @@ Protocol: 28 (unchanged)
# NEWS for rsync 2.6.1 (26 Apr 2004)
Protocol: 28 (changed)
## Changes in this version:
## Changes since 2.6.0:
### PROTOCOL NUMBER:
- The protocol number was changed to 28.
### SECURITY FIXES:
@@ -3602,9 +3582,12 @@ Protocol: 28 (changed)
# NEWS for rsync 2.6.0 (1 Jan 2004)
Protocol: 27 (changed)
## Changes in this version:
## Changes since 2.5.7:
### PROTOCOL NUMBER:
- The protocol number was changed to 27. The maximum accepted protocol number
was increased from 30 to 40.
### ENHANCEMENTS:
@@ -3739,9 +3722,7 @@ Protocol: 27 (changed)
# NEWS for rsync 2.5.7 (4 Dec 2003)
Protocol: 26 (unchanged)
## Changes since 2.5.6:
## Changes in this version:
### SECURITY FIXES:
@@ -3753,9 +3734,7 @@ Protocol: 26 (unchanged)
# NEWS for rsync 2.5.6, aka "the dwd-between-jobs release" (26 Jan 2003)
Protocol: 26 (unchanged)
## Changes since 2.5.5:
## Changes in this version:
### ENHANCEMENTS:
@@ -3850,9 +3829,7 @@ Protocol: 26 (unchanged)
# NEWS for rsync 2.5.5, aka Snowy River (2 Apr 2002)
Protocol: 26 (unchanged)
## Changes since 2.5.4:
## Changes in this version:
### ENHANCEMENTS:
@@ -3891,9 +3868,7 @@ Protocol: 26 (unchanged)
# NEWS for rsync 2.5.4, aka "Imitation lizard skin" (13 Mar 2002)
Protocol: 26 (unchanged)
## Changes since 2.5.3:
## Changes in this version:
### BUG FIXES:
@@ -3913,9 +3888,7 @@ Protocol: 26 (unchanged)
# NEWS for rsync 2.5.3, aka "Happy 26" (11 Mar 2002)
Protocol: 26 (unchanged)
## Changes since 2.5.2:
## Changes in this version:
### SECURITY FIXES:
@@ -3964,9 +3937,7 @@ Protocol: 26 (unchanged)
# NEWS for rsync 2.5.2 (26 Jan 2002)
Protocol: 26 (changed)
## Changes since 2.5.1:
## Changes in this version:
### SECURITY FIXES:
@@ -3974,6 +3945,10 @@ Protocol: 26 (changed)
some cases we were not sufficiently careful about reading integers from the
network.
### PROTOCOL NUMBER:
- The protocol number was changed to 26.
### BUG FIXES:
- Fix possible string mangling in log files.
@@ -4011,9 +3986,7 @@ Protocol: 26 (changed)
# NEWS for rsync 2.5.1 (3 Jan 2002)
Protocol: 25 (unchanged)
## Changes since 2.5.0:
## Changes in this version:
### BUG FIXES:
@@ -4048,9 +4021,11 @@ Protocol: 25 (unchanged)
# NEWS for rsync 2.5.0 (30 Nov 2001)
Protocol: 25 (changed)
## Changes in this version:
## Changes since 2.4.6:
### PROTOCOL NUMBER:
- The protocol number was changed to 25.
### ANNOUNCEMENTS:
@@ -4168,7 +4143,7 @@ Protocol: 25 (changed)
| RELEASE DATE | VER. | DATE OF COMMIT\* | PROTOCOL |
|--------------|--------|------------------|-------------|
| ?? Jun 2020 | 3.2.2 | | 31 |
| 04 Jul 2020 | 3.2.2 | | 31 |
| 22 Jun 2020 | 3.2.1 | | 31 |
| 19 Jun 2020 | 3.2.0 | | 31 |
| 28 Jan 2018 | 3.1.3 | | 31 |

View File

@@ -38,6 +38,7 @@ extern int preserve_xattrs;
extern int kluge_around_eof;
extern int daemon_over_rsh;
extern int munge_symlinks;
extern int open_noatime;
extern int sanitize_paths;
extern int numeric_ids;
extern int filesfrom_fd;
@@ -695,8 +696,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
module_id = i;
if (lp_transfer_logging(i) && !logfile_format)
logfile_format = lp_log_format(i);
if (lp_transfer_logging(module_id) && !logfile_format)
logfile_format = lp_log_format(module_id);
if (log_format_has(logfile_format, 'i'))
logfile_format_has_i = 1;
if (logfile_format_has_i || log_format_has(logfile_format, 'o'))
@@ -705,7 +706,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
uid = MY_UID();
am_root = (uid == 0);
p = *lp_uid(i) ? lp_uid(i) : am_root ? NOBODY_USER : NULL;
p = *lp_uid(module_id) ? lp_uid(module_id) : am_root ? NOBODY_USER : NULL;
if (p) {
if (!user_to_uid(p, &uid, True)) {
rprintf(FLOG, "Invalid uid %s\n", p);
@@ -716,7 +717,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
} else
set_uid = 0;
p = *lp_gid(i) ? conf_strtok(lp_gid(i)) : NULL;
p = *lp_gid(module_id) ? conf_strtok(lp_gid(module_id)) : NULL;
if (p) {
/* The "*" gid must be the first item in the list. */
if (strcmp(p, "*") == 0) {
@@ -749,7 +750,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
return -1;
}
module_dir = lp_path(i);
module_dir = lp_path(module_id);
if (*module_dir == '\0') {
rprintf(FLOG, "No path specified for module %s\n", name);
io_printf(f_out, "@ERROR: no path setting.\n");
@@ -786,38 +787,38 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
} else
set_filter_dir(module_dir, module_dirlen);
p = lp_filter(i);
p = lp_filter(module_id);
parse_filter_str(&daemon_filter_list, p, rule_template(FILTRULE_WORD_SPLIT),
XFLG_ABS_IF_SLASH | XFLG_DIR2WILD3);
p = lp_include_from(i);
p = lp_include_from(module_id);
parse_filter_file(&daemon_filter_list, p, rule_template(FILTRULE_INCLUDE),
XFLG_ABS_IF_SLASH | XFLG_DIR2WILD3 | XFLG_OLD_PREFIXES | XFLG_FATAL_ERRORS);
p = lp_include(i);
p = lp_include(module_id);
parse_filter_str(&daemon_filter_list, p,
rule_template(FILTRULE_INCLUDE | FILTRULE_WORD_SPLIT),
XFLG_ABS_IF_SLASH | XFLG_DIR2WILD3 | XFLG_OLD_PREFIXES);
p = lp_exclude_from(i);
p = lp_exclude_from(module_id);
parse_filter_file(&daemon_filter_list, p, rule_template(0),
XFLG_ABS_IF_SLASH | XFLG_DIR2WILD3 | XFLG_OLD_PREFIXES | XFLG_FATAL_ERRORS);
p = lp_exclude(i);
p = lp_exclude(module_id);
parse_filter_str(&daemon_filter_list, p, rule_template(FILTRULE_WORD_SPLIT),
XFLG_ABS_IF_SLASH | XFLG_DIR2WILD3 | XFLG_OLD_PREFIXES);
log_init(1);
#ifdef HAVE_PUTENV
if ((*lp_early_exec(i) || *lp_prexfer_exec(i) || *lp_postxfer_exec(i))
if ((*lp_early_exec(module_id) || *lp_prexfer_exec(module_id) || *lp_postxfer_exec(module_id))
&& !getenv("RSYNC_NO_XFER_EXEC")) {
set_env_num("RSYNC_PID", (long)getpid());
/* For post-xfer exec, fork a new process to run the rsync
* daemon while this process waits for the exit status and
* runs the indicated command at that point. */
if (*lp_postxfer_exec(i)) {
if (*lp_postxfer_exec(module_id)) {
pid_t pid = fork();
if (pid < 0) {
rsyserr(FLOG, errno, "fork failed");
@@ -837,7 +838,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
else
status = -1;
set_env_num("RSYNC_EXIT_STATUS", status);
if (shell_exec(lp_postxfer_exec(i)) < 0)
if (shell_exec(lp_postxfer_exec(module_id)) < 0)
status = -1;
_exit(status);
}
@@ -845,9 +846,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
/* For early exec, fork a child process to run the indicated
* command and wait for it to exit. */
if (*lp_early_exec(i)) {
if (*lp_early_exec(module_id)) {
int arg_fd;
pid_t pid = start_pre_exec(lp_early_exec(i), &arg_fd, NULL);
pid_t pid = start_pre_exec(lp_early_exec(module_id), &arg_fd, NULL);
if (pid == (pid_t)-1) {
rsyserr(FLOG, errno, "early exec preparation failed");
io_printf(f_out, "@ERROR: early exec preparation failed\n");
@@ -864,8 +865,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
/* For pre-xfer exec, fork a child process to run the indicated
* command, though it first waits for the parent process to
* send us the user's request via a pipe. */
if (*lp_prexfer_exec(i)) {
pre_exec_pid = start_pre_exec(lp_prexfer_exec(i), &pre_exec_arg_fd, &pre_exec_error_fd);
if (*lp_prexfer_exec(module_id)) {
pre_exec_pid = start_pre_exec(lp_prexfer_exec(module_id), &pre_exec_arg_fd, &pre_exec_error_fd);
if (pre_exec_pid == (pid_t)-1) {
rsyserr(FLOG, errno, "pre-xfer exec preparation failed");
io_printf(f_out, "@ERROR: pre-xfer exec preparation failed\n");
@@ -906,7 +907,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
if (module_dirlen || (!use_chroot && !*lp_daemon_chroot()))
sanitize_paths = 1;
if ((munge_symlinks = lp_munge_symlinks(i)) < 0)
if ((munge_symlinks = lp_munge_symlinks(module_id)) < 0)
munge_symlinks = !use_chroot || module_dirlen;
if (munge_symlinks) {
STRUCT_STAT st;
@@ -961,8 +962,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
am_root = (our_uid == 0);
}
if (lp_temp_dir(i) && *lp_temp_dir(i)) {
tmpdir = lp_temp_dir(i);
if (lp_temp_dir(module_id) && *lp_temp_dir(module_id)) {
tmpdir = lp_temp_dir(module_id);
if (strlen(tmpdir) >= MAXPATHLEN - 10) {
rprintf(FLOG,
"the 'temp dir' value for %s is WAY too long -- ignoring.\n",
@@ -989,7 +990,12 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
} else
orig_early_argv = NULL;
/* The default is to use the user's setting unless the module sets True or False. */
if (lp_open_noatime(module_id) >= 0)
open_noatime = lp_open_noatime(module_id);
munge_symlinks = save_munge_symlinks; /* The client mustn't control this. */
if (am_daemon > 0)
msgs2stderr = 0; /* A non-rsh-run daemon doesn't have stderr for msgs. */
@@ -1008,7 +1014,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
if (write_batch < 0)
dry_run = 1;
if (lp_fake_super(i)) {
if (lp_fake_super(module_id)) {
if (preserve_xattrs > 1)
preserve_xattrs = 1;
am_root = -1;
@@ -1033,7 +1039,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
#ifndef DEBUG
/* don't allow the logs to be flooded too fast */
limit_output_verbosity(lp_max_verbosity(i));
limit_output_verbosity(lp_max_verbosity(module_id));
#endif
if (protocol_version < 23 && (protocol_version == 22 || am_sender))
@@ -1094,20 +1100,20 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
#endif
if (!numeric_ids
&& (use_chroot ? lp_numeric_ids(i) != False : lp_numeric_ids(i) == True))
&& (use_chroot ? lp_numeric_ids(module_id) != False : lp_numeric_ids(module_id) == True))
numeric_ids = -1; /* Set --numeric-ids w/o breaking protocol. */
if (lp_timeout(i) && (!io_timeout || lp_timeout(i) < io_timeout))
set_io_timeout(lp_timeout(i));
if (lp_timeout(module_id) && (!io_timeout || lp_timeout(module_id) < io_timeout))
set_io_timeout(lp_timeout(module_id));
/* If we have some incoming/outgoing chmod changes, append them to
* any user-specified changes (making our changes have priority).
* We also get a pointer to just our changes so that a receiver
* process can use them separately if --perms wasn't specified. */
if (am_sender)
p = lp_outgoing_chmod(i);
p = lp_outgoing_chmod(module_id);
else
p = lp_incoming_chmod(i);
p = lp_incoming_chmod(module_id);
if (*p && !(daemon_chmod_modes = parse_chmod(p, &chmod_modes))) {
rprintf(FLOG, "Invalid \"%sing chmod\" directive: %s\n",
am_sender ? "outgo" : "incom", p);

View File

@@ -4,11 +4,10 @@
# The resulting code is output into daemon-parm.h
BEGIN {
heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from a list of values in " ARGV[1] "! */"
heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from a list of values in " ARGV[1] "! */\n\n"
sect = psect = defines = accessors = prior_ptype = ""
values = "\nstatic const all_vars Defaults = {\n { /* Globals: */\n"
params = "\nstatic struct parm_struct parm_table[] = {"
exp_line = "\n/********** EXP **********/\n"
parms = "\nstatic struct parm_struct parm_table[] = {"
comment_fmt = "\n/********** %s **********/\n"
tdstruct = "typedef struct {"
}
@@ -22,7 +21,8 @@ BEGIN {
exit
}
defines = tdstruct
exps = exp_values = exp_line
values = "\nstatic const all_vars Defaults = {\n { /* Globals: */\n"
exps = exp_values = sprintf(comment_fmt, "EXP")
sect = "GLOBAL"
psect = ", P_GLOBAL, &Vars.g."
next
@@ -35,22 +35,23 @@ BEGIN {
}
defines = defines exps "} global_vars;\n\n" tdstruct
values = values exp_values "\n }, { /* Locals: */\n"
exps = exp_values = exp_line
exps = exp_values = sprintf(comment_fmt, "EXP")
sect = "LOCAL"
psect = ", P_LOCAL, &Vars.l."
next
}
/^(STRING|PATH|INTEGER|ENUM|BOOL)/ {
/^(STRING|CHAR|PATH|INTEGER|ENUM|OCTAL|BOOL|BOOLREV|BOOL3)[ \t]/ {
ptype = $1
name = $2
$1 = $2 = ""
sub(/^[ \t]+/, "")
if (ptype != prior_ptype) {
defines = defines "\n/********** " ptype " **********/\n"
values = values "\n/********** " ptype " **********/\n"
params = params "\n"
comment = sprintf(comment_fmt, ptype)
defines = defines comment
values = values comment
parms = parms "\n"
accessors = accessors "\n"
prior_ptype = ptype
}
@@ -58,23 +59,22 @@ BEGIN {
if (ptype == "STRING" || ptype == "PATH") {
atype = "STRING"
vtype = "char*"
} else if (ptype == "BOOL") {
} else if (ptype ~ /BOOL/) {
atype = vtype = "BOOL"
} else if (ptype == "CHAR") {
atype = "CHAR"
vtype = "char"
} else {
atype = "INTEGER"
vtype = "int"
}
# We have 2 variables that don't match their conf string. Oh well...
if (name == "bind_address")
spname = "address"
else if (name == "rsync_port")
spname = "port"
else {
spname = name
gsub(/_/, " ", spname)
gsub(/-/, "", name)
}
# The name might be var_name|public_name
pubname = name
sub(/\|.*/, "", name)
sub(/.*\|/, "", pubname)
gsub(/_/, " ", pubname)
gsub(/-/, "", name)
if (ptype == "ENUM")
enum = "enum_" name
@@ -83,7 +83,7 @@ BEGIN {
defines = defines "\t" vtype " " name ";\n"
values = values "\t" $0 ", /* " name " */\n"
params = params " {\"" spname "\", P_" ptype psect name ", " enum ", 0},\n"
parms = parms " {\"" pubname "\", P_" ptype psect name ", " enum ", 0},\n"
accessors = accessors "FN_" sect "_" atype "(lp_" name ", " name ")\n"
if (vtype == "char*") {
@@ -105,8 +105,8 @@ END {
defines = defines exps "} local_vars;\n\n"
defines = defines tdstruct "\n\tglobal_vars g;\n\tlocal_vars l;\n} all_vars;\n"
values = values exp_values "\n }\n};\n\nstatic all_vars Vars;\n"
params = params "\n {NULL, P_BOOL, P_NONE, NULL, NULL, 0}\n};\n"
print heading "\n\n" defines values params accessors > "daemon-parm.h"
parms = parms "\n {NULL, P_BOOL, P_NONE, NULL, NULL, 0}\n};\n"
print heading defines values parms accessors > "daemon-parm.h"
} else {
print "Failed to parse the data in " ARGV[1]
exit 1

View File

@@ -1,6 +1,6 @@
Globals: ================================================================
STRING bind_address NULL
STRING bind_address|address NULL
STRING daemon_chroot NULL
STRING daemon_gid NULL
STRING daemon_uid NULL
@@ -9,7 +9,7 @@ STRING pid_file NULL
STRING socket_options NULL
INTEGER listen_backlog 5
INTEGER rsync_port 0
INTEGER rsync_port|port 0
BOOL proxy_protocol False
@@ -55,11 +55,13 @@ BOOL forward_lookup True
BOOL ignore_errors False
BOOL ignore_nonreadable False
BOOL list True
BOOL munge_symlinks (BOOL)-1
BOOL numeric_ids (BOOL)-1
BOOL read_only True
BOOL reverse_lookup True
BOOL strict_modes True
BOOL transfer_logging False
BOOL use_chroot True
BOOL write_only False
BOOL3 munge_symlinks Unset
BOOL3 numeric_ids Unset
BOOL3 open_noatime Unset

View File

@@ -48,7 +48,6 @@
extern item_list dparam_list;
#define strequal(a, b) (strcasecmp(a, b)==0)
#define BOOLSTR(b) ((b) ? "Yes" : "No")
#ifndef LOG_DAEMON
#define LOG_DAEMON 0
@@ -56,7 +55,7 @@ extern item_list dparam_list;
/* the following are used by loadparm for option lists */
typedef enum {
P_BOOL, P_BOOLREV, P_CHAR, P_INTEGER,
P_BOOL, P_BOOLREV, P_BOOL3, P_CHAR, P_INTEGER,
P_OCTAL, P_PATH, P_STRING, P_ENUM
} parm_type;
@@ -279,19 +278,14 @@ static void init_section(local_vars *psection)
copy_section(psection, &Vars.l);
}
/* Do a case-insensitive, whitespace-ignoring string compare. */
static int strwicmp(char *psz1, char *psz2)
/* Do a case-insensitive, whitespace-ignoring string equality check. */
static int strwiEQ(char *psz1, char *psz2)
{
/* if BOTH strings are NULL, return TRUE, if ONE is NULL return */
/* appropriate value. */
/* If one or both strings are NULL, we return equality right away. */
if (psz1 == psz2)
return 0;
if (psz1 == NULL)
return -1;
if (psz2 == NULL)
return 1;
if (psz1 == NULL || psz2 == NULL)
return 0;
/* sync the strings on first non-whitespace */
while (1) {
@@ -299,12 +293,14 @@ static int strwicmp(char *psz1, char *psz2)
psz1++;
while (isSpace(psz2))
psz2++;
if (toUpper(psz1) != toUpper(psz2) || *psz1 == '\0' || *psz2 == '\0')
if (*psz1 == '\0' || *psz2 == '\0')
break;
if (toUpper(psz1) != toUpper(psz2))
break;
psz1++;
psz2++;
}
return *psz1 - *psz2;
return *psz1 == *psz2;
}
/* Find a section by name. Otherwise works like get_section. */
@@ -313,7 +309,7 @@ static int getsectionbyname(char *name)
int i;
for (i = section_list.count - 1; i >= 0; i--) {
if (strwicmp(iSECTION(i).name, name) == 0)
if (strwiEQ(iSECTION(i).name, name))
break;
}
@@ -353,7 +349,7 @@ static int map_parameter(char *parmname)
return -1;
for (iIndex = 0; parm_table[iIndex].label; iIndex++) {
if (strwicmp(parm_table[iIndex].label, parmname) == 0)
if (strwiEQ(parm_table[iIndex].label, parmname))
return iIndex;
}
@@ -364,16 +360,14 @@ static int map_parameter(char *parmname)
/* Set a boolean variable from the text value stored in the passed string.
* Returns True in success, False if the passed string does not correctly
* represent a boolean. */
static BOOL set_boolean(BOOL *pb, char *parmvalue)
static BOOL set_boolean(BOOL *pb, char *parmvalue, int allow_unset)
{
if (strwicmp(parmvalue, "yes") == 0
|| strwicmp(parmvalue, "true") == 0
|| strwicmp(parmvalue, "1") == 0)
if (strwiEQ(parmvalue, "yes") || strwiEQ(parmvalue, "true") || strwiEQ(parmvalue, "1"))
*pb = True;
else if (strwicmp(parmvalue, "no") == 0
|| strwicmp(parmvalue, "False") == 0
|| strwicmp(parmvalue, "0") == 0)
else if (strwiEQ(parmvalue, "no") || strwiEQ(parmvalue, "false") || strwiEQ(parmvalue, "0"))
*pb = False;
else if (allow_unset && (strwiEQ(parmvalue, "unset") || strwiEQ(parmvalue, "-1")))
*pb = Unset;
else {
rprintf(FLOG, "Badly formed boolean in configuration file: \"%s\".\n", parmvalue);
return False;
@@ -422,11 +416,15 @@ static BOOL do_parameter(char *parmname, char *parmvalue)
switch (parm_table[parmnum].type) {
case P_BOOL:
set_boolean(parm_ptr, parmvalue);
set_boolean(parm_ptr, parmvalue, False);
break;
case P_BOOL3:
set_boolean(parm_ptr, parmvalue, True);
break;
case P_BOOLREV:
set_boolean(parm_ptr, parmvalue);
set_boolean(parm_ptr, parmvalue, False);
*(BOOL *)parm_ptr = ! *(BOOL *)parm_ptr;
break;
@@ -496,7 +494,7 @@ static BOOL do_section(char *sectionname)
return True;
}
isglobal = strwicmp(sectionname, GLOBAL_NAME) == 0;
isglobal = strwiEQ(sectionname, GLOBAL_NAME);
/* At the end of the global section, add any --dparam items. */
if (bInGlobalSection && !isglobal) {

View File

@@ -1,9 +1,9 @@
Summary: A fast, versatile, remote (and local) file-copying tool
Name: rsync
Version: 3.2.2
%define fullversion %{version}pre3
Release: 0.1.pre3
%define srcdir src-previews
%define fullversion %{version}
Release: 1
%define srcdir src
Group: Applications/Internet
License: GPL
Source0: https://rsync.samba.org/ftp/rsync/%{srcdir}/rsync-%{fullversion}.tar.gz
@@ -79,8 +79,8 @@ rm -rf $RPM_BUILD_ROOT
%dir /etc/rsync-ssl/certs
%changelog
* Tue Jun 30 2020 Wayne Davison <wayne@opencoder.net>
Released 3.2.2pre3.
* Sat Jul 04 2020 Wayne Davison <wayne@opencoder.net>
Released 3.2.2.
* Fri Mar 21 2008 Wayne Davison <wayne@opencoder.net>
Added installation of /etc/xinetd.d/rsync file and some commented-out

View File

@@ -32,6 +32,22 @@ blockquote pre code {
dd p:first-of-type {
margin-block-start: 0em;
}
table {
border-color: grey;
border-spacing: 0;
}
tr {
border-top: 1px solid grey;
}
tr:nth-child(2n) {
background-color: #f6f8fa;
}
th, td {
border: 1px solid #dfe2e5;
text-align: center;
padding-left: 1em;
padding-right: 1em;
}
</style>
</head><body>
"""
@@ -73,11 +89,8 @@ def main():
def html_via_cmarkgfm(txt):
return cmarkgfm.markdown_to_html(txt)
def html_via_commonmark(txt):
return commonmark.HtmlRenderer().render(commonmark.Parser().parse(txt))
# Our NEWS.md file has a gfm table in it.
return cmarkgfm.github_flavored_markdown_to_html(txt)
if __name__ == '__main__':
@@ -90,10 +103,6 @@ if __name__ == '__main__':
import cmarkgfm
md_parser = html_via_cmarkgfm
except:
try:
import commonmark
md_parser = html_via_commonmark
except:
die("Failed to find cmarkgfm or commonmark for python3.")
die("Failed to find cmarkgfm for python3.")
main()

View File

@@ -217,7 +217,7 @@ def get_rsync_version():
def get_NEWS_version_info():
rel_re = re.compile(r'^\| \d{2} \w{3} \d{4}\s+\|\s+(?P<ver>\d+\.\d+\.\d+)\s+\|\s+(?P<pdate>\d{2} \w{3} \d{4}\s+)?\|\s+(?P<pver>\d+)\s+\|')
rel_re = re.compile(r'^\| \S{2} \w{3} \d{4}\s+\|\s+(?P<ver>\d+\.\d+\.\d+)\s+\|\s+(?P<pdate>\d{2} \w{3} \d{4})?\s+\|\s+(?P<pver>\d+)\s+\|')
last_version = last_protocol_version = None
pdate = { }
@@ -233,12 +233,11 @@ def get_NEWS_version_info():
pdate[m['ver']] = m['pdate']
if m['ver'] == last_version:
last_protocol_version = m['pver']
break
if not last_protocol_version:
die(f"Unable to determine protocol_version for {last_version}.")
return last_version, last_protocol_version
return last_version, last_protocol_version, pdate
def get_protocol_versions():

View File

@@ -60,7 +60,7 @@ def main():
curversion = get_rsync_version()
# All version values are strings!
lastversion, last_protocol_version = get_NEWS_version_info()
lastversion, last_protocol_version, pdate = get_NEWS_version_info()
protocol_version, subprotocol_version = get_protocol_versions()
version = curversion
@@ -116,11 +116,8 @@ def main():
release += '.' + pre
finalversion = re.sub(r'pre\d+', '', version)
if protocol_version == last_protocol_version:
proto_changed = 'unchanged'
proto_change_date = ' ' * 11
else:
proto_changed = 'changed'
proto_changed = protocol_version != last_protocol_version
if proto_changed:
if finalversion in pdate:
proto_change_date = pdate[finalversion]
else:
@@ -129,6 +126,8 @@ def main():
if re.match(r'^\d\d \w\w\w \d\d\d\d$', ans):
break
proto_change_date = ans
else:
proto_change_date = ' ' * 11
if 'pre' in lastversion:
if not pre:
@@ -189,14 +188,17 @@ About to:
txt = replace_or_die(x_re, r'%s \1' % cl_today, txt, f"Unable to update ChangeLog header in {fn}")
elif fn == 'rsync.h':
x_re = re.compile('(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)')
repl = lambda m: m[1] + ' ' + '0' if not pre or proto_changed != 'changed' else 1 if m[2] == '0' else m[2]
repl = lambda m: m[1] + ' ' + ('0' if not pre or proto_changed else 1 if m[2] == '0' else m[2])
txt = replace_or_die(x_re, repl, txt, f"Unable to find SUBPROTOCOL_VERSION define in {fn}")
elif fn == 'NEWS.md':
efv = re.escape(finalversion)
x_re = re.compile(r'^<.+>\s+# NEWS for rsync %s \(UNRELEASED\)\s+Protocol: .+\n' % efv)
x_re = re.compile(r'^<.+>\s+# NEWS for rsync %s \(UNRELEASED\)\s+## Changes in this version:\n' % efv
+ r'(\n### PROTOCOL NUMBER:\s+- The protocol number was changed to \d+\.\n)?')
rel_day = 'UNRELEASED' if pre else today
repl = (f'<a name="{finalversion}"></a>\n\n# NEWS for rsync {finalversion} ({rel_day})\n\n'
+ f"Protocol: {protocol_version} ({proto_changed})\n")
+ '## Changes in this version:\n')
if proto_changed:
repl += f'\n### PROTOCOL NUMBER:\n\n - The protocol number was changed to {protocol_version}.\n'
good_top = re.sub(r'\(.*?\)', '(UNRELEASED)', repl, 1)
msg = f"The top lines of {fn} are not in the right format. It should be:\n" + good_top
txt = replace_or_die(x_re, repl, txt, msg)

View File

@@ -16,14 +16,14 @@ RestartSec=1
# This is generally used for public file distribution, [...]
#
# So let's assume some extra security is more than welcome here. We do full
# system protection (which makes it read-only) and hide users' homes and
# system protection (which makes /usr, /boot, & /etc read-only) and hide
# devices. To override these defaults, it's best to do so in the drop-in
# directory, often done via `systemctl edit rsync.service`. The file needs
# just the bare minimum of the right [heading] and override values.
# See systemd.unit(5) and search for "drop-in" for full details.
ProtectSystem=full
ProtectHome=on
#ProtectHome=on|off|read-only
PrivateDevices=on
NoNewPrivileges=on

View File

@@ -16,13 +16,13 @@ StandardError=journal
# This is generally used for public file distribution, [...]
#
# So let's assume some extra security is more than welcome here. We do full
# system protection (which makes it read-only) and hide users' homes and
# system protection (which makes /usr, /boot, & /etc read-only) and hide
# devices. To override these defaults, it's best to do so in the drop-in
# directory, often done via `systemctl edit rsync@.service`. The file needs
# just the bare minimum of the right [heading] and override values.
# See systemd.unit(5) and search for "drop-in" for full details.
ProtectSystem=full
ProtectHome=on
#ProtectHome=on|off|read-only
PrivateDevices=on
NoNewPrivileges=on

View File

@@ -688,7 +688,7 @@ your home directory (remove the '=' for that).
before-the-transfer "Does this file need to be updated?" check.
The checksum used is auto-negotiated between the client and the server, but
can be overridden using either the `--checksum-choice` option or an
can be overridden using either the `--checksum-choice` (`--cc`) option or an
environment variable that is discussed in that option's section.
0. `--archive`, `-a`
@@ -1479,8 +1479,8 @@ your home directory (remove the '=' for that).
- `md4`
- `none`
Run `rsync -V` to see the default checksum list compiled into your version
(which may differ from the above list).
Run `rsync --version` to see the default checksum list compiled into your
version (which may differ from the list above).
If "none" is specified for the first (or only) name, the `--whole-file`
option is forced on and no checksum verification is performed on the
@@ -1499,8 +1499,8 @@ your home directory (remove the '=' for that).
The default order can be customized by setting the environment variable
RSYNC_CHECKSUM_LIST to a space-separated list of acceptable checksum names.
If the environment variable contains a "`&`" character, the string is
separated into the "client list & server list" otherwise the same string
If the string contains a "`&`" character, it is separated into the "client
string & server string", otherwise the same string
applies to both. If the string (or string portion) contains no
non-whitespace characters, the default checksum list is used. This method
does not allow you to specify the transfer checksum separately from the
@@ -2100,8 +2100,9 @@ your home directory (remove the '=' for that).
Rsync can also be configured (at build time) to have this option enabled by
default (with is overridden by both the environment and the command-line).
Run `rsync -V` to check if this is the case, as it will display "default
protect-args" or "optional protect-args" depending on how it was compiled.
Run `rsync --version` to check if this is the case, as it will display
"default protect-args" or "optional protect-args" depending on how it was
compiled.
This option will eventually become a new default setting at some
as-yet-undetermined point in the future.
@@ -2288,9 +2289,10 @@ your home directory (remove the '=' for that).
something that is useful over a slow connection.
Rsync supports multiple compression methods and will choose one for you
unless you force the choice using the `--compress-choice` option.
unless you force the choice using the `--compress-choice` (`--zc`) option.
Run `rsync -V` to see the default compress list compiled into your version.
Run `rsync --version` to see the default compress list compiled into your
version.
When both sides of the transfer are at least 3.2.0, rsync chooses the first
algorithm in the client's list of choices that is also in the server's list
@@ -2300,9 +2302,9 @@ your home directory (remove the '=' for that).
The default order can be customized by setting the environment variable
RSYNC_COMPRESS_LIST to a space-separated list of acceptable compression
names. If the environment variable contains a "`&`" character, the string
is separated into the "client list & server list" otherwise the same string
applies to both. If the string (or string portion) contains no
names. If the string contains a "`&`" character, it is separated into the
"client string & server string", otherwise the same string applies to both.
If the string (or string portion) contains no
non-whitespace characters, the default compress list is used. Any unknown
compression names are discarded from the list, but a list with only invalid
names results in a failed negotiation.
@@ -2331,8 +2333,8 @@ your home directory (remove the '=' for that).
- `zlib`
- `none`
Run `rsync -V` to see the default compress list compiled into your version
(which may differ from the above list).
Run `rsync --version` to see the default compress list compiled into your
version (which may differ from the list above).
Note that if you see an error about an option named `--old-compress` or
`--new-compress`, this is rsync trying to send the `--compress-choice=zlib`
@@ -2353,8 +2355,8 @@ your home directory (remove the '=' for that).
"off").
The level values vary depending on the checksum in effect. Because rsync
will negotiate a checksum choice by default when the remote rsync is new
enough, it can be good to combine this option with a `--compress-choice`
will negotiate a checksum choice by default (when the remote rsync is new
enough), it can be good to combine this option with a `--compress-choice`
(`--zc`) option unless you're sure of the choice in effect. For example:
> rsync -aiv --zc=zstd --zl=22 host:src/ dest/
@@ -2384,8 +2386,10 @@ your home directory (remove the '=' for that).
possible. Rsync sets the compression level on a per-file basis based on
the file's suffix. If the compression algorithm has an "off" level (such
as zlib/zlibx) then no compression occurs for those files. Other
algorithms have the level minimized to reduces the CPU usage as much as
possible.
algorithms that support changing the streaming level on-the-fly will have
the level minimized to reduces the CPU usage as much as possible for a
matching file. At this time, only zlib & zlibx compression support this
changing of levels on a per-file basis.
The **LIST** should be one or more file suffixes (without the dot) separated
by slashes (`/`). You may specify an empty string to indicate that no files
@@ -3194,8 +3198,8 @@ your home directory (remove the '=' for that).
These options also exist in the `--daemon` mode section.
If rsync was complied without support for IPv6, the `--ipv6` option will
have no effect. The `rsync -V` output will contain "`no IPv6`" if is the
case.
have no effect. The `rsync --version` output will contain "`no IPv6`" if
is the case.
0. `--checksum-seed=NUM`
@@ -3308,8 +3312,8 @@ The options allowed when starting an rsync daemon are as follows:
These options also exist in the regular rsync options section.
If rsync was complied without support for IPv6, the `--ipv6` option will
have no effect. The `rsync -V` output will contain "`no IPv6`" if is the
case.
have no effect. The `rsync --version` output will contain "`no IPv6`" if
is the case.
0. `--help`, `-h`

View File

@@ -20,6 +20,7 @@
#define False 0
#define True 1
#define Unset (-1) /* Our BOOL values are always an int. */
#define BLOCK_SIZE 700
#define RSYNC_RSH_ENV "RSYNC_RSH"

View File

@@ -424,6 +424,22 @@ the values of parameters. See the GLOBAL PARAMETERS section for more details.
Helpful hint: you probably want to specify "refuse options = delete" for a
write-only module.
0. `open noatime`
When set to True, this parameter tells the rsync daemon to open files with
the O_NOATIME flag
(on systems that support it) to avoid changing the access time of the files
that are being transferred. If your OS does not support the O_NOATIME flag
then rsync will silently ignore this option. Note also that some
filesystems are mounted to avoid updating the atime on read access even
without the O_NOATIME flag being set.
When set to False, this parameters ensures that files on the server are not
opened with O_NOATIME.
When set to Unset (the default) the user controls the setting via
`--open-noatime`.
0. `list`
This parameter determines whether this module is listed when the client

198
token.c
View File

@@ -376,8 +376,7 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset, in
flush_pending = 0;
} else if (last_token == -2) {
run_start = token;
} else if (nb != 0 || token != last_token + 1
|| token >= run_start + 65536) {
} else if (nb != 0 || token != last_token + 1 || token >= run_start + 65536) {
/* output previous run */
r = run_start - last_run_end;
n = last_token - run_start;
@@ -679,7 +678,6 @@ static void send_zstd_token(int f, int32 token, struct map_struct *buf, OFF_T of
/* initialization */
if (!comp_init_done) {
zstd_cctx = ZSTD_createCCtx();
if (!zstd_cctx) {
rprintf(FERROR, "compression init failed\n");
@@ -700,10 +698,7 @@ static void send_zstd_token(int f, int32 token, struct map_struct *buf, OFF_T of
flush_pending = 0;
} else if (last_token == -2) {
run_start = token;
} else if (nb != 0 || token != last_token + 1
|| token >= run_start + 65536) {
} else if (nb != 0 || token != last_token + 1 || token >= run_start + 65536) {
/* output previous run */
r = run_start - last_run_end;
n = last_token - run_start;
@@ -785,7 +780,6 @@ static int32 recv_zstd_token(int f, char **data)
int r;
if (!decomp_init_done) {
zstd_dctx = ZSTD_createDCtx();
if (!zstd_dctx) {
rprintf(FERROR, "ZSTD_createDStream failed\n");
@@ -803,30 +797,31 @@ static int32 recv_zstd_token(int f, char **data)
decomp_init_done = 1;
}
do {
switch (recv_state) {
case r_init:
recv_state = r_idle;
rx_token = 0;
break;
for (;;) {
switch (recv_state) {
case r_init:
recv_state = r_idle;
rx_token = 0;
break;
case r_idle:
flag = read_byte(f);
if ((flag & 0xC0) == DEFLATED_DATA) {
n = ((flag & 0x3f) << 8) + read_byte(f);
read_buf(f, cbuf, n);
case r_idle:
flag = read_byte(f);
if ((flag & 0xC0) == DEFLATED_DATA) {
n = ((flag & 0x3f) << 8) + read_byte(f);
read_buf(f, cbuf, n);
zstd_in_buff.size = n;
zstd_in_buff.pos = 0;
zstd_in_buff.size = n;
zstd_in_buff.pos = 0;
recv_state = r_inflating;
recv_state = r_inflating;
break;
}
} else if (flag == END_FLAG) {
/* that's all folks */
recv_state = r_init;
return 0;
} else {
if (flag == END_FLAG) {
/* that's all folks */
recv_state = r_init;
return 0;
}
/* here we have a token of some kind */
if (flag & TOKEN_REL) {
rx_token += flag & 0x3f;
@@ -839,45 +834,42 @@ static int32 recv_zstd_token(int f, char **data)
recv_state = r_running;
}
return -1 - rx_token;
case r_inflated: /* zstd doesn't get into this state */
break;
case r_inflating:
zstd_out_buff.size = out_buffer_size;
zstd_out_buff.pos = 0;
r = ZSTD_decompressStream(zstd_dctx, &zstd_out_buff, &zstd_in_buff);
n = zstd_out_buff.pos;
if (ZSTD_isError(r)) {
rprintf(FERROR, "ZSTD decomp returned %d (%d bytes)\n", r, n);
exit_cleanup(RERR_STREAMIO);
}
/*
* If the input buffer is fully consumed and the output
* buffer is not full then next step is to read more
* data.
*/
if (zstd_in_buff.size == zstd_in_buff.pos && n < out_buffer_size)
recv_state = r_idle;
if (n != 0) {
*data = dbuf;
return n;
}
break;
case r_running:
++rx_token;
if (--rx_run == 0)
recv_state = r_idle;
return -1 - rx_token;
}
break;
case r_inflating:
zstd_out_buff.size = out_buffer_size;
zstd_out_buff.pos = 0;
r = ZSTD_decompressStream(zstd_dctx, &zstd_out_buff, &zstd_in_buff);
n = zstd_out_buff.pos;
if (ZSTD_isError(r)) {
rprintf(FERROR, "ZSTD decomp returned %d (%d bytes)\n", r, n);
exit_cleanup(RERR_STREAMIO);
}
/*
* If the input buffer is fully consumed and the output
* buffer is not full then next step is to read more
* data.
*/
if (zstd_in_buff.size == zstd_in_buff.pos && n < out_buffer_size)
recv_state = r_idle;
if (n != 0) {
*data = dbuf;
return n;
}
break;
case r_running:
++rx_token;
if (--rx_run == 0)
recv_state = r_idle;
return -1 - rx_token;
break;
case r_inflated:
break;
}
} while (1);
}
#endif /* SUPPORT_ZSTD */
@@ -899,8 +891,7 @@ send_compressed_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
flush_pending = 0;
} else if (last_token == -2) {
run_start = token;
} else if (nb != 0 || token != last_token + 1
|| token >= run_start + 65536) {
} else if (nb != 0 || token != last_token + 1 || token >= run_start + 65536) {
/* output previous run */
r = run_start - last_run_end;
n = last_token - run_start;
@@ -925,7 +916,6 @@ send_compressed_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
const char *next_in;
do {
char *ptr = obuf;
char *next_out = obuf + 2;
if (available_out == 0) {
@@ -940,10 +930,10 @@ send_compressed_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
exit_cleanup(RERR_STREAMIO);
}
if (available_out <= MAX_DATA_COUNT) {
ptr[0] = DEFLATED_DATA + (available_out >> 8);
ptr[1] = available_out;
obuf[0] = DEFLATED_DATA + (available_out >> 8);
obuf[1] = available_out;
write_buf(f, ptr, available_out + 2);
write_buf(f, obuf, available_out + 2);
available_out = 0;
nb -= available_in;
@@ -952,14 +942,14 @@ send_compressed_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
} while (nb != 0);
flush_pending = token == -2;
}
if (token == -1)
if (token == -1) {
/* end of file - clean up */
write_byte(f, END_FLAG);
}
}
static int32 recv_compressed_token(int f, char **data)
{
static int32 saved_flag;
static int init_done;
int32 n, flag;
int size = MAX(LZ4_compressBound(CHUNK_SIZE), MAX_DATA_COUNT+2);
@@ -978,13 +968,9 @@ static int32 recv_compressed_token(int f, char **data)
recv_state = r_idle;
rx_token = 0;
break;
case r_idle:
case r_inflated:
if (saved_flag) {
flag = saved_flag & 0xff;
saved_flag = 0;
} else
flag = read_byte(f);
flag = read_byte(f);
if ((flag & 0xC0) == DEFLATED_DATA) {
n = ((flag & 0x3f) << 8) + read_byte(f);
read_buf(f, cbuf, n);
@@ -994,9 +980,6 @@ static int32 recv_compressed_token(int f, char **data)
break;
}
if (recv_state == r_inflated)
recv_state = r_idle;
if (flag == END_FLAG) {
/* that's all folks */
recv_state = r_init;
@@ -1022,10 +1005,13 @@ static int32 recv_compressed_token(int f, char **data)
rprintf(FERROR, "uncompress failed: %d\n", avail_out);
exit_cleanup(RERR_STREAMIO);
}
recv_state = r_inflated;
recv_state = r_idle;
*data = dbuf;
return avail_out;
case r_inflated: /* lz4 doesn't get into this state */
break;
case r_running:
++rx_token;
if (--rx_run == 0)
@@ -1033,53 +1019,7 @@ static int32 recv_compressed_token(int f, char **data)
return -1 - rx_token;
}
}
}
# if 0
static void see_uncompressed_token(char *buf, int32 len)
{
static const char *next_in;
static int avail_in;
int avail_out;
int32 blklen;
char hdr[5];
avail_in = 0;
blklen = 0;
hdr[0] = 0;
do {
if (avail_in == 0 && len != 0) {
if (blklen == 0) {
/* Give it a fake stored-block header. */
next_in = hdr;
avail_in = 5;
blklen = len;
if (blklen > 0xffff)
blklen = 0xffff;
hdr[1] = blklen;
hdr[2] = blklen >> 8;
hdr[3] = ~hdr[1];
hdr[4] = ~hdr[2];
} else {
next_in = (char *)buf;
avail_in = blklen;
if (protocol_version >= 31) /* Newer protocols avoid a data-duplicating bug */
buf += blklen;
len -= blklen;
blklen = 0;
}
}
avail_out = LZ4_decompress_safe(next_in, dbuf, avail_in, LZ4_compressBound(CHUNK_SIZE));
if (avail_out < 0) {
rprintf(FERROR, "uncompress failed: %d\n", avail_out);
exit_cleanup(RERR_STREAMIO);
}
} while (len);
}
# endif /* 0 */
#endif /* SUPPORT_LZ4 */
/**

View File

@@ -1 +1 @@
#define RSYNC_VERSION "3.2.2pre3"
#define RSYNC_VERSION "3.2.2"