diff options
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -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.200 2020/04/03 05:53:52 jmc 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 | * |
@@ -2363,7 +2363,7 @@ usage(void) | |||
2363 | extern char *__progname; | 2363 | extern char *__progname; |
2364 | 2364 | ||
2365 | fprintf(stderr, | 2365 | fprintf(stderr, |
2366 | "usage: %s [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]\n" | 2366 | "usage: %s [-46aCfNpqrv] [-B buffer_size] [-b batchfile] [-c cipher]\n" |
2367 | " [-D sftp_server_path] [-F ssh_config] [-i identity_file]\n" | 2367 | " [-D sftp_server_path] [-F ssh_config] [-i identity_file]\n" |
2368 | " [-J destination] [-l limit] [-o ssh_option] [-P port]\n" | 2368 | " [-J destination] [-l limit] [-o ssh_option] [-P port]\n" |
2369 | " [-R num_requests] [-S program] [-s subsystem | sftp_server]\n" | 2369 | " [-R num_requests] [-S program] [-s subsystem | sftp_server]\n" |
@@ -2375,9 +2375,9 @@ usage(void) | |||
2375 | int | 2375 | int |
2376 | main(int argc, char **argv) | 2376 | 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, noisy = 0; |
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; |
@@ -2409,7 +2409,7 @@ main(int argc, char **argv) | |||
2409 | infile = stdin; | 2409 | infile = stdin; |
2410 | 2410 | ||
2411 | while ((ch = getopt(argc, argv, | 2411 | while ((ch = getopt(argc, argv, |
2412 | "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) { | 2412 | "1246afhNpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) { |
2413 | switch (ch) { | 2413 | switch (ch) { |
2414 | /* Passed through to ssh(1) */ | 2414 | /* Passed through to ssh(1) */ |
2415 | case '4': | 2415 | case '4': |
@@ -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; |
@@ -2475,6 +2473,9 @@ main(int argc, char **argv) | |||
2475 | case 'f': | 2473 | case 'f': |
2476 | global_fflag = 1; | 2474 | global_fflag = 1; |
2477 | break; | 2475 | break; |
2476 | case 'N': | ||
2477 | noisy = 1; /* Used to clear quiet mode after getopt */ | ||
2478 | break; | ||
2478 | case 'p': | 2479 | case 'p': |
2479 | global_pflag = 1; | 2480 | global_pflag = 1; |
2480 | break; | 2481 | break; |
@@ -2513,6 +2514,9 @@ main(int argc, char **argv) | |||
2513 | if (!isatty(STDERR_FILENO)) | 2514 | if (!isatty(STDERR_FILENO)) |
2514 | showprogress = 0; | 2515 | showprogress = 0; |
2515 | 2516 | ||
2517 | if (noisy) | ||
2518 | quiet = 0; | ||
2519 | |||
2516 | log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); | 2520 | log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); |
2517 | 2521 | ||
2518 | if (sftp_direct == NULL) { | 2522 | if (sftp_direct == NULL) { |
@@ -2555,7 +2559,6 @@ main(int argc, char **argv) | |||
2555 | addargs(&args, "-l"); | 2559 | addargs(&args, "-l"); |
2556 | addargs(&args, "%s", user); | 2560 | addargs(&args, "%s", user); |
2557 | } | 2561 | } |
2558 | addargs(&args, "-oProtocol %d", sshver); | ||
2559 | 2562 | ||
2560 | /* no subsystem if the server-spec contains a '/' */ | 2563 | /* no subsystem if the server-spec contains a '/' */ |
2561 | if (sftp_server == NULL || strchr(sftp_server, '/') == NULL) | 2564 | if (sftp_server == NULL || strchr(sftp_server, '/') == NULL) |