diff options
author | Darren Tucker <dtucker@zip.com.au> | 2009-10-07 08:21:48 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2009-10-07 08:21:48 +1100 |
commit | 46bbbe3326d69a84d94caca656c40a4521c10c45 (patch) | |
tree | e8a2c85684c84bb8e453bbcee78d977bdd5ec07f | |
parent | 350666d30069c163c0dc1fa2503740b9d970ecc8 (diff) |
- 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
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | sftp.1 | 31 | ||||
-rw-r--r-- | sftp.c | 57 |
3 files changed, 75 insertions, 24 deletions
@@ -1,3 +1,14 @@ | |||
1 | 20091007 | ||
2 | - (dtucker) OpenBSD CVS Sync | ||
3 | - djm@cvs.openbsd.org 2009/08/12 00:13:00 | ||
4 | [sftp.c sftp.1] | ||
5 | support most of scp(1)'s commandline arguments in sftp(1), as a first | ||
6 | step towards making sftp(1) a drop-in replacement for scp(1). | ||
7 | One conflicting option (-P) has not been changed, pending further | ||
8 | discussion. | ||
9 | Patch from carlosvsilvapt@gmail.com as part of his work in the | ||
10 | Google Summer of Code | ||
11 | |||
1 | 20091002 | 12 | 20091002 |
2 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. | 13 | - (djm) [Makefile.in] Mention readconf.o in ssh-keysign's make deps. |
3 | spotted by des AT des.no | 14 | spotted by des AT des.no |
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: sftp.1,v 1.69 2008/12/09 15:35:00 sobrado Exp $ | 1 | .\" $OpenBSD: sftp.1,v 1.70 2009/08/12 00:13:00 djm Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2001 Damien Miller. All rights reserved. | 3 | .\" Copyright (c) 2001 Damien Miller. All rights reserved. |
4 | .\" | 4 | .\" |
@@ -22,7 +22,7 @@ | |||
22 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | .\" | 24 | .\" |
25 | .Dd $Mdocdate: December 9 2008 $ | 25 | .Dd $Mdocdate: August 12 2009 $ |
26 | .Dt SFTP 1 | 26 | .Dt SFTP 1 |
27 | .Os | 27 | .Os |
28 | .Sh NAME | 28 | .Sh NAME |
@@ -31,10 +31,12 @@ | |||
31 | .Sh SYNOPSIS | 31 | .Sh SYNOPSIS |
32 | .Nm sftp | 32 | .Nm sftp |
33 | .Bk -words | 33 | .Bk -words |
34 | .Op Fl 1Cv | 34 | .Op Fl 1246Cqv |
35 | .Op Fl B Ar buffer_size | 35 | .Op Fl B Ar buffer_size |
36 | .Op Fl b Ar batchfile | 36 | .Op Fl b Ar batchfile |
37 | .Op Fl c Ar cipher | ||
37 | .Op Fl F Ar ssh_config | 38 | .Op Fl F Ar ssh_config |
39 | .Op Fl i Ar identity_path | ||
38 | .Op Fl o Ar ssh_option | 40 | .Op Fl o Ar ssh_option |
39 | .Op Fl P Ar sftp_server_path | 41 | .Op Fl P Ar sftp_server_path |
40 | .Op Fl R Ar num_requests | 42 | .Op Fl R Ar num_requests |
@@ -87,6 +89,16 @@ The options are as follows: | |||
87 | .Bl -tag -width Ds | 89 | .Bl -tag -width Ds |
88 | .It Fl 1 | 90 | .It Fl 1 |
89 | Specify the use of protocol version 1. | 91 | Specify the use of protocol version 1. |
92 | .It Fl 2 | ||
93 | Specify the use of protocol version 2. | ||
94 | .It Fl 4 | ||
95 | Forces | ||
96 | .Nm | ||
97 | to use IPv4 addresses only. | ||
98 | .It Fl 6 | ||
99 | Forces | ||
100 | .Nm | ||
101 | to use IPv6 addresses only. | ||
90 | .It Fl B Ar buffer_size | 102 | .It Fl B Ar buffer_size |
91 | Specify the size of the buffer that | 103 | Specify the size of the buffer that |
92 | .Nm | 104 | .Nm |
@@ -120,6 +132,10 @@ prefixing the command with a | |||
120 | .Sq \- | 132 | .Sq \- |
121 | character (for example, | 133 | character (for example, |
122 | .Ic -rm /tmp/blah* ) . | 134 | .Ic -rm /tmp/blah* ) . |
135 | .It Fl c Ar cipher | ||
136 | Selects the cipher to use for encrypting the data transfers. | ||
137 | This option is directly passed to | ||
138 | .Xr ssh 1 . | ||
123 | .It Fl C | 139 | .It Fl C |
124 | Enables compression (via ssh's | 140 | Enables compression (via ssh's |
125 | .Fl C | 141 | .Fl C |
@@ -130,6 +146,11 @@ per-user configuration file for | |||
130 | .Xr ssh 1 . | 146 | .Xr ssh 1 . |
131 | This option is directly passed to | 147 | This option is directly passed to |
132 | .Xr ssh 1 . | 148 | .Xr ssh 1 . |
149 | .It Fl i Ar identity_file | ||
150 | Selects the file from which the identity (private key) for public key | ||
151 | authentication is read. | ||
152 | This option is directly passed to | ||
153 | .Xr ssh 1 . | ||
133 | .It Fl o Ar ssh_option | 154 | .It Fl o Ar ssh_option |
134 | Can be used to pass options to | 155 | Can be used to pass options to |
135 | .Nm ssh | 156 | .Nm ssh |
@@ -199,6 +220,10 @@ Connect directly to a local sftp server | |||
199 | (rather than via | 220 | (rather than via |
200 | .Xr ssh 1 ) . | 221 | .Xr ssh 1 ) . |
201 | This option may be useful in debugging the client and server. | 222 | This option may be useful in debugging the client and server. |
223 | .It Fl q | ||
224 | Quiet mode: disables the progress meter as well as warning and | ||
225 | diagnostic messages from | ||
226 | .Xr ssh 1 . | ||
202 | .It Fl R Ar num_requests | 227 | .It Fl R Ar num_requests |
203 | Specify how many requests may be outstanding at any one time. | 228 | Specify how many requests may be outstanding at any one time. |
204 | Increasing this may slightly improve file transfer speed | 229 | Increasing this may slightly improve file transfer speed |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.107 2009/02/02 11:15:14 dtucker Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.108 2009/08/12 00:13:00 djm 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 | * |
@@ -1668,12 +1668,14 @@ usage(void) | |||
1668 | extern char *__progname; | 1668 | extern char *__progname; |
1669 | 1669 | ||
1670 | fprintf(stderr, | 1670 | fprintf(stderr, |
1671 | "usage: %s [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]\n" | 1671 | "usage: %s [-1246Cqv] [-B buffer_size] [-b batchfile] [-c cipher]\n" |
1672 | " [-o ssh_option] [-P sftp_server_path] [-R num_requests]\n" | 1672 | " [-F ssh_config] [-i identify_file] [-o ssh_option]\n" |
1673 | " [-S program] [-s subsystem | sftp_server] host\n" | 1673 | " [-P sftp_server_path] [-R num_requests] [-S program]\n" |
1674 | " [-s subsystem | sftp_server] host\n" | ||
1674 | " %s [user@]host[:file ...]\n" | 1675 | " %s [user@]host[:file ...]\n" |
1675 | " %s [user@]host[:dir[/]]\n" | 1676 | " %s [user@]host[:dir[/]]\n" |
1676 | " %s -b batchfile [user@]host\n", __progname, __progname, __progname, __progname); | 1677 | " %s -b batchfile [user@]host\n", |
1678 | __progname, __progname, __progname, __progname); | ||
1677 | exit(1); | 1679 | exit(1); |
1678 | } | 1680 | } |
1679 | 1681 | ||
@@ -1705,10 +1707,24 @@ main(int argc, char **argv) | |||
1705 | ll = SYSLOG_LEVEL_INFO; | 1707 | ll = SYSLOG_LEVEL_INFO; |
1706 | infile = stdin; | 1708 | infile = stdin; |
1707 | 1709 | ||
1708 | while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:R:")) != -1) { | 1710 | while ((ch = getopt(argc, argv, "1246hqvCc:i:o:s:S:b:B:F:P:R:")) != -1) { |
1709 | switch (ch) { | 1711 | switch (ch) { |
1712 | /* Passed through to ssh(1) */ | ||
1713 | case '4': | ||
1714 | case '6': | ||
1710 | case 'C': | 1715 | case 'C': |
1711 | addargs(&args, "-C"); | 1716 | addargs(&args, "-%c", ch); |
1717 | break; | ||
1718 | /* Passed through to ssh(1) with argument */ | ||
1719 | case 'F': | ||
1720 | case 'c': | ||
1721 | case 'i': | ||
1722 | case 'o': | ||
1723 | addargs(&args, "-%c%s", ch, optarg); | ||
1724 | break; | ||
1725 | case 'q': | ||
1726 | showprogress = 0; | ||
1727 | addargs(&args, "-%c", ch); | ||
1712 | break; | 1728 | break; |
1713 | case 'v': | 1729 | case 'v': |
1714 | if (debug_level < 3) { | 1730 | if (debug_level < 3) { |
@@ -1717,21 +1733,18 @@ main(int argc, char **argv) | |||
1717 | } | 1733 | } |
1718 | debug_level++; | 1734 | debug_level++; |
1719 | break; | 1735 | break; |
1720 | case 'F': | ||
1721 | case 'o': | ||
1722 | addargs(&args, "-%c%s", ch, optarg); | ||
1723 | break; | ||
1724 | case '1': | 1736 | case '1': |
1725 | sshver = 1; | 1737 | sshver = 1; |
1726 | if (sftp_server == NULL) | 1738 | if (sftp_server == NULL) |
1727 | sftp_server = _PATH_SFTP_SERVER; | 1739 | sftp_server = _PATH_SFTP_SERVER; |
1728 | break; | 1740 | break; |
1729 | case 's': | 1741 | case '2': |
1730 | sftp_server = optarg; | 1742 | sshver = 2; |
1731 | break; | 1743 | break; |
1732 | case 'S': | 1744 | case 'B': |
1733 | ssh_program = optarg; | 1745 | copy_buffer_len = strtol(optarg, &cp, 10); |
1734 | replacearg(&args, 0, "%s", ssh_program); | 1746 | if (copy_buffer_len == 0 || *cp != '\0') |
1747 | fatal("Invalid buffer size \"%s\"", optarg); | ||
1735 | break; | 1748 | break; |
1736 | case 'b': | 1749 | case 'b': |
1737 | if (batchmode) | 1750 | if (batchmode) |
@@ -1748,17 +1761,19 @@ main(int argc, char **argv) | |||
1748 | case 'P': | 1761 | case 'P': |
1749 | sftp_direct = optarg; | 1762 | sftp_direct = optarg; |
1750 | break; | 1763 | break; |
1751 | case 'B': | ||
1752 | copy_buffer_len = strtol(optarg, &cp, 10); | ||
1753 | if (copy_buffer_len == 0 || *cp != '\0') | ||
1754 | fatal("Invalid buffer size \"%s\"", optarg); | ||
1755 | break; | ||
1756 | case 'R': | 1764 | case 'R': |
1757 | num_requests = strtol(optarg, &cp, 10); | 1765 | num_requests = strtol(optarg, &cp, 10); |
1758 | if (num_requests == 0 || *cp != '\0') | 1766 | if (num_requests == 0 || *cp != '\0') |
1759 | fatal("Invalid number of requests \"%s\"", | 1767 | fatal("Invalid number of requests \"%s\"", |
1760 | optarg); | 1768 | optarg); |
1761 | break; | 1769 | break; |
1770 | case 's': | ||
1771 | sftp_server = optarg; | ||
1772 | break; | ||
1773 | case 'S': | ||
1774 | ssh_program = optarg; | ||
1775 | replacearg(&args, 0, "%s", ssh_program); | ||
1776 | break; | ||
1762 | case 'h': | 1777 | case 'h': |
1763 | default: | 1778 | default: |
1764 | usage(); | 1779 | usage(); |