X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/53936ef935e97d2036ad09b61b7040979d175469..d48810ba5b0b8d09b272092a70da1255c2346ab8:/main.c diff --git a/main.c b/main.c index 8de7f1bd..5985f808 100644 --- a/main.c +++ b/main.c @@ -78,7 +78,7 @@ extern char *batch_name; 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; @@ -341,7 +341,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in cmd = rsh_env; if (!cmd) cmd = RSYNC_RSH; - cmd = strdup(cmd); + cmd = strdup(cmd); /* MEMORY LEAK */ if (!cmd) goto oom; @@ -507,6 +507,14 @@ static char *get_local_name(struct file_list *flist, char *dest_path) if (!dest_path || list_only) return NULL; + if (daemon_filter_list.head + && (check_filter(&daemon_filter_list, dest_path, 0 != 0) < 0 + || check_filter(&daemon_filter_list, 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. */ @@ -894,15 +902,15 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[]) 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;