X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/d4d56eed8a2dfdd2cd78a19f9c1bae02496427e3..7a498f5b6c49690344a288059434e8886937a80f:/flist.c diff --git a/flist.c b/flist.c index 570c3b79..3e79ce10 100644 --- a/flist.c +++ b/flist.c @@ -4,7 +4,7 @@ * Copyright (C) 1996 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2002-2008 Wayne Davison + * Copyright (C) 2002-2009 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,6 +72,7 @@ extern int sender_keeps_checksum; extern int unsort_ndx; extern struct stats stats; extern char *filesfrom_host; +extern char *usermap, *groupmap; extern char curr_dir[MAXPATHLEN]; @@ -802,7 +803,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist, uid = (uid_t)read_varint(f); if (xflags & XMIT_USER_NAME_FOLLOWS) uid = recv_user_name(f, uid); - else if (inc_recurse && am_root && !numeric_ids) + else if (inc_recurse && am_root && (!numeric_ids || usermap)) uid = match_uid(uid); } } @@ -814,7 +815,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist, gid_flags = 0; if (xflags & XMIT_GROUP_NAME_FOLLOWS) gid = recv_group_name(f, gid, &gid_flags); - else if (inc_recurse && (!am_root || !numeric_ids)) + else if (inc_recurse && (!am_root || !numeric_ids || groupmap)) gid = match_gid(gid, &gid_flags); } } @@ -1377,6 +1378,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, #endif #if defined SUPPORT_ACLS || defined SUPPORT_XATTRS stat_x sx; + init_stat_x(&sx); #endif #ifdef SUPPORT_LINKS @@ -1440,7 +1442,6 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, #ifdef SUPPORT_ACLS if (preserve_acls && !S_ISLNK(file->mode)) { sx.st.st_mode = file->mode; - sx.acc_acl = sx.def_acl = NULL; if (get_acl(fname, &sx) < 0) { io_error |= IOERR_GENERAL; return NULL; @@ -1449,7 +1450,6 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { - sx.xattr = NULL; if (get_xattr(fname, &sx) < 0) { io_error |= IOERR_GENERAL; return NULL; @@ -1638,6 +1638,8 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len, assert(flist != NULL); if (!(d = opendir(fbuf))) { + if (errno == ENOENT) + return; io_error |= IOERR_GENERAL; rsyserr(FERROR_XFER, errno, "opendir %s failed", full_fname(fbuf)); return; @@ -1913,7 +1915,7 @@ void send_extra_file_list(int f, int at_least) write_byte(f, 0); else { write_shortint(f, XMIT_EXTENDED_FLAGS|XMIT_IO_ERROR_ENDLIST); - write_int(f, io_error); + write_varint(f, io_error); } if (need_unsorted_flist) { @@ -2216,7 +2218,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) write_byte(f, 0); else { write_shortint(f, XMIT_EXTENDED_FLAGS|XMIT_IO_ERROR_ENDLIST); - write_int(f, io_error); + write_varint(f, io_error); } #ifdef SUPPORT_HARD_LINKS @@ -2303,6 +2305,10 @@ struct file_list *recv_file_list(int f) else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server) rprintf(FCLIENT, "receiving incremental file list\n"); rprintf(FLOG, "receiving file list\n"); + if (usermap) + parse_name_map(usermap, True); + if (groupmap) + parse_name_map(groupmap, False); } start_read = stats.total_read; @@ -2335,7 +2341,7 @@ struct file_list *recv_file_list(int f) rprintf(FERROR, "Invalid flist flag: %x\n", flags); exit_cleanup(RERR_PROTOCOL); } - err = read_int(f); + err = read_varint(f); if (!ignore_errors) io_error |= err; break;