Make sure that config.h.in is up-to-date before allowing the
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index 5fba5e6..0774f1f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -4,7 +4,7 @@
  * Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org>
  * Copyright (C) 1996 Paul Mackerras
  * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2003-2008 Wayne Davison
+ * Copyright (C) 2003-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
@@ -469,7 +469,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
 #ifdef ICONV_CONST
                setup_iconv();
 #endif
-               if (protect_args)
+               if (protect_args && !daemon_over_rsh)
                        send_protected_args(*f_out_p, args);
        }
 
@@ -509,12 +509,13 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
 
        if (daemon_filter_list.head) {
                char *slash = strrchr(dest_path, '/');
-               if (slash && slash[1] == '\0')
+               if (slash && (slash[1] == '\0' || (slash[1] == '.' && slash[2] == '\0')))
                        *slash = '\0';
                else
                        slash = NULL;
-               if (check_filter(&daemon_filter_list, FLOG, dest_path, 0) < 0
-                || check_filter(&daemon_filter_list, FLOG, dest_path, 1) < 0) {
+               if ((*dest_path != '.' || dest_path[1] != '\0')
+                && (check_filter(&daemon_filter_list, FLOG, dest_path, 0) < 0
+                 || check_filter(&daemon_filter_list, FLOG, dest_path, 1) < 0)) {
                        rprintf(FERROR, "skipping daemon-excluded destination \"%s\"\n",
                                dest_path);
                        exit_cleanup(RERR_FILESELECT);
@@ -1015,7 +1016,6 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
                if (write_batch && !am_server)
                        start_write_batch(f_out);
                flist = send_file_list(f_out, argc, argv);
-               set_msg_fd_in(-1);
                if (verbose > 3)
                        rprintf(FINFO,"file list sent\n");
 
@@ -1186,8 +1186,8 @@ static int start_client(int argc, char *argv[])
                        rprintf(FERROR, "remote destination is not allowed with --read-batch\n");
                        exit_cleanup(RERR_SYNTAX);
                }
-               remote_argv = argv + argc - 1;
-               remote_argc = 1;
+               remote_argv = argv += argc - 1;
+               remote_argc = argc = 1;
        }
 
        if (am_sender) {