Commit Graph

143 Commits

Author SHA1 Message Date
Darren Tucker af1f909254 - djm@cvs.openbsd.org 2010/12/04 00:18:01
[sftp-server.c sftp.1 sftp-client.h sftp.c PROTOCOL sftp-client.c]
     add a protocol extension to support a hard link operation. It is
     available through the "ln" command in the client. The old "ln"
     behaviour of creating a symlink is available using its "-s" option
     or through the preexisting "symlink" command; based on a patch from
     miklos AT szeredi.hu in bz#1555; ok markus@
2010-12-05 09:02:47 +11:00
Darren Tucker d78739ab90 - sthen@cvs.openbsd.org 2010/10/23 22:06:12
[sftp.c]
     escape '[' in filename tab-completion; fix a type while there.
     ok djm@
2010-10-24 10:56:32 +11:00
Damien Miller 38d9a965bf - djm@cvs.openbsd.org 2010/10/05 05:13:18
[sftp.c sshconnect.c]
     use default shell /bin/sh if $SHELL is ""; ok markus@
2010-10-07 22:07:11 +11:00
Damien Miller 68e2e56ea9 - djm@cvs.openbsd.org 2010/09/26 22:26:33
[sftp.c]
     when performing an "ls" in columnated (short) mode, only call
     ioctl(TIOCGWINSZ) once to get the window width instead of per-
     filename
2010-10-07 21:39:55 +11:00
Damien Miller a6e121aaa0 - djm@cvs.openbsd.org 2010/09/25 09:30:16
[sftp.c configure.ac openbsd-compat/glob.c openbsd-compat/glob.h]
     make use of new glob(3) GLOB_KEEPSTAT extension to save extra server
     rountrips to fetch per-file stat(2) information.
     NB. update openbsd-compat/ glob(3) implementation from OpenBSD libc to
     match.
2010-10-07 21:39:17 +11:00
Damien Miller 56883e194f - jmc@cvs.openbsd.org 2010/09/23 13:34:43
[sftp.c]
     add [-l limit] to usage();
2010-09-24 22:15:39 +10:00
Damien Miller 65e42f87fe - djm@cvs.openbsd.org 2010/09/22 22:58:51
[atomicio.c atomicio.h misc.c misc.h scp.c sftp-client.c]
     [sftp-client.h sftp.1 sftp.c]
     add an option per-read/write callback to atomicio

     factor out bandwidth limiting code from scp(1) into a generic bandwidth
     limiter that can be attached using the atomicio callback mechanism

     add a bandwidth limit option to sftp(1) using the above
     "very nice" markus@
2010-09-24 22:15:11 +10:00
Damien Miller 99ac4e9546 - djm@cvs.openbsd.org 2010/06/18 00:58:39
[sftp.c]
     unbreak ls in working directories that contains globbing characters in
     their pathnames. bz#1655 reported by vgiffin AT apple.com
2010-06-26 09:36:58 +10:00
Damien Miller 099fc1634e - dtucker@cvs.openbsd.org 2010/05/05 04:22:09
[sftp.c]
     restore mput and mget which got lost in the tab-completion changes.
     found by Kenneth Whitaker, ok djm@
2010-05-10 11:56:50 +10:00
Damien Miller a1162985a5 - djm@cvs.openbsd.org 2010/01/27 19:21:39
[sftp.c]
     add missing "p" flag to getopt optstring;
     bz#1704 from imorgan AT nas.nasa.gov
2010-01-28 06:27:54 +11:00
Darren Tucker b8b17e984a - guenther@cvs.openbsd.org 2010/01/15 00:05:22
[sftp.c]
     Reset SIGTERM to SIG_DFL before executing ssh, so that even if sftp
     inherited SIGTERM as ignored it will still be able to kill the ssh it
     starts.
     ok dtucker@
2010-01-15 11:46:03 +11:00
Darren Tucker 75fe626489 - jmc@cvs.openbsd.org 2010/01/13 12:48:34
[sftp.1 sftp.c]
     sftp.1: put ls -h in the right place
     sftp.c: as above, plus add -p to get/put, and shorten their arg names
     to keep the help usage nicely aligned
     ok djm
