diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2011-09-09 22:37:02 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2011-09-09 22:37:02 +0000 |
commit | 316ce21a5f7b3d59c79f0dc2e182dc66b9ec4511 (patch) | |
tree | 4349757d6bb0a40f67e72f2aeb00ece5bc68c73d /usr.bin | |
parent | 31f431fbacc5259bd38dcfef6b58fcac75348386 (diff) |
suppress adding '--' to remote commandlines when the first argument
does not start with '-'. saves breakage on some difficult-to-upgrade
embedded/router platforms; feedback & ok dtucker ok markus
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/scp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index fbab0c5b1bc..ec8eac8343a 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.170 2010/12/09 14:13:33 jmc Exp $ */ +/* $OpenBSD: scp.c,v 1.171 2011/09/09 22:37:01 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -580,12 +580,14 @@ toremote(char *targ, int argc, char **argv) host = cleanhostname(argv[i]); suser = NULL; } - xasprintf(&bp, "%s -f -- %s", cmd, src); + xasprintf(&bp, "%s -f %s%s", cmd, + *src == '-' ? "-- " : "", src); if (do_cmd(host, suser, bp, &remin, &remout) < 0) exit(1); (void) xfree(bp); host = cleanhostname(thost); - xasprintf(&bp, "%s -t -- %s", cmd, targ); + xasprintf(&bp, "%s -t %s%s", cmd, + *targ == '-' ? "-- " : "", targ); if (do_cmd2(host, tuser, bp, remin, remout) < 0) exit(1); (void) xfree(bp); @@ -631,7 +633,8 @@ toremote(char *targ, int argc, char **argv) errs = 1; } else { /* local to remote */ if (remin == -1) { - xasprintf(&bp, "%s -t -- %s", cmd, targ); + xasprintf(&bp, "%s -t %s%s", cmd, + *targ == '-' ? "-- " : "", targ); host = cleanhostname(thost); if (do_cmd(host, tuser, bp, &remin, &remout) < 0) @@ -684,7 +687,8 @@ tolocal(int argc, char **argv) suser = pwd->pw_name; } host = cleanhostname(host); - xasprintf(&bp, "%s -f -- %s", cmd, src); + xasprintf(&bp, "%s -f %s%s", + cmd, *src == '-' ? "-- " : "", src); if (do_cmd(host, suser, bp, &remin, &remout) < 0) { (void) xfree(bp); ++errs; |