It's not exactly un-common to use an "empty" @ in SCP or SFTP connection 
strings. Rsync though injects a dangling '-l' when constructing the SSH 
command-line.

Sure, maybe the answer is "stop doing that" but the fix is really simple and I 
think worth implementing.


diff --git a/main.c b/main.c
index 99dae1c1..d8713cc6 100644
--- a/main.c
+++ b/main.c
@@ -485,15 +485,12 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, 
char **remote_argv, in
 #ifdef HAVE_REMSH
                /* remsh (on HPUX) takes the arguments the other way around */
                args[argc++] = machine;
-               if (user && !(daemon_over_rsh && dash_l_set)) {
-                       args[argc++] = "-l";
-                       args[argc++] = user;
-               }
-#else
-               if (user && !(daemon_over_rsh && dash_l_set)) {
+#endif
+               if (user && *user != '\0' && !(daemon_over_rsh && dash_l_set)) {
                        args[argc++] = "-l";
                        args[argc++] = user;
                }
+#ifndef HAVE_REMSH
                args[argc++] = machine;
 #endif

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to