2010-01-15 11:42:51 +11:00
Darren Tucker 9c3ba07f60 - djm@cvs.openbsd.org 2010/01/13 04:10:50
[sftp.c]
     don't append a space after inserting a completion of a directory (i.e.
     a path ending in '/') for a slightly better user experience; ok dtucker@
2010-01-13 22:45:03 +11:00
Darren Tucker 2901e2daeb - djm@cvs.openbsd.org 2010/01/13 01:40:16
[sftp.c sftp-server.c sftp.1 sftp-common.c sftp-common.h]
     support '-h' (human-readable units) for sftp's ls command, just like
     ls(1); ok dtucker@
2010-01-13 22:44:06 +11:00
Darren Tucker 70cc092817 - dtucker@cvs.openbsd.org 2010/01/09 11:13:02
[sftp.c]
     Prevent sftp from derefing a null pointer when given a "-" without a
     command.  Also, allow whitespace to follow a "-".  bz#1691, path from
     Colin Watson via Debian.  ok djm@ deraadt@
2010-01-09 22:28:03 +11:00
Darren Tucker 340d1688e6 - dtucker@cvs.openbsd.org 2010/01/08 21:50:49
[sftp.c]
     Fix two warnings: possibly used unitialized and use a nul byte instead of
     NULL pointer.  ok djm@
2010-01-09 08:54:31 +11:00
Darren Tucker 843f0fa16d - (dtucker) [sftp.c] Expand ifdef for libedit to cover complete_is_remote
too.
2010-01-08 19:56:33 +11:00
Darren Tucker e67f7db968 - (dtucker) [sftp.c] ifdef out the sftp completion bits for platforms that
don't have libedit.
2010-01-08 19:50:02 +11:00
Darren Tucker 909d858d6b - djm@cvs.openbsd.org 2010/01/04 02:03:57
[sftp.c]
     Implement tab-completion of commands, local and remote filenames for sftp.
     Hacked on and off for some time by myself, mouring, Carlos Silva (via 2009
     Google Summer of Code) and polished to a fine sheen by myself again.
     It should deal more-or-less correctly with the ikky corner-cases presented
     by quoted filenames, but the UI could still be slightly improved.
     In particular, it is quite slow for remote completion on large directories.
     bz#200; ok markus@
2010-01-08 19:02:40 +11:00
Darren Tucker b8c884a0ba - guenther@cvs.openbsd.org 2009/12/20 07:28:36
[ssh.c sftp.c scp.c]
     When passing user-controlled options with arguments to other programs,
     pass the option and option argument as separate argv entries and
     not smashed into one (e.g., as -l foo and not -lfoo).  Also, always
     pass a "--" argument to stop option parsing, so that a positional
     argument that starts with a '-' isn't treated as an option.  This
     fixes some error cases as well as the handling of hostnames and
     filenames that start with a '-'.
     Based on a diff by halex@
     ok halex@ djm@ deraadt@
2010-01-08 18:53:43 +11:00
Darren Tucker b5082e90a1 - dtucker@cvs.openbsd.org 2009/12/06 23:53:54
[sftp.c]
     fix potential divide-by-zero in sftp's "df" output when talking to a server
     that reports zero files on the filesystem (Unix filesystems always have at
     least the root inode).  From Steve McClellan at radisys, ok djm@
2010-01-08 18:51:47 +11:00
Darren Tucker c4dc4f5bac - halex@cvs.openbsd.org 2009/11/22 13:18:00
[sftp.c]
     make passing of zero-length arguments to ssh safe by
     passing "-<switch>" "<value>" rather than "-<switch><value>"
     ok dtucker@, guenther@, djm@
2010-01-08 18:50:04 +11:00
Darren Tucker 210631922f - djm@cvs.openbsd.org 2009/11/20 00:54:01
[sftp.c]
     bz#1588 change "Connecting to host..." message to "Connected to host."
     and delay it until after the sftp protocol connection has been established.
     Avoids confusing sequence of messages when the underlying ssh connection
     experiences problems. ok dtucker@
2010-01-08 17:10:36 +11:00
Darren Tucker 1b0dd17537 - djm@cvs.openbsd.org 2009/08/18 18:36:21
[sftp-client.h sftp.1 sftp-client.c sftp.c]
     recursive transfer support for get/put and on the commandline
     work mostly by carlosvsilvapt@gmail.com for the Google Summer of Code
     with some tweaks by me; "go for it" deraadt@
