Check for EVP_MD_CTX_copy in crypto lib instead of MD5_Init.
[rsync.git] / main.c
diff --git a/main.c b/main.c
index 5a7fbdd70da1bf18a6bbc0888e043963678893e2..d2a7b9b53a8a661ec1b0085e439d8373082778b7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -89,7 +89,6 @@ extern int backup_dir_len;
 extern int basis_dir_cnt;
 extern int default_af_hint;
 extern int stdout_format_has_i;
-extern int trust_sender_filter;
 extern struct stats stats;
 extern char *stdout_format;
 extern char *logfile_format;
@@ -636,7 +635,6 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
 #ifdef ICONV_CONST
                setup_iconv();
 #endif
-               trust_sender_filter = 1;
        } else if (local_server) {
                /* If the user didn't request --[no-]whole-file, force
                 * it on, but only if we're not batch processing. */
@@ -662,6 +660,16 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
        return pid;
 }
 
+/* Older versions turn an empty string as a reference to the current directory.
+ * We now treat this as an error unless --old-args was used. */
+static char *dot_dir_or_error()
+{
+       if (old_style_args || am_server)
+               return ".";
+       rprintf(FERROR, "Empty destination arg specified (use \".\" or see --old-args).\n");
+       exit_cleanup(RERR_SYNTAX);
+}
+
 /* The receiving side operates in one of two modes:
  *
  * 1. it receives any number of files into a destination directory,
@@ -689,9 +697,8 @@ static char *get_local_name(struct file_list *flist, char *dest_path)
        if (!dest_path || list_only)
                return NULL;
 
-       /* Treat an empty string as a copy into the current directory. */
        if (!*dest_path)
-               dest_path = ".";
+               dest_path = dot_dir_or_error();
 
        if (daemon_filter_list.head) {
                char *slash = strrchr(dest_path, '/');
@@ -1078,6 +1085,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
        }
 
        am_generator = 1;
+       implied_filter_list.head = implied_filter_list.tail = NULL;
        flist_receiving_enabled = True;
 
        io_end_multiplex_in(MPLX_SWITCHING);
@@ -1433,6 +1441,8 @@ static int start_client(int argc, char *argv[])
 
                        if (argc > 1) {
                                p = argv[--argc];
+                               if (!*p)
+                                       p = dot_dir_or_error();
                                remote_argv = argv + argc;
                        } else {
                                static char *dotarg[1] = { "." };
@@ -1503,7 +1513,7 @@ static int start_client(int argc, char *argv[])
                int dummy_port = rsync_port;
                int i;
                if (filesfrom_fd < 0)
-                       add_implied_include(remote_argv[0]);
+                       add_implied_include(remote_argv[0], daemon_connection);
                /* For remote source, any extra source args must have either
                 * the same hostname or an empty hostname. */
                for (i = 1; i < remote_argc; i++) {
@@ -1527,7 +1537,7 @@ static int start_client(int argc, char *argv[])
                        if (!rsync_port && !*arg) /* Turn an empty arg into a dot dir. */
                                arg = ".";
                        remote_argv[i] = arg;
-                       add_implied_include(arg);
+                       add_implied_include(arg, daemon_connection);
                }
        }
 
@@ -1744,6 +1754,17 @@ int main(int argc,char *argv[])
 
        unset_env_var("DISPLAY");
 
+#if defined USE_OPENSSL && defined SET_OPENSSL_CONF
+#define TO_STR2(x) #x
+#define TO_STR(x) TO_STR2(x)
+       /* ./configure --with-openssl-conf=/etc/ssl/openssl-rsync.cnf
+        * defines SET_OPENSSL_CONF as that unquoted pathname. */
+       if (!getenv("OPENSSL_CONF")) /* Don't override it if it's already set. */
+               set_env_str("OPENSSL_CONF", TO_STR(SET_OPENSSL_CONF));
+#undef TO_STR
+#undef TO_STR2
+#endif
+
        memset(&stats, 0, sizeof(stats));
 
        /* Even a non-daemon runs needs the default config values to be set, e.g.