extern char *password_file;
extern char curr_dir[MAXPATHLEN];
extern struct file_list *first_flist;
-extern struct filter_list_struct server_filter_list;
+extern struct filter_list_struct daemon_filter_list;
uid_t our_uid;
int local_server = 0;
cmd = rsh_env;
if (!cmd)
cmd = RSYNC_RSH;
- cmd = strdup(cmd);
+ cmd = strdup(cmd); /* MEMORY LEAK */
if (!cmd)
goto oom;
if (!dest_path || list_only)
return NULL;
+ if (daemon_filter_list.head
+ && (check_filter(&daemon_filter_list, FLOG, dest_path, 0 != 0) < 0
+ || check_filter(&daemon_filter_list, FLOG, dest_path, 1 != 0) < 0)) {
+ rprintf(FERROR, "skipping daemon-excluded destination \"%s\"\n",
+ dest_path);
+ exit_cleanup(RERR_FILESELECT);
+ }
+
/* See what currently exists at the destination. */
if ((statret = do_stat(dest_path, &st)) == 0) {
/* If the destination is a dir, enter it and use mode 1. */
if (sanitize_paths) {
char **dir_p;
for (dir_p = basis_dir; *dir_p; dir_p++)
- *dir_p = sanitize_path(NULL, *dir_p, NULL, curr_dir_depth);
+ *dir_p = sanitize_path(NULL, *dir_p, NULL, curr_dir_depth, SP_DEFAULT);
if (partial_dir)
- partial_dir = sanitize_path(NULL, partial_dir, NULL, curr_dir_depth);
+ partial_dir = sanitize_path(NULL, partial_dir, NULL, curr_dir_depth, SP_DEFAULT);
}
check_alt_basis_dirs();
- if (server_filter_list.head) {
+ if (daemon_filter_list.head) {
char **dir_p;
- struct filter_list_struct *elp = &server_filter_list;
+ struct filter_list_struct *elp = &daemon_filter_list;
for (dir_p = basis_dir; *dir_p; dir_p++) {
char *dir = *dir_p;
if (*dir == '/')
dir += module_dirlen;
- if (check_filter(elp, dir, 1) < 0)
+ if (check_filter(elp, FLOG, dir, 1) < 0)
goto options_rejected;
}
if (partial_dir && *partial_dir == '/'
- && check_filter(elp, partial_dir + module_dirlen, 1) < 0) {
+ && check_filter(elp, FLOG, partial_dir + module_dirlen, 1) < 0) {
options_rejected:
rprintf(FERROR,
"Your options have been rejected by the server.\n");
io_start_multiplex_out();
}
- if (argc == 0) {
- list_only |= 1;
- xfer_dirs |= 1;
- }
-
send_filter_list(read_batch ? -1 : f_out);
if (filesfrom_fd >= 0) {
static char *dotarg[1] = { "." };
p = dotarg[0];
remote_argv = dotarg;
- list_only |= 1;
- xfer_dirs |= 1;
}
remote_argc = 1;
}
remote_argv[i] = arg;
}
- if (argc == 0) {
- list_only |= 1;
- xfer_dirs |= 1;
- }
}
if (daemon_over_rsh < 0)