2009-10-07 08:37:48 +11:00
Darren Tucker c07138e6f6 - jmc@cvs.openbsd.org 2009/08/13 13:39:54
[sftp.1 sftp.c]
     sync synopsis and usage();
2009-10-07 08:23:44 +11:00
Darren Tucker 282b4026cb - djm@cvs.openbsd.org 2009/08/13 01:11:19
[sftp.1 sftp.c]
     Swizzle options: "-P sftp_server_path" moves to "-D sftp_server_path",
     add "-P port" to match scp(1). Fortunately, the -P option is only really
     used by our regression scripts.
     part of larger patch from carlosvsilvapt@gmail.com for his Google Summer
     of Code work; ok deraadt markus
2009-10-07 08:23:06 +11:00
Darren Tucker 46bbbe3326 - 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
2009-10-07 08:21:48 +11:00
Damien Miller fdd66fc750 - dtucker@cvs.openbsd.org 2009/02/02 11:15:14
[sftp.c]
     Initialize a few variables to prevent spurious "may be used
     uninitialized" warnings from newer gcc's.  ok djm@
2009-02-14 16:26:19 +11:00
Damien Miller 62fd18a2b7 - sobrado@cvs.openbsd.org 2008/12/09 15:35:00
[sftp.1 sftp.c]
     update for the synopses displayed by the 'help' command, there are a
     few missing flags; add 'bye' to the output of 'help'; sorting and spacing.
     jmc@ suggested replacing .Oo/.Oc with a single .Op macro.
     ok jmc@
2009-01-28 16:14:09 +11:00
Damien Miller 7ebfad789f - djm@cvs.openbsd.org 2008/12/09 03:02:37
[sftp.1 sftp.c]
     correct sftp(1) and corresponding usage syntax;
     bz#1518 patch from imorgan AT nas.nasa.gov; ok deraadt@ improved diff jmc@
2008-12-09 14:12:33 +11:00
Damien Miller 1be2cc4496 - djm@cvs.openbsd.org 2008/12/09 02:39:59
[sftp.c]
     Deal correctly with failures in remote stat() operation in sftp,
     correcting fail-on-error behaviour in batchmode. bz#1541 report and
     fix from anedvedicky AT gmail.com; ok markus@
2008-12-09 14:11:49 +11:00
Damien Miller 7f980d1ac7 - djm@cvs.openbsd.org 2008/07/13 22:16:03
[sftp.c]
     increase number of piplelined requests so they properly fill the
     (recently increased) channel window. prompted by rapier AT psc.edu;
     ok markus@
2008-07-14 11:29:24 +10:00
Damien Miller f184bcf89e - (djm) OpenBSD CVS Sync
- martynas@cvs.openbsd.org 2008/06/21 07:46:46
     [sftp.c]
     use optopt to get invalid flag, instead of return value of getopt,
     which is always '?';  ok djm@
2008-06-29 22:45:13 +10:00
Darren Tucker 7b598892be - dtucker@cvs.openbsd.org 2008/06/08 20:15:29
[sftp.c sftp-client.c sftp-client.h]
     Have the sftp client store the statvfs replies in wire format,
     which prevents problems when the server's native sizes exceed the
     client's.
     Also extends the sizes of the remaining 32bit wire format to 64bit,
     they're specified as unsigned long in the standard.
2008-06-09 22:49:36 +10:00
Darren Tucker 598eaa6c0c - (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c
openbsd-compat/Makefile.in openbsd-compat/openbsd-compat.h
   openbsd-compat/bsd-statvfs.{c,h}] Add a null implementation of statvfs and
   fstatvfs and remove #defines around statvfs code.  ok djm@
2008-06-09 03:32:29 +10:00
Darren Tucker 5b2e2ba9e4 - (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c] Do not enable statvfs extensions on platforms that do not have statvfs. ok djm@ 2008-06-08 09:25:28 +10:00
Damien Miller a7058ec7c0 - (djm) [configure.ac mux.c sftp.c openbsd-compat/Makefile.in]
[openbsd-compat/fmt_scaled.c openbsd-compat/openbsd-compat.h]
   Fix compilation on Linux, including pulling in fmt_scaled(3)
   implementation from OpenBSD's libutil.
