]>
Commit | Line | Data |
---|---|---|
ba8c40ae AM |
1 | commit 1eb7a7061af2f91149233937f3db066d303c7684 |
2 | Author: Wayne Davison <wayned@samba.org> | |
3 | Date: Thu Jun 14 15:19:34 2018 -0700 | |
4 | ||
5 | Need to mark xattr rules in get_rule_prefix(). | |
6 | ||
7 | This fixes the bug of xattr filters getting sent as a normal filter rule | |
8 | (since the 'x' was dropped in the prefix). | |
9 | ||
10 | diff --git a/exclude.c b/exclude.c | |
11 | index 7989fb3e..a0090b29 100644 | |
12 | --- a/exclude.c | |
13 | +++ b/exclude.c | |
14 | @@ -1286,6 +1286,8 @@ char *get_rule_prefix(filter_rule *rule, const char *pat, int for_xfer, | |
15 | } | |
16 | if (rule->rflags & FILTRULE_EXCLUDE_SELF) | |
17 | *op++ = 'e'; | |
18 | + if (rule->rflags & FILTRULE_XATTR) | |
19 | + *op++ = 'x'; | |
20 | if (rule->rflags & FILTRULE_SENDER_SIDE | |
21 | && (!for_xfer || protocol_version >= 29)) | |
22 | *op++ = 's'; | |
23 | commit 4aeb093206d55c3d886cbcec062f7aa93d0b968e | |
24 | Author: Wayne Davison <wayned@samba.org> | |
25 | Date: Tue Nov 20 12:45:36 2018 -0800 | |
26 | ||
27 | Fix itemizing of wrong dir name on some --iconv transfers. | |
28 | ||
29 | Fixes bug #13492. | |
30 | ||
31 | diff --git a/flist.c b/flist.c | |
32 | index 499440cc..60e843cc 100644 | |
33 | --- a/flist.c | |
34 | +++ b/flist.c | |
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]); | |
38 | ||
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; | |
42 | ||
43 | @@ -1970,7 +1971,7 @@ void send_extra_file_list(int f, int at_least) | |
44 | else | |
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 */ | |
49 | ||
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 | |
55 | ||
56 | Avoid a potential out-of-bounds read in daemon mode if argc is 0. | |
57 | ||
58 | diff --git a/options.c b/options.c | |
59 | index 1c5b42d0..a07c8e13 100644 | |
60 | --- a/options.c | |
61 | +++ b/options.c | |
62 | @@ -1315,6 +1315,10 @@ int parse_arguments(int *argc_p, const char ***argv_p) | |
63 | int opt; | |
64 | int orig_protect_args = protect_args; | |
65 | ||
66 | + if (argc == 0) { | |
67 | + strlcpy(err_buf, "argc is zero!\n", sizeof err_buf); | |
68 | + return 0; | |
69 | + } | |
70 | if (ref && *ref) | |
71 | set_refuse_options(ref); | |
72 | if (am_daemon) { | |
73 | commit c2da3809f714d936dec1cab6d5bf8b724b9cd113 | |
74 | Author: Wayne Davison <wayned@samba.org> | |
75 | Date: Tue Jan 15 08:51:08 2019 -0800 | |
76 | ||
77 | Fix --prealloc to keep file-size 0 when possible. | |
78 | ||
79 | diff --git a/syscall.c b/syscall.c | |
80 | index dbd556b8..0d1221b3 100644 | |
81 | --- a/syscall.c | |
82 | +++ b/syscall.c | |
83 | @@ -462,7 +462,7 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec)) | |
84 | ||
85 | OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length) | |
86 | { | |
87 | - int opts = inplace || preallocate_files ? 0 : DO_FALLOC_OPTIONS; | |
88 | + int opts = inplace || preallocate_files ? DO_FALLOC_OPTIONS : 0; | |
89 | int ret; | |
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 | |
95 | ||
96 | Avoid leaving a file open on error return. | |
97 | ||
98 | diff --git a/util.c b/util.c | |
99 | index fbbfd8ba..235afa82 100644 | |
100 | --- a/util.c | |
101 | +++ b/util.c | |
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)); | |
106 | + close(ifd); | |
107 | errno = save_errno; | |
108 | return -1; | |
109 | } | |
110 | commit 79332c0d66d933369a28c63b096addb67514cb38 | |
111 | Author: Wayne Davison <wayned@samba.org> | |
112 | Date: Sat Mar 16 09:09:09 2019 -0700 | |
113 | ||
114 | Fix --remove-source-files sanity check w/--copy-links the right way. | |
115 | Fixes bug #10494. | |
116 | ||
117 | diff --git a/sender.c b/sender.c | |
118 | index 03e4aadd..9b432ed9 100644 | |
119 | --- a/sender.c | |
120 | +++ b/sender.c | |
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; | |
126 | extern int io_error; | |
127 | extern int flist_eof; | |
128 | extern int allowed_lull; | |
129 | @@ -138,17 +139,16 @@ void successful_send(int ndx) | |
130 | return; | |
131 | f_name(file, fname); | |
132 | ||
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"; | |
136 | goto failed; | |
137 | } | |
138 | ||
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 | |
142 | #ifdef ST_MTIME_NSEC | |
143 | || (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file)) | |
144 | #endif | |
145 | - )) { | |
146 | + ) { | |
147 | rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname); | |
148 | return; | |
149 | } | |
150 | commit d47d3792160210ce14700e38a223eaa0059f3551 | |
151 | Author: Wayne Davison <wayned@samba.org> | |
152 | Date: Sat Mar 16 11:12:53 2019 -0700 | |
153 | ||
154 | Fix bug in try_dests_reg that Florian Zumbiehl pointed out. | |
155 | ||
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. | |
160 | ||
161 | diff --git a/generator.c b/generator.c | |
162 | index 6021a220..5538a92d 100644 | |
163 | --- a/generator.c | |
164 | +++ b/generator.c | |
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)) | |
168 | continue; | |
169 | - switch (match_level) { | |
170 | - case 0: | |
171 | + if (match_level == 0) { | |
172 | best_match = j; | |
173 | match_level = 1; | |
174 | - /* FALL THROUGH */ | |
175 | - case 1: | |
176 | - if (!unchanged_file(cmpbuf, file, &sxp->st)) | |
177 | - continue; | |
178 | + } | |
179 | + if (!unchanged_file(cmpbuf, file, &sxp->st)) | |
180 | + continue; | |
181 | + if (match_level == 1) { | |
182 | best_match = j; | |
183 | match_level = 2; | |
184 | - /* FALL THROUGH */ | |
185 | - case 2: | |
186 | - if (!unchanged_attrs(cmpbuf, file, sxp)) { | |
187 | - free_stat_x(sxp); | |
188 | - continue; | |
189 | - } | |
190 | + } | |
191 | + if (unchanged_attrs(cmpbuf, file, sxp)) { | |
192 | best_match = j; | |
193 | match_level = 3; | |
194 | break; | |
195 | } | |
196 | - break; | |
197 | + free_stat_x(sxp); | |
198 | } while (basis_dir[++j] != NULL); | |
199 | ||
200 | if (!match_level) | |
201 | commit c0c6a97c35e8e4fb56ba26dc9c8447e26d94de06 | |
202 | Author: Wayne Davison <wayned@samba.org> | |
203 | Date: Sat Mar 16 11:49:53 2019 -0700 | |
204 | ||
205 | Try to fix the iconv crash in bug 11338. | |
206 | ||
207 | Applying Michal Ruprich's suggested patch for the rwrite() function that | |
208 | should hopefully help with a bug that I couldn't reproduce. | |
209 | ||
210 | diff --git a/log.c b/log.c | |
211 | index 21bcdfd9..a86edd74 100644 | |
212 | --- a/log.c | |
213 | +++ b/log.c | |
214 | @@ -378,10 +378,13 @@ output_msg: | |
215 | filtered_fwrite(f, convbuf, outbuf.len, 0); | |
216 | outbuf.len = 0; | |
217 | } | |
218 | - if (!ierrno || ierrno == E2BIG) | |
219 | - continue; | |
220 | - fprintf(f, "\\#%03o", CVAL(inbuf.buf, inbuf.pos++)); | |
221 | - inbuf.len--; | |
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++)); | |
227 | + inbuf.len--; | |
228 | + } | |
229 | } | |
230 | } else | |
231 | #endif |