* 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
extern int unsort_ndx;
extern struct stats stats;
extern char *filesfrom_host;
+extern char *usermap, *groupmap;
extern char curr_dir[MAXPATHLEN];
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);
}
}
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);
}
}
#endif
#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
stat_x sx;
+ init_stat_x(&sx);
#endif
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(file->mode)) {
symlink_name = F_SYMLINK(file);
symlink_len = strlen(symlink_name);
+ if (symlink_len == 0) {
+ io_error |= IOERR_GENERAL;
+ f_name(file, fbuf);
+ rprintf(FERROR_XFER,
+ "skipping symlink with 0-length value: %s\n",
+ full_fname(fbuf));
+ return NULL;
+ }
} else {
symlink_name = NULL;
symlink_len = 0;
#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;
#endif
#ifdef SUPPORT_XATTRS
if (preserve_xattrs) {
- sx.xattr = NULL;
if (get_xattr(fname, &sx) < 0) {
io_error |= IOERR_GENERAL;
return NULL;
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;
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) {
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
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;
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;