Update the copyright year.
[rsync/rsync.git] / flist.c
diff --git a/flist.c b/flist.c
index 570c3b7..2e449c0 100644 (file)
--- 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 <mbp@samba.org>
- * 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;
@@ -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;