- djm@cvs.openbsd.org 2011/09/09 22:37:01

[scp.c]
     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
This commit is contained in:
Damien Miller 2011-09-22 21:38:00 +10:00
parent 4cb855b070
commit 0603d98b4e
2 changed files with 14 additions and 5 deletions

View File

@ -42,6 +42,11 @@
[PROTOCOL.mux] [PROTOCOL.mux]
MUX_C_CLOSE_FWD includes forward type in message (though it isn't MUX_C_CLOSE_FWD includes forward type in message (though it isn't
implemented anyway) implemented anyway)
- djm@cvs.openbsd.org 2011/09/09 22:37:01
[scp.c]
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
20110909 20110909
- (dtucker) [entropy.h] Bug #1932: remove old definition of init_rng. From - (dtucker) [entropy.h] Bug #1932: remove old definition of init_rng. From

14
scp.c
View File

@ -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 * scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd). * uses ssh to do the data transfer (instead of using rcmd).
@ -601,12 +601,14 @@ toremote(char *targ, int argc, char **argv)
host = cleanhostname(argv[i]); host = cleanhostname(argv[i]);
suser = NULL; 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) if (do_cmd(host, suser, bp, &remin, &remout) < 0)
exit(1); exit(1);
(void) xfree(bp); (void) xfree(bp);
host = cleanhostname(thost); 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) if (do_cmd2(host, tuser, bp, remin, remout) < 0)
exit(1); exit(1);
(void) xfree(bp); (void) xfree(bp);
@ -652,7 +654,8 @@ toremote(char *targ, int argc, char **argv)
errs = 1; errs = 1;
} else { /* local to remote */ } else { /* local to remote */
if (remin == -1) { if (remin == -1) {
xasprintf(&bp, "%s -t -- %s", cmd, targ); xasprintf(&bp, "%s -t %s%s", cmd,
*targ == '-' ? "-- " : "", targ);
host = cleanhostname(thost); host = cleanhostname(thost);
if (do_cmd(host, tuser, bp, &remin, if (do_cmd(host, tuser, bp, &remin,
&remout) < 0) &remout) < 0)
@ -705,7 +708,8 @@ tolocal(int argc, char **argv)
suser = pwd->pw_name; suser = pwd->pw_name;
} }
host = cleanhostname(host); 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) { if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
(void) xfree(bp); (void) xfree(bp);
++errs; ++errs;