summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2021-08-10 03:33:34 +0000
committerDamien Miller <djm@mindrot.org>2021-08-10 13:37:20 +1000
commit391ca67fb978252c48d20c910553f803f988bd37 (patch)
tree1397b9f73af8e1a8720b71692ce08bc682b156df /scp.c
parentbfdd4b722f124a4fa9173d20dd64dd0fc69856be (diff)
downloadopenssh-git-391ca67fb978252c48d20c910553f803f988bd37.tar.gz
upstream: Prepare for a future where scp(1) uses the SFTP protocol by
default. Replace recently added -M option to select the protocol with -O (olde) and -s (SFTP) flags, and label the -s flag with a clear warning that it will be removed in the near future (so no, don't use it in scripts!). prompted by/feedback from deraadt@ OpenBSD-Commit-ID: 92ad72cc6f0023c9be9e316d8b30eb6d8d749cfc
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/scp.c b/scp.c
index 3eda5483..e6935436 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.229 2021/08/09 23:56:36 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.230 2021/08/10 03:33:34 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -448,7 +448,6 @@ main(int argc, char **argv)
const char *errstr;
extern char *optarg;
extern int optind;
- /* For now, keep SCP as default */
enum scp_mode_e mode = MODE_SCP;
char *sftp_direct = NULL;
@@ -482,7 +481,7 @@ main(int argc, char **argv)
fflag = Tflag = tflag = 0;
while ((ch = getopt(argc, argv,
- "12346ABCTdfpqRrtvD:F:J:M:P:S:c:i:l:o:")) != -1) {
+ "12346ABCTdfOpqRrstvD:F:J:M:P:S:c:i:l:o:")) != -1) {
switch (ch) {
/* User-visible flags. */
case '1':
@@ -517,6 +516,12 @@ main(int argc, char **argv)
addargs(&args, "-%c", ch);
addargs(&args, "%s", optarg);
break;
+ case 'O':
+ mode = MODE_SCP;
+ break;
+ case 's':
+ mode = MODE_SFTP;
+ break;
case 'P':
sshport = a2port(optarg);
if (sshport <= 0)
@@ -526,14 +531,6 @@ main(int argc, char **argv)
addargs(&remote_remote_args, "-oBatchmode=yes");
addargs(&args, "-oBatchmode=yes");
break;
- case 'M':
- if (strcmp(optarg, "sftp") == 0)
- mode = MODE_SFTP;
- else if (strcmp(optarg, "scp") == 0)
- mode = MODE_SCP;
- else
- usage();
- break;
case 'l':
limit_kbps = strtonum(optarg, 1, 100 * 1024 * 1024,
&errstr);
@@ -1987,8 +1984,8 @@ void
usage(void)
{
(void) fprintf(stderr,
- "usage: scp [-346ABCpqRrTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]\n"
- " [-i identity_file] [-J destination] [-l limit] [-M scp|sftp]\n"
+ "usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]\n"
+ " [-i identity_file] [-J destination] [-l limit]\n"
" [-o ssh_option] [-P port] [-S program] source ... target\n");
exit(1);
}