summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2020-02-26 11:46:51 +0000
committerDarren Tucker <dtucker@dtucker.net>2020-02-26 23:07:02 +1100
commit9e3220b585c5be19a7431ea4ff8884c137b3a81c (patch)
tree7d9398a01cef869f65106474a8764507be9d1477 /sftp.c
parentade8e67bb0f07b12e5e47e7baeafbdc898de639f (diff)
upstream: Have sftp reject "-1" in the same way as ssh(1) and
scp(1) do instead of accepting and silently ignoring it since protocol 1 support has been removed. Spotted by shivakumar2696 at gmail.com, ok deraadt@ OpenBSD-Commit-ID: b79f95559a1c993214f4ec9ae3c34caa87e9d5de
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sftp.c b/sftp.c
index ff14d3c29..fc809dc6e 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.197 2020/01/23 07:10:22 dtucker Exp $ */ 1/* $OpenBSD: sftp.c,v 1.198 2020/02/26 11:46:51 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -2377,7 +2377,7 @@ main(int argc, char **argv)
2377{ 2377{
2378 int in, out, ch, err, tmp, port = -1; 2378 int in, out, ch, err, tmp, port = -1;
2379 char *host = NULL, *user, *cp, *file2 = NULL; 2379 char *host = NULL, *user, *cp, *file2 = NULL;
2380 int debug_level = 0, sshver = 2; 2380 int debug_level = 0;
2381 char *file1 = NULL, *sftp_server = NULL; 2381 char *file1 = NULL, *sftp_server = NULL;
2382 char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL; 2382 char *ssh_program = _PATH_SSH_PROGRAM, *sftp_direct = NULL;
2383 const char *errstr; 2383 const char *errstr;
@@ -2445,12 +2445,10 @@ main(int argc, char **argv)
2445 debug_level++; 2445 debug_level++;
2446 break; 2446 break;
2447 case '1': 2447 case '1':
2448 sshver = 1; 2448 fatal("SSH protocol v.1 is no longer supported");
2449 if (sftp_server == NULL)
2450 sftp_server = _PATH_SFTP_SERVER;
2451 break; 2449 break;
2452 case '2': 2450 case '2':
2453 sshver = 2; 2451 /* accept silently */
2454 break; 2452 break;
2455 case 'a': 2453 case 'a':
2456 global_aflag = 1; 2454 global_aflag = 1;
@@ -2555,7 +2553,6 @@ main(int argc, char **argv)
2555 addargs(&args, "-l"); 2553 addargs(&args, "-l");
2556 addargs(&args, "%s", user); 2554 addargs(&args, "%s", user);
2557 } 2555 }
2558 addargs(&args, "-oProtocol %d", sshver);
2559 2556
2560 /* no subsystem if the server-spec contains a '/' */ 2557 /* no subsystem if the server-spec contains a '/' */
2561 if (sftp_server == NULL || strchr(sftp_server, '/') == NULL) 2558 if (sftp_server == NULL || strchr(sftp_server, '/') == NULL)