matthew patton
2018-Oct-18 06:24 UTC
patch for consideration - support empty '@' in do_cmd()
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