# HG changeset patch # User Matt Johnston # Date 1222098455 0 # Node ID 66eac4631d8833632a5d41a331837d44cba773b0 # Parent b956d6151600807c11d0b1dce60ba2e4760c994b - Work around rsync and scp parsing and modifying the user@host argument, which break's dbclient's multihop syntax diff -r b956d6151600 -r 66eac4631d88 cli-runopts.c --- a/cli-runopts.c Mon Sep 22 14:13:44 2008 +0000 +++ b/cli-runopts.c Mon Sep 22 15:47:35 2008 +0000 @@ -412,7 +412,20 @@ char *last_hop = NULL;; char *remainder = NULL; - userhostarg = m_strdup(orighostarg); + /* both scp and rsync parse a user@host argument + * and turn it into "-l user host". This breaks + * for our multihop syntax, so we suture it back together. + * This will break usernames that have both '@' and ',' in them, + * though that should be fairly uncommon. */ + if (cli_opts.username + && strchr(cli_opts.username, ',') + && strchr(cli_opts.username, '@')) { + unsigned int len = strlen(orighostarg) + strlen(cli_opts.username) + 2; + userhostarg = m_malloc(len); + snprintf(userhostarg, len, "%s@%s", cli_opts.username, orighostarg); + } else { + userhostarg = m_strdup(orighostarg); + } last_hop = strrchr(userhostarg, ','); if (last_hop) {