-commit 1eb7a7061af2f91149233937f3db066d303c7684
-Author: Wayne Davison <wayned@samba.org>
-Date: Thu Jun 14 15:19:34 2018 -0700
-
- Need to mark xattr rules in get_rule_prefix().
-
- This fixes the bug of xattr filters getting sent as a normal filter rule
- (since the 'x' was dropped in the prefix).
-
-diff --git a/exclude.c b/exclude.c
-index 7989fb3e..a0090b29 100644
---- a/exclude.c
-+++ b/exclude.c
-@@ -1286,6 +1286,8 @@ char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer,
- }
- if (rule->rflags & FILTRULE_EXCLUDE_SELF)
- *op++ = 'e';
-+ if (rule->rflags & FILTRULE_XATTR)
-+ *op++ = 'x';
- if (rule->rflags & FILTRULE_SENDER_SIDE
- && (!for_xfer || protocol_version >= 29))
- *op++ = 's';
-commit 4aeb093206d55c3d886cbcec062f7aa93d0b968e
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Nov 20 12:45:36 2018 -0800
-
- Fix itemizing of wrong dir name on some --iconv transfers.
-
- Fixes bug #13492.
-
-diff --git a/flist.c b/flist.c
-index 499440cc..60e843cc 100644
---- a/flist.c
-+++ b/flist.c
-@@ -1636,6 +1636,7 @@ static void add_dirs_to_tree(int parent_ndx, struct file_list *from_flist,
- int32 *parent_dp = parent_ndx < 0 ? NULL
- : F_DIR_NODE_P(dir_flist->sorted[parent_ndx]);
-
-+ /* The sending side is adding entries to dir_flist in sorted order, so sorted & files are the same. */
- flist_expand(dir_flist, dir_cnt);
- dir_flist->sorted = dir_flist->files;
-
-@@ -1970,7 +1971,7 @@ void send_extra_file_list(int f, int at_least)
- else
- dir_ndx = send_dir_ndx;
- write_ndx(f, NDX_FLIST_OFFSET - dir_ndx);
-- flist->parent_ndx = dir_ndx;
-+ flist->parent_ndx = send_dir_ndx; /* the sending side must remember the sorted ndx value */
-
- send1extra(f, file, flist);
- prev_flags = file->flags;
-commit a3668685354e7457ac3e29634083906ee5435bf2
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Dec 15 16:52:53 2018 -0800
-
- Avoid a potential out-of-bounds read in daemon mode if argc is 0.
-
-diff --git a/options.c b/options.c
-index 1c5b42d0..a07c8e13 100644
---- a/options.c
-+++ b/options.c
-@@ -1315,6 +1315,10 @@ int parse_arguments(int *argc_p, const char ***argv_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) {
-commit c2da3809f714d936dec1cab6d5bf8b724b9cd113
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Jan 15 08:51:08 2019 -0800
-
- Fix --prealloc to keep file-size 0 when possible.
-
-diff --git a/syscall.c b/syscall.c
-index dbd556b8..0d1221b3 100644
---- a/syscall.c
-+++ b/syscall.c
-@@ -462,7 +462,7 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
-
- OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length)
- {
-- int opts = inplace || preallocate_files ? 0 : DO_FALLOC_OPTIONS;
-+ int opts = inplace || preallocate_files ? DO_FALLOC_OPTIONS : 0;
- int ret;
- RETURN_ERROR_IF(dry_run, 0);
- RETURN_ERROR_IF_RO_OR_LO;
-commit f233dffbd6bf65a08d0d6ce1050eb9c6ed7723cb
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Jan 15 10:38:00 2019 -0800
-
- Avoid leaving a file open on error return.
-
-diff --git a/util.c b/util.c
-index fbbfd8ba..235afa82 100644
---- a/util.c
-+++ b/util.c
-@@ -342,6 +342,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
- if (robust_unlink(dest) && errno != ENOENT) {
- int save_errno = errno;
- rsyserr(FERROR_XFER, errno, "unlink %s", full_fname(dest));
-+ close(ifd);
- errno = save_errno;
- return -1;
- }
-commit 79332c0d66d933369a28c63b096addb67514cb38
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Mar 16 09:09:09 2019 -0700
-
- Fix --remove-source-files sanity check w/--copy-links the right way.
- Fixes bug #10494.
-
-diff --git a/sender.c b/sender.c
-index 03e4aadd..9b432ed9 100644
---- a/sender.c
-+++ b/sender.c
-@@ -32,6 +32,7 @@ extern int logfile_format_has_i;
- extern int want_xattr_optim;
- extern int csum_length;
- extern int append_mode;
-+extern int copy_links;
- extern int io_error;
- extern int flist_eof;
- extern int allowed_lull;
-@@ -138,17 +139,16 @@ void successful_send(int ndx)
- return;
- f_name(file, fname);
-
-- if (do_lstat(fname, &st) < 0) {
-+ if ((copy_links ? do_stat(fname, &st) : do_lstat(fname, &st)) < 0) {
- failed_op = "re-lstat";
- goto failed;
- }
-
-- if (S_ISREG(file->mode) /* Symlinks & devices don't need this check: */
-- && (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
-+ if (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
- #ifdef ST_MTIME_NSEC
- || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file))
- #endif
-- )) {
-+ ) {
- rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname);
- return;
- }
-commit d47d3792160210ce14700e38a223eaa0059f3551
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Mar 16 11:12:53 2019 -0700
-
- Fix bug in try_dests_reg that Florian Zumbiehl pointed out.
-
- If the alternate-destination code was scanning multiple alt dirs and it
- found the right size/mtime/checksum info but not the right xattrs, it
- would keep scanning the other dirs for a better xattr match, but it
- would omit the unchanged-file check that needs to happen first.
-
-diff --git a/generator.c b/generator.c
-index 6021a220..5538a92d 100644
---- a/generator.c
-+++ b/generator.c
-@@ -876,27 +876,22 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
- pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
- if (link_stat(cmpbuf, &sxp->st, 0) < 0 || !S_ISREG(sxp->st.st_mode))
- continue;
-- switch (match_level) {
-- case 0:
-+ if (match_level == 0) {
- best_match = j;
- match_level = 1;
-- /* FALL THROUGH */
-- case 1:
-- if (!unchanged_file(cmpbuf, file, &sxp->st))
-- continue;
-+ }
-+ if (!unchanged_file(cmpbuf, file, &sxp->st))
-+ continue;
-+ if (match_level == 1) {
- best_match = j;
- match_level = 2;
-- /* FALL THROUGH */
-- case 2:
-- if (!unchanged_attrs(cmpbuf, file, sxp)) {
-- free_stat_x(sxp);
-- continue;
-- }
-+ }
-+ if (unchanged_attrs(cmpbuf, file, sxp)) {
- best_match = j;
- match_level = 3;
- break;
- }
-- break;
-+ free_stat_x(sxp);
- } while (basis_dir[++j] != NULL);
-
- if (!match_level)
-commit c0c6a97c35e8e4fb56ba26dc9c8447e26d94de06
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Mar 16 11:49:53 2019 -0700
-
- Try to fix the iconv crash in bug 11338.
-
- Applying Michal Ruprich's suggested patch for the rwrite() function that
- should hopefully help with a bug that I couldn't reproduce.
-
-diff --git a/log.c b/log.c
-index 21bcdfd9..a86edd74 100644
---- a/log.c
-+++ b/log.c
-@@ -378,10 +378,13 @@ output_msg:
- filtered_fwrite(f, convbuf, outbuf.len, 0);
- outbuf.len = 0;
- }
-- if (!ierrno || ierrno == E2BIG)
-- continue;
-- fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));
-- inbuf.len--;
-+ /* Log one byte of illegal/incomplete sequence and continue with
-+ * the next character. Check that the buffer is non-empty for the
-+ * sake of robustness. */
-+ if ((ierrno == EILSEQ || ierrno == EINVAL) && inbuf.len) {
-+ fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));
-+ inbuf.len--;
-+ }
- }
- } else
- #endif