2008-05-20 08:57:06 +10:00
Damien Miller d671e5a978 - djm@cvs.openbsd.org 2008/04/18 12:32:11
[sftp-client.c sftp-client.h sftp-server.c sftp.1 sftp.c sftp.h]
     introduce sftp extension methods statvfs@openssh.com and
     fstatvfs@openssh.com that implement statvfs(2)-like operations,
     based on a patch from miklos AT szeredi.hu (bz#1399)
     also add a "df" command to the sftp client that uses the
     statvfs@openssh.com to produce a df(1)-like display of filesystem
     space and inode utilisation
     ok markus@
2008-05-19 14:53:33 +10:00
Damien Miller aec5cf8a30 - djm@cvs.openbsd.org 2008/01/20 00:38:30
[sftp.c]
     When uploading, correctly handle the case of an unquoted filename with
     glob metacharacters that match a file exactly but not as a glob, e.g. a
     file called "[abcd]". report and test cases from duncan2nd AT gmx.de
2008-02-10 22:26:24 +11:00
Darren Tucker 88b976f214 - djm@cvs.openbsd.org 2007/12/12 05:04:03
[sftp.c]
     unbreak lls command and add a regress test that would have caught the
     breakage; spotted by mouring@
2007-12-29 02:40:43 +11:00
Damien Miller 1cbc292bc0 - djm@cvs.openbsd.org 2007/10/24 03:30:02
[sftp.c]
     rework argument splitting and parsing to cope correctly with common
     shell escapes and make handling of escaped characters consistent
     with sh(1) and between sftp commands (especially between ones that
     glob their arguments and ones that don't).
     parse command flags using getopt(3) rather than hand-rolled parsers.
     ok dtucker@
2007-10-26 14:27:45 +10:00
Damien Miller b6c85fcf37 - stevesk@cvs.openbsd.org 2007/01/03 04:09:15
[sftp.c]
     ARGSUSED for lint
2007-01-05 16:30:41 +11:00
Damien Miller 80163907ed - stevesk@cvs.openbsd.org 2007/01/03 03:01:40
[auth2-chall.c channels.c dns.c sftp.c ssh-keygen.c ssh.c]
     spaces
2007-01-05 16:30:16 +11:00
Damien Miller 3ca8b77179 - ray@cvs.openbsd.org 2006/11/23 01:35:11
[misc.c sftp.c]
     Don't access buf[strlen(buf) - 1] for zero-length strings.
     ``ok by me'' djm@.
2007-01-05 16:24:47 +11:00
Damien Miller e7658a50f0 - (djm) OpenBSD CVS Sync
- ray@cvs.openbsd.org 2006/09/30 17:48:22
     [sftp.c]
     Clear errno before calling the strtol functions.
     From Paul Stoeber <x0001 at x dot de1 dot cc>.
     OK deraadt@.
2006-10-24 03:00:12 +10:00
Darren Tucker 1e80e4023b - otto@cvs.openbsd.org 2006/09/19 05:52:23
[sftp.c]
     Use S_IS* macros insted of masking with S_IF* flags. The latter may
     have multiple bits set, which lead to surprising results. Spotted by
     Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@
2006-09-21 12:59:33 +10:00
Damien Miller d783435315 - deraadt@cvs.openbsd.org 2006/08/03 03:34:42
[OVERVIEW atomicio.c atomicio.h auth-bsdauth.c auth-chall.c auth-krb5.c]
     [auth-options.c auth-options.h auth-passwd.c auth-rh-rsa.c auth-rhosts.c]
     [auth-rsa.c auth-skey.c auth.c auth.h auth1.c auth2-chall.c auth2-gss.c]
     [auth2-hostbased.c auth2-kbdint.c auth2-none.c auth2-passwd.c ]
     [auth2-pubkey.c auth2.c authfd.c authfd.h authfile.c bufaux.c bufbn.c]
     [buffer.c buffer.h canohost.c channels.c channels.h cipher-3des1.c]
     [cipher-bf1.c cipher-ctr.c cipher.c cleanup.c clientloop.c compat.c]
     [compress.c deattack.c dh.c dispatch.c dns.c dns.h fatal.c groupaccess.c]
     [groupaccess.h gss-genr.c gss-serv-krb5.c gss-serv.c hostfile.c kex.c]
     [kex.h kexdh.c kexdhc.c kexdhs.c kexgex.c kexgexc.c kexgexs.c key.c]
     [key.h log.c log.h mac.c match.c md-sha256.c misc.c misc.h moduli.c]
     [monitor.c monitor_fdpass.c monitor_mm.c monitor_mm.h monitor_wrap.c]
     [monitor_wrap.h msg.c nchan.c packet.c progressmeter.c readconf.c]
     [readconf.h readpass.c rsa.c scard.c scard.h scp.c servconf.c servconf.h]
     [serverloop.c session.c session.h sftp-client.c sftp-common.c]
     [sftp-common.h sftp-glob.c sftp-server.c sftp.c ssh-add.c ssh-agent.c]
     [ssh-dss.c ssh-gss.h ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh-rsa.c]
     [ssh.c ssh.h sshconnect.c sshconnect.h sshconnect1.c sshconnect2.c]
     [sshd.c sshlogin.c sshlogin.h sshpty.c sshpty.h sshtty.c ttymodes.c]
     [uidswap.c uidswap.h uuencode.c uuencode.h xmalloc.c xmalloc.h]
     [loginrec.c loginrec.h openbsd-compat/port-aix.c openbsd-compat/port-tun.h]
     almost entirely get rid of the culture of ".h files that include .h files"
     ok djm, sort of ok stevesk
     makes the pain stop in one easy step
     NB. portable commit contains everything *except* removing includes.h, as
     that will take a fair bit more work as we move headers that are required
     for portability workarounds to defines.h. (also, this step wasn't "easy")
2006-08-05 12:39:39 +10:00
Damien Miller a7a73ee35d - stevesk@cvs.openbsd.org 2006/08/01 23:22:48
[auth-passwd.c auth-rhosts.c auth-rsa.c auth.c auth.h auth1.c]
     [auth2-chall.c auth2-pubkey.c authfile.c buffer.c canohost.c]
     [channels.c clientloop.c dh.c dns.c dns.h hostfile.c kex.c kexdhc.c]
     [kexgexc.c kexgexs.c key.c key.h log.c misc.c misc.h moduli.c]
     [monitor_wrap.c packet.c progressmeter.c readconf.c readpass.c scp.c]
     [servconf.c session.c sftp-client.c sftp-common.c sftp-server.c sftp.c]
     [ssh-add.c ssh-agent.c ssh-keygen.c ssh-keyscan.c ssh.c sshconnect.c]
     [sshconnect1.c sshconnect2.c sshd.c sshlogin.c sshtty.c uuencode.c]
     [uuencode.h xmalloc.c]
     move #include <stdio.h> out of includes.h
2006-08-05 11:37:59 +10:00
Damien Miller e7a1e5cf63 - stevesk@cvs.openbsd.org 2006/07/26 13:57:17
[authfd.c authfile.c dh.c canohost.c channels.c clientloop.c compat.c]
     [hostfile.c kex.c log.c misc.c moduli.c monitor.c packet.c readpass.c]
     [scp.c servconf.c session.c sftp-server.c sftp.c ssh-add.c ssh-agent.c]
     [ssh-keygen.c ssh-keyscan.c ssh-keysign.c ssh.c sshconnect.c]
     [sshconnect1.c sshd.c xmalloc.c]
     move #include <stdlib.h> out of includes.h
2006-08-05 11:34:19 +10:00
Damien Miller 8dbffe7904 - stevesk@cvs.openbsd.org 2006/07/26 02:35:17
[atomicio.c auth.c dh.c authfile.c buffer.c clientloop.c kex.c]
     [groupaccess.c gss-genr.c kexgexs.c misc.c monitor.c monitor_mm.c]
     [packet.c scp.c serverloop.c session.c sftp-client.c sftp-common.c]
     [sftp-server.c sftp.c ssh-add.c ssh-agent.c ssh-keygen.c sshlogin.c]
     [uidswap.c xmalloc.c]
     move #include <sys/param.h> out of includes.h
2006-08-05 11:02:17 +10:00