1 commit 1eb7a7061af2f91149233937f3db066d303c7684
2 Author: Wayne Davison <wayned@samba.org>
3 Date: Thu Jun 14 15:19:34 2018 -0700
5 Need to mark xattr rules in get_rule_prefix().
7 This fixes the bug of xattr filters getting sent as a normal filter rule
8 (since the 'x' was dropped in the prefix).
10 diff --git a/exclude.c b/exclude.c
11 index 7989fb3e..a0090b29 100644
14 @@ -1286,6 +1286,8 @@ char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer,
16 if (rule->rflags & FILTRULE_EXCLUDE_SELF)
18 + if (rule->rflags & FILTRULE_XATTR)
20 if (rule->rflags & FILTRULE_SENDER_SIDE
21 && (!for_xfer || protocol_version >= 29))
23 commit 4aeb093206d55c3d886cbcec062f7aa93d0b968e
24 Author: Wayne Davison <wayned@samba.org>
25 Date: Tue Nov 20 12:45:36 2018 -0800
27 Fix itemizing of wrong dir name on some --iconv transfers.
31 diff --git a/flist.c b/flist.c
32 index 499440cc..60e843cc 100644
35 @@ -1636,6 +1636,7 @@ static void add_dirs_to_tree(int parent_ndx, struct file_list *from_flist,
36 int32 *parent_dp = parent_ndx < 0 ? NULL
37 : F_DIR_NODE_P(dir_flist->sorted[parent_ndx]);
39 + /* The sending side is adding entries to dir_flist in sorted order, so sorted & files are the same. */
40 flist_expand(dir_flist, dir_cnt);
41 dir_flist->sorted = dir_flist->files;
43 @@ -1970,7 +1971,7 @@ void send_extra_file_list(int f, int at_least)
45 dir_ndx = send_dir_ndx;
46 write_ndx(f, NDX_FLIST_OFFSET - dir_ndx);
47 - flist->parent_ndx = dir_ndx;
48 + flist->parent_ndx = send_dir_ndx; /* the sending side must remember the sorted ndx value */
50 send1extra(f, file, flist);
51 prev_flags = file->flags;
52 commit a3668685354e7457ac3e29634083906ee5435bf2
53 Author: Wayne Davison <wayned@samba.org>
54 Date: Sat Dec 15 16:52:53 2018 -0800
56 Avoid a potential out-of-bounds read in daemon mode if argc is 0.
58 diff --git a/options.c b/options.c
59 index 1c5b42d0..a07c8e13 100644
62 @@ -1315,6 +1315,10 @@ int parse_arguments(int *argc_p, const char ***argv_p)
64 int orig_protect_args = protect_args;
67 + strlcpy(err_buf, "argc is zero!\n", sizeof err_buf);
71 set_refuse_options(ref);
73 commit c2da3809f714d936dec1cab6d5bf8b724b9cd113
74 Author: Wayne Davison <wayned@samba.org>
75 Date: Tue Jan 15 08:51:08 2019 -0800
77 Fix --prealloc to keep file-size 0 when possible.
79 diff --git a/syscall.c b/syscall.c
80 index dbd556b8..0d1221b3 100644
83 @@ -462,7 +462,7 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
85 OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length)
87 - int opts = inplace || preallocate_files ? 0 : DO_FALLOC_OPTIONS;
88 + int opts = inplace || preallocate_files ? DO_FALLOC_OPTIONS : 0;
90 RETURN_ERROR_IF(dry_run, 0);
91 RETURN_ERROR_IF_RO_OR_LO;
92 commit f233dffbd6bf65a08d0d6ce1050eb9c6ed7723cb
93 Author: Wayne Davison <wayned@samba.org>
94 Date: Tue Jan 15 10:38:00 2019 -0800
96 Avoid leaving a file open on error return.
98 diff --git a/util.c b/util.c
99 index fbbfd8ba..235afa82 100644
102 @@ -342,6 +342,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
103 if (robust_unlink(dest) && errno != ENOENT) {
104 int save_errno = errno;
105 rsyserr(FERROR_XFER, errno, "unlink %s", full_fname(dest));
110 commit 79332c0d66d933369a28c63b096addb67514cb38
111 Author: Wayne Davison <wayned@samba.org>
112 Date: Sat Mar 16 09:09:09 2019 -0700
114 Fix --remove-source-files sanity check w/--copy-links the right way.
117 diff --git a/sender.c b/sender.c
118 index 03e4aadd..9b432ed9 100644
121 @@ -32,6 +32,7 @@ extern int logfile_format_has_i;
122 extern int want_xattr_optim;
123 extern int csum_length;
124 extern int append_mode;
125 +extern int copy_links;
127 extern int flist_eof;
128 extern int allowed_lull;
129 @@ -138,17 +139,16 @@ void successful_send(int ndx)
133 - if (do_lstat(fname, &st) < 0) {
134 + if ((copy_links ? do_stat(fname, &st) : do_lstat(fname, &st)) < 0) {
135 failed_op = "re-lstat";
139 - if (S_ISREG(file->mode) /* Symlinks & devices don't need this check: */
140 - && (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
141 + if (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
143 || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file))
147 rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname);
150 commit d47d3792160210ce14700e38a223eaa0059f3551
151 Author: Wayne Davison <wayned@samba.org>
152 Date: Sat Mar 16 11:12:53 2019 -0700
154 Fix bug in try_dests_reg that Florian Zumbiehl pointed out.
156 If the alternate-destination code was scanning multiple alt dirs and it
157 found the right size/mtime/checksum info but not the right xattrs, it
158 would keep scanning the other dirs for a better xattr match, but it
159 would omit the unchanged-file check that needs to happen first.
161 diff --git a/generator.c b/generator.c
162 index 6021a220..5538a92d 100644
165 @@ -876,27 +876,22 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
166 pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
167 if (link_stat(cmpbuf, &sxp->st, 0) < 0 || !S_ISREG(sxp->st.st_mode))
169 - switch (match_level) {
171 + if (match_level == 0) {
176 - if (!unchanged_file(cmpbuf, file, &sxp->st))
179 + if (!unchanged_file(cmpbuf, file, &sxp->st))
181 + if (match_level == 1) {
186 - if (!unchanged_attrs(cmpbuf, file, sxp)) {
191 + if (unchanged_attrs(cmpbuf, file, sxp)) {
198 } while (basis_dir[++j] != NULL);
201 commit c0c6a97c35e8e4fb56ba26dc9c8447e26d94de06
202 Author: Wayne Davison <wayned@samba.org>
203 Date: Sat Mar 16 11:49:53 2019 -0700
205 Try to fix the iconv crash in bug 11338.
207 Applying Michal Ruprich's suggested patch for the rwrite() function that
208 should hopefully help with a bug that I couldn't reproduce.
210 diff --git a/log.c b/log.c
211 index 21bcdfd9..a86edd74 100644
214 @@ -378,10 +378,13 @@ output_msg:
215 filtered_fwrite(f, convbuf, outbuf.len, 0);
218 - if (!ierrno || ierrno == E2BIG)
220 - fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));
222 + /* Log one byte of illegal/incomplete sequence and continue with
223 + * the next character. Check that the buffer is non-empty for the
224 + * sake of robustness. */
225 + if ((ierrno == EILSEQ || ierrno == EINVAL) && inbuf.len) {
226 + fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++));