diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2019-06-07 03:47:12 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2019-06-08 00:25:42 +1000 |
commit | 25e3bccbaa63d27b9d5e09c123f1eb28594d2bd6 (patch) | |
tree | cde574c536cb15f78f91a35a16e25cfebc17a227 /sftp.c | |
parent | 0323d9b619d512f80c57575b810a05791891f657 (diff) |
upstream: 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@
OpenBSD-Commit-ID: d989217110932490ba8ce92127a9a6838878928b
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.191 2019/06/06 05:13:13 otto Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.192 2019/06/07 03:47:12 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 | * |
@@ -2527,12 +2527,17 @@ main(int argc, char **argv) | |||
2527 | port = tmp; | 2527 | port = tmp; |
2528 | break; | 2528 | break; |
2529 | default: | 2529 | default: |
2530 | /* Try with user, host and path. */ | ||
2530 | if (parse_user_host_path(*argv, &user, &host, | 2531 | if (parse_user_host_path(*argv, &user, &host, |
2531 | &file1) == -1) { | 2532 | &file1) == 0) |
2532 | /* Treat as a plain hostname. */ | 2533 | break; |
2533 | host = xstrdup(*argv); | 2534 | /* Try with user and host. */ |
2534 | host = cleanhostname(host); | 2535 | if (parse_user_host_port(*argv, &user, &host, NULL) |
2535 | } | 2536 | == 0) |
2537 | break; | ||
2538 | /* Treat as a plain hostname. */ | ||
2539 | host = xstrdup(*argv); | ||
2540 | host = cleanhostname(host); | ||
2536 | break; | 2541 | break; |
2537 | } | 2542 | } |
2538 | file2 = *(argv + 1); | 2543 | file2 = *(argv + 1); |