From 46bbbe3326d69a84d94caca656c40a4521c10c45 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 7 Oct 2009 08:21:48 +1100 Subject: - djm@cvs.openbsd.org 2009/08/12 00:13:00 [sftp.c sftp.1] support most of scp(1)'s commandline arguments in sftp(1), as a first step towards making sftp(1) a drop-in replacement for scp(1). One conflicting option (-P) has not been changed, pending further discussion. Patch from carlosvsilvapt@gmail.com as part of his work in the Google Summer of Code --- ChangeLog | 11 +++++++++++ sftp.1 | 31 ++++++++++++++++++++++++++++--- sftp.c | 57 ++++++++++++++++++++++++++++++++++++--------------------- 3 files changed, 75 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2278830f3..e417906e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +20091007 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2009/08/12 00:13:00 + [sftp.c sftp.1] + support most of scp(1)'s commandline arguments in sftp(1), as a first + step towards making sftp(1) a drop-in replacement for scp(1). + One conflicting option (-P) has not been changed, pending further + discussion. + Patch from carlosvsilvapt@gmail.com as part of his work in the + Google Summer of Code + 20091002 - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. spotted by des AT des.no diff --git a/sftp.1 b/sftp.1 index 37ccb3a38..d7df8bbee 100644 --- a/sftp.1 +++ b/sftp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sftp.1,v 1.69 2008/12/09 15:35:00 sobrado Exp $ +.\" $OpenBSD: sftp.1,v 1.70 2009/08/12 00:13:00 djm Exp $ .\" .\" Copyright (c) 2001 Damien Miller. All rights reserved. .\" @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: December 9 2008 $ +.Dd $Mdocdate: August 12 2009 $ .Dt SFTP 1 .Os .Sh NAME @@ -31,10 +31,12 @@ .Sh SYNOPSIS .Nm sftp .Bk -words -.Op Fl 1Cv +.Op Fl 1246Cqv .Op Fl B Ar buffer_size .Op Fl b Ar batchfile +.Op Fl c Ar cipher .Op Fl F Ar ssh_config +.Op Fl i Ar identity_path .Op Fl o Ar ssh_option .Op Fl P Ar sftp_server_path .Op Fl R Ar num_requests @@ -87,6 +89,16 @@ The options are as follows: .Bl -tag -width Ds .It Fl 1 Specify the use of protocol version 1. +.It Fl 2 +Specify the use of protocol version 2. +.It Fl 4 +Forces +.Nm +to use IPv4 addresses only. +.It Fl 6 +Forces +.Nm +to use IPv6 addresses only. .It Fl B Ar buffer_size Specify the size of the buffer that .Nm @@ -120,6 +132,10 @@ prefixing the command with a .Sq \- character (for example, .Ic -rm /tmp/blah* ) . +.It Fl c Ar cipher +Selects the cipher to use for encrypting the data transfers. +This option is directly passed to +.Xr ssh 1 . .It Fl C Enables compression (via ssh's .Fl C @@ -130,6 +146,11 @@ per-user configuration file for .Xr ssh 1 . This option is directly passed to .Xr ssh 1 . +.It Fl i Ar identity_file +Selects the file from which the identity (private key) for public key +authentication is read. +This option is directly passed to +.Xr ssh 1 . .It Fl o Ar ssh_option Can be used to pass options to .Nm ssh @@ -199,6 +220,10 @@ Connect directly to a local sftp server (rather than via .Xr ssh 1 ) . This option may be useful in debugging the client and server. +.It Fl q +Quiet mode: disables the progress meter as well as warning and +diagnostic messages from +.Xr ssh 1 . .It Fl R Ar num_requests Specify how many requests may be outstanding at any one time. Increasing this may slightly improve file transfer speed diff --git a/sftp.c b/sftp.c index 66bd111b1..798a72edb 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.107 2009/02/02 11:15:14 dtucker Exp $ */ +/* $OpenBSD: sftp.c,v 1.108 2009/08/12 00:13:00 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1668,12 +1668,14 @@ usage(void) extern char *__progname; fprintf(stderr, - "usage: %s [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]\n" - " [-o ssh_option] [-P sftp_server_path] [-R num_requests]\n" - " [-S program] [-s subsystem | sftp_server] host\n" + "usage: %s [-1246Cqv] [-B buffer_size] [-b batchfile] [-c cipher]\n" + " [-F ssh_config] [-i identify_file] [-o ssh_option]\n" + " [-P sftp_server_path] [-R num_requests] [-S program]\n" + " [-s subsystem | sftp_server] host\n" " %s [user@]host[:file ...]\n" " %s [user@]host[:dir[/]]\n" - " %s -b batchfile [user@]host\n", __progname, __progname, __progname, __progname); + " %s -b batchfile [user@]host\n", + __progname, __progname, __progname, __progname); exit(1); } @@ -1705,10 +1707,24 @@ main(int argc, char **argv) ll = SYSLOG_LEVEL_INFO; infile = stdin; - while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:R:")) != -1) { + while ((ch = getopt(argc, argv, "1246hqvCc:i:o:s:S:b:B:F:P:R:")) != -1) { switch (ch) { + /* Passed through to ssh(1) */ + case '4': + case '6': case 'C': - addargs(&args, "-C"); + addargs(&args, "-%c", ch); + break; + /* Passed through to ssh(1) with argument */ + case 'F': + case 'c': + case 'i': + case 'o': + addargs(&args, "-%c%s", ch, optarg); + break; + case 'q': + showprogress = 0; + addargs(&args, "-%c", ch); break; case 'v': if (debug_level < 3) { @@ -1717,21 +1733,18 @@ main(int argc, char **argv) } debug_level++; break; - case 'F': - case 'o': - addargs(&args, "-%c%s", ch, optarg); - break; case '1': sshver = 1; if (sftp_server == NULL) sftp_server = _PATH_SFTP_SERVER; break; - case 's': - sftp_server = optarg; + case '2': + sshver = 2; break; - case 'S': - ssh_program = optarg; - replacearg(&args, 0, "%s", ssh_program); + case 'B': + copy_buffer_len = strtol(optarg, &cp, 10); + if (copy_buffer_len == 0 || *cp != '\0') + fatal("Invalid buffer size \"%s\"", optarg); break; case 'b': if (batchmode) @@ -1748,17 +1761,19 @@ main(int argc, char **argv) case 'P': sftp_direct = optarg; break; - case 'B': - copy_buffer_len = strtol(optarg, &cp, 10); - if (copy_buffer_len == 0 || *cp != '\0') - fatal("Invalid buffer size \"%s\"", optarg); - break; case 'R': num_requests = strtol(optarg, &cp, 10); if (num_requests == 0 || *cp != '\0') fatal("Invalid number of requests \"%s\"", optarg); break; + case 's': + sftp_server = optarg; + break; + case 'S': + ssh_program = optarg; + replacearg(&args, 0, "%s", ssh_program); + break; case 'h': default: usage(); -- cgit v1.2.3