diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2021-07-05 00:25:43 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2021-07-05 00:25:43 +0000 |
commit | 7e32d00866fa5388e5b53d2ec0b6404761c74977 (patch) | |
tree | 4efa477dec790288931d49beae71a89bc6e92765 /usr.bin | |
parent | ed14f7abe4d4a14d5988fd037641ac1922ef67e0 (diff) |
allow spaces to appear in usernames for local to remote, and scp -3
remote to remote copies. with & ok dtucker bz#1164
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/scp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index ca8f81de655..fc84791d65a 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.214 2021/04/03 06:18:40 djm Exp $ */ +/* $OpenBSD: scp.c,v 1.215 2021/07/05 00:25:42 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -888,10 +888,6 @@ toremote(int argc, char **argv) goto out; } } - if (tuser != NULL && !okname(tuser)) { - ++errs; - goto out; - } /* Parse source files */ for (i = 0; i < argc - 1; i++) { @@ -926,6 +922,15 @@ toremote(int argc, char **argv) (void) close(remout); remin = remout = -1; } else if (host) { /* standard remote to remote */ + /* + * Second remote user is passed to first remote side + * via scp command-line. Ensure it contains no obvious + * shell characters. + */ + if (tuser != NULL && !okname(tuser)) { + ++errs; + continue; + } if (tport != -1 && tport != SSH_DEFAULT_PORT) { /* This would require the remote support URIs */ fatal("target port not supported with two " |