summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2008-09-22 15:47:35 +0000
committerMatt Johnston <matt@ucc.asn.au>2008-09-22 15:47:35 +0000
commit299d26dab7af8d7712944c61c21129a81d7bb889 (patch)
tree02355e83747cda079c648f6d1ca44c132ddca74d
parent643626d54652e2c82451f4d953a9264111d16c63 (diff)
- Work around rsync and scp parsing and modifying the user@host argument,
which break's dbclient's multihop syntax --HG-- extra : convert_revision : cf704125a4785278aeb79f62bf025638e1b28e4c
-rw-r--r--cli-runopts.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/cli-runopts.c b/cli-runopts.c
index ca58899..0641ec7 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -412,7 +412,20 @@ static void parse_multihop_hostname(const char* orighostarg, const char* argv0)
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) {