*
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
- * Copyright (C) 2003-2014 Wayne Davison
+ * Copyright (C) 2003-2018 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 file_old_total;
extern int keep_dirlinks;
extern int make_backups;
+extern int sanitize_paths;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
}
/* Send all the data we read for this flist to the generator. */
start_flist_forward(ndx);
- flist = recv_file_list(f_in);
+ flist = recv_file_list(f_in, ndx);
flist->parent_ndx = ndx;
stop_flist_forward();
}
if (iflags & ITEM_XNAME_FOLLOWS) {
if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0)
exit_cleanup(RERR_PROTOCOL);
+
+ if (sanitize_paths) {
+ sanitize_path(buf, buf, "", 0, SP_DEFAULT);
+ len = strlen(buf);
+ }
} else {
*buf = '\0';
len = -1;
if (!(flags & ATTRS_SKIP_MTIME)
&& (sxp->st.st_mtime != file->modtime
#ifdef ST_MTIME_NSEC
- || (NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
+ || (flags & ATTRS_SET_NANO && NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
#endif
)) {
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode);
}
/* This is only called for SIGINT, SIGHUP, and SIGTERM. */
-RETSIGTYPE sig_int(int sig_num)
+void sig_int(int sig_num)
{
/* KLUGE: if the user hits Ctrl-C while ssh is prompting
* for a password, then our cleanup's sending of a SIGUSR1
if (make_backups > 0 && overwriting_basis) {
int ok = make_backup(fname, False);
if (!ok)
- return 1;
+ exit_cleanup(RERR_FILEIO);
if (ok == 1 && fnamecmp == fname)
fnamecmp = get_backup_name(fname);
}
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
- ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
+ ok_to_set_time ? ATTRS_SET_NANO : ATTRS_SKIP_MTIME);
/* move tmp file over real file */
if (DEBUG_GTE(RECV, 1))
do_set_file_attrs:
set_file_attrs(fnametmp, file, NULL, fnamecmp,
- ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
+ ok_to_set_time ? ATTRS_SET_NANO : ATTRS_SKIP_MTIME);
if (temp_copy_name) {
if (do_rename(fnametmp, fname) < 0) {