summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2021-08-07 00:00:33 +0000
committerDamien Miller <djm@mindrot.org>2021-08-07 10:20:24 +1000
commite3c0ba05873cf3d3f7d19d595667a251026b2d84 (patch)
treef2b281c7358a076533545221d96768df734a4053 /scp.c
parent395d8fbdb094497211e1461cf0e2f80af5617e0a (diff)
downloadopenssh-git-e3c0ba05873cf3d3f7d19d595667a251026b2d84.tar.gz
upstream: prepare for scp -3 implemented via sftp
OpenBSD-Commit-ID: 194aac0dd87cb175334b71c2a30623a5ad55bb44
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/scp.c b/scp.c
index 9cfcfd84..3125d336 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.217 2021/08/04 01:34:55 dtucker Exp $ */
+/* $OpenBSD: scp.c,v 1.218 2021/08/07 00:00:33 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -453,6 +453,8 @@ main(int argc, char **argv)
__progname = ssh_get_progname(argv[0]);
+ log_init(argv0, log_level, SYSLOG_FACILITY_USER, 1);
+
memset(&args, '\0', sizeof(args));
memset(&remote_remote_args, '\0', sizeof(remote_remote_args));
args.list = remote_remote_args.list = NULL;
@@ -576,11 +578,8 @@ main(int argc, char **argv)
/* Do this last because we want the user to be able to override it */
addargs(&args, "-oForwardAgent=no");
- if (mode != MODE_SFTP && sftp_direct != NULL)
- fatal("SFTP direct can be used only in SFTP mode");
-
- if (mode == MODE_SFTP && iamremote)
- fatal("The server can not be ran in SFTP mode");
+ if (iamremote)
+ mode = MODE_SCP;
if ((pwd = getpwuid(userid = getuid())) == NULL)
fatal("unknown user %u", (u_int) userid);
@@ -1012,11 +1011,7 @@ toremote(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
continue;
}
if (host && throughlocal) { /* extended remote to remote */
- if (mode == MODE_SFTP) {
- /* TODO */
- fatal("Extended remote to remote through local "
- "is not yet supported with SFTP");
- }
+ /* XXX uses scp; need to support SFTP remote-remote */
xasprintf(&bp, "%s -f %s%s", cmd,
*src == '-' ? "-- " : "", src);
if (do_cmd(ssh_program, host, suser, sport, bp,
@@ -1068,14 +1063,6 @@ toremote(int argc, char **argv, enum scp_mode_e mode, char *sftp_direct)
addargs(&alist, "--");
addargs(&alist, "%s", host);
addargs(&alist, "%s", cmd);
- /*
- * This will work only if the first remote scp
- * supports sftp mode
- */
- if (mode == MODE_SFTP) {
- addargs(&alist, "-M");
- addargs(&alist, "sftp");
- }
addargs(&alist, "%s", src);
addargs(&alist, "%s%s%s:%s",
tuser ? tuser : "", tuser ? "@" : "",