summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2019-06-07 03:47:13 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2019-06-07 03:47:13 +0000
commite2edea1e14ffe251df99ceeda987d84d8fdb03ef (patch)
tree0acad8adb59fc9e64c6d04d48a44e9c31b03d13a /usr.bin/ssh
parent4e16c10b2eb2d9d702d1df2e5788d24c124b1956 (diff)
Check for user@host when parsing sftp target. This allows user@[1.2.3.4]
to work without a path in addition to with one. bz#2999, ok djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/sftp.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index ce0df52749d..b81055f6275 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.191 2019/06/06 05:13:13 otto Exp $ */
+/* $OpenBSD: sftp.c,v 1.192 2019/06/07 03:47:12 dtucker Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -2477,12 +2477,17 @@ main(int argc, char **argv)
port = tmp;
break;
default:
+ /* Try with user, host and path. */
if (parse_user_host_path(*argv, &user, &host,
- &file1) == -1) {
- /* Treat as a plain hostname. */
- host = xstrdup(*argv);
- host = cleanhostname(host);
- }
+ &file1) == 0)
+ break;
+ /* Try with user and host. */
+ if (parse_user_host_port(*argv, &user, &host, NULL)
+ == 0)
+ break;
+ /* Treat as a plain hostname. */
+ host = xstrdup(*argv);
+ host = cleanhostname(host);
break;
}
file2 = *(argv + 1);