* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
if (tmp_dev != 0) {
if (protocol_version >= 30) {
struct idev_node *np = idev_node(tmp_dev, tmp_ino);
if (tmp_dev != 0) {
if (protocol_version >= 30) {
struct idev_node *np = idev_node(tmp_dev, tmp_ino);
uid = (uid_t)read_int(f);
if (flags & XMIT_USER_NAME_FOLLOWS)
uid = recv_user_name(f, uid);
uid = (uid_t)read_int(f);
if (flags & XMIT_USER_NAME_FOLLOWS)
uid = recv_user_name(f, uid);
uid = match_uid(uid);
}
if (preserve_gid && !(flags & XMIT_SAME_GID)) {
gid = (gid_t)read_int(f);
if (flags & XMIT_GROUP_NAME_FOLLOWS)
gid = recv_group_name(f, gid);
uid = match_uid(uid);
}
if (preserve_gid && !(flags & XMIT_SAME_GID)) {
gid = (gid_t)read_int(f);
if (flags & XMIT_GROUP_NAME_FOLLOWS)
gid = recv_group_name(f, gid);
- past_and_present = cur_flist->ndx_start - first_flist->ndx_start
- + cur_flist->count;
- while (file_total - past_and_present < at_least) {
+ if (cur_flist->next) {
+ flist = first_flist->prev; /* the newest flist */
+ future_cnt = flist->count
+ + flist->ndx_start - cur_flist->next->ndx_start;
+ } else
+ future_cnt = 0;
+ while (future_cnt < at_least) {
flist = flist_new(0, "send_extra_file_list");
start_write = stats.total_written;
flist = flist_new(0, "send_extra_file_list");
start_write = stats.total_written;
change_local_filter_dir(fbuf, dlen, send_dir_depth);
send_directory(f, flist, send_dir_ndx, fbuf, dlen, FLAG_DIVERT_DIRS | FLAG_XFER_DIR);
write_byte(f, 0);
clean_flist(flist, 0, 0);
file_total += flist->count;
change_local_filter_dir(fbuf, dlen, send_dir_depth);
send_directory(f, flist, send_dir_ndx, fbuf, dlen, FLAG_DIVERT_DIRS | FLAG_XFER_DIR);
write_byte(f, 0);
clean_flist(flist, 0, 0);
file_total += flist->count;
rprintf(FLOG, "building file list\n");
if (show_filelist_p())
start_filelist_progress("building file list");
rprintf(FLOG, "building file list\n");
if (show_filelist_p())
start_filelist_progress("building file list");
start_write = stats.total_written;
gettimeofday(&start_tv, NULL);
start_write = stats.total_written;
gettimeofday(&start_tv, NULL);
dir_flist = flist_new(FLIST_TEMP, "send_file_list");
flags = FLAG_DIVERT_DIRS;
} else {
dir_flist = flist_new(FLIST_TEMP, "send_file_list");
flags = FLAG_DIVERT_DIRS;
} else {
if (fn != p || (*lp && *lp != '/')) {
int save_copy_links = copy_links;
int save_xfer_dirs = xfer_dirs;
if (fn != p || (*lp && *lp != '/')) {
int save_copy_links = copy_links;
int save_xfer_dirs = xfer_dirs;
copy_links |= copy_unsafe_links;
xfer_dirs = 1;
while ((slash = strchr(slash+1, '/')) != 0) {
copy_links |= copy_unsafe_links;
xfer_dirs = 1;
while ((slash = strchr(slash+1, '/')) != 0) {
struct file_struct *file;
int top_flags = FLAG_TOP_DIR | FLAG_XFER_DIR
| (is_dot_dir ? 0 : flags)
struct file_struct *file;
int top_flags = FLAG_TOP_DIR | FLAG_XFER_DIR
| (is_dot_dir ? 0 : flags)
file = send_file_name(f, flist, fbuf, &st,
top_flags, ALL_FILTERS);
file = send_file_name(f, flist, fbuf, &st,
top_flags, ALL_FILTERS);
send_if_directory(f, flist, file, fbuf, len, flags);
} else
send_file_name(f, flist, fbuf, &st, flags, ALL_FILTERS);
send_if_directory(f, flist, file, fbuf, len, flags);
} else
send_file_name(f, flist, fbuf, &st, flags, ALL_FILTERS);
write_byte(f, 0); /* Indicate end of file list */
#ifdef SUPPORT_HARD_LINKS
write_byte(f, 0); /* Indicate end of file list */
#ifdef SUPPORT_HARD_LINKS
* kept. For incremental mode, the sender also removes duplicates
* in this initial file-list so that it avoids re-sending duplicated
* directories. */
* kept. For incremental mode, the sender also removes duplicates
* in this initial file-list so that it avoids re-sending duplicated
* directories. */
add_dirs_to_tree(-1, 0, dir_flist->count - 1);
if (file_total == 1) {
/* If we're creating incremental file-lists and there
* was just 1 item in the first file-list, send 1 more
* file-list to check if this is a 1-file xfer. */
if (send_dir_ndx < 0)
add_dirs_to_tree(-1, 0, dir_flist->count - 1);
if (file_total == 1) {
/* If we're creating incremental file-lists and there
* was just 1 item in the first file-list, send 1 more
* file-list to check if this is a 1-file xfer. */
if (send_dir_ndx < 0)
rprintf(FLOG, "receiving file list\n");
if (show_filelist_p())
start_filelist_progress("receiving file list");
rprintf(FLOG, "receiving file list\n");
if (show_filelist_p())
start_filelist_progress("receiving file list");
if (flist->ndx_start == 0)
dir_flist = flist_new(FLIST_TEMP, "recv_file_list");
dstart = dir_flist->count;
if (flist->ndx_start == 0)
dir_flist = flist_new(FLIST_TEMP, "recv_file_list");
dstart = dir_flist->count;
flags |= read_byte(f) << 8;
file = recv_file_entry(flist, flags, f);
flags |= read_byte(f) << 8;
file = recv_file_entry(flist, flags, f);
qsort(dir_flist->files + dstart, dir_flist->count - dstart,
sizeof dir_flist->files[0], (int (*)())file_compare);
} else if (f >= 0)
qsort(dir_flist->files + dstart, dir_flist->count - dstart,
sizeof dir_flist->files[0], (int (*)())file_compare);
} else if (f >= 0)