A few more tweaks.
[rsync.git] / main.c
diff --git a/main.c b/main.c
index 31a28f51317325b7757885e989fe57ae110fc0c7..02b70079e5df40c4858b22c3cbdb3f8307a80c19 100644 (file)
--- a/main.c
+++ b/main.c
@@ -48,6 +48,7 @@ extern int called_from_signal_handler;
 extern int need_messages_from_generator;
 extern int kluge_around_eof;
 extern int got_xfer_error;
+extern int old_style_args;
 extern int msgs2stderr;
 extern int module_id;
 extern int read_only;
@@ -103,7 +104,7 @@ extern char curr_dir[MAXPATHLEN];
 extern char backup_dir_buf[MAXPATHLEN];
 extern char *basis_dir[MAX_BASIS_DIRS+1];
 extern struct file_list *first_flist;
-extern filter_rule_list daemon_filter_list;
+extern filter_rule_list daemon_filter_list, implied_filter_list;
 
 uid_t our_uid;
 gid_t our_gid;
@@ -477,7 +478,7 @@ static void show_malloc_stats(void)
 
 #define PRINT_ALLOC_NUM(title, descr, num) \
        rprintf(FINFO, "  %-11s%10" SIZE_T_FMT_MOD "d   (" descr ")\n", \
-              title ":", (SIZE_T_FMT_CAST)(num));
+               title ":", (SIZE_T_FMT_CAST)(num));
 
        PRINT_ALLOC_NUM("arena", "bytes from sbrk", mi.arena);
        PRINT_ALLOC_NUM("ordblks", "chunks not in use", mi.ordblks);
@@ -1075,6 +1076,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);
@@ -1470,6 +1472,10 @@ static int start_client(int argc, char *argv[])
                rsync_port = 0;
        }
 
+       /* A local transfer doesn't unbackslash anything, so leave the args alone. */
+       if (local_server)
+               old_style_args = 2;
+
        if (!rsync_port && remote_argc && !**remote_argv) /* Turn an empty arg into a dot dir. */
                *remote_argv = ".";
 
@@ -1495,6 +1501,8 @@ static int start_client(int argc, char *argv[])
                char *dummy_host;
                int dummy_port = rsync_port;
                int i;
+               if (filesfrom_fd < 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++) {
@@ -1518,6 +1526,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, daemon_connection);
                }
        }
 
@@ -1734,6 +1743,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.