Commit Graph

52 Commits

Author SHA1 Message Date
John Eikenberry b9345f483d
Merge pull request #248 from perkeep/packetwrite
Write packet length header & payload together on the wire.
2018-08-24 15:50:03 -07:00
John Eikenberry 1afc1d9a78 refactor server response to allow for extending
Instead of sendPacket/sendError being sprayed all over the place, this
change has all those places instead return a responsePacket (eventually)
back to the main handling function which then calls sendPacket in one
place.

Behaviour of the code should remain exactly the same.

This makes it much easier to work with the response packets (eg. for the
packet ordering issue I'm working on).
2018-07-25 15:01:43 -07:00
John Eikenberry b50b1f9eaf fix sendError usage to match packet type signature
sendError takes a requestPacket but was simplifying it to an ider
interface. Future work needed it to be requestPacket but I wanted to fix
didn't up type usage in its own commit.
2018-07-23 16:53:51 -07:00
Brad Fitzpatrick fbf066c9de Write packet length header & payload together on the wire. 2018-05-11 21:44:57 -07:00
Allan Feid 820ccceeef Send unsupported error on extended packets.
Following the rules outlined here:

https://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00

Return an SSH_FXP_STATUS with appropriate status error for extended
packets that we do not support.
2018-03-19 10:32:22 -04:00
John Eikenberry 9649a986f0 remove unused variables 2018-02-15 11:00:22 -08:00
Iain Wade 9b6cdb8fab Add PosixRename method which uses the posix-rename@openssh.com extension
to support actual rename() operations rather than the link() call
effectively mandated by the sftp v3/draft-2 requirement that targets
not be overwritten.
2017-09-05 04:46:03 -07:00
unclejack 94df0a367c client,packet: remove redundant select & return
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-02-25 12:56:13 -08:00
Dave Cheney 9d52a809ce Always close client conn when clientConn.recv exits (#117)
If recv has exited then nobody will retrive the response, so
make sure we cannot send anything by shutting down the Write side of the
connection.
2016-06-15 20:04:26 +10:00
Dave Cheney 04d5f67e72 Small cleanups 2016-06-14 18:05:33 +10:00
Mark Sheahan 9ff4de5c31 add serverside StatVFS function, implemented for darwin and linux (#89) 2016-06-13 14:45:13 +10:00
Dave Cheney 8bf4044e7f remove svr.in svr.out, replace with svr.rwc (#107) 2016-05-29 18:22:40 +10:00
Dave Cheney 5e9ad277fc Use pkg/errors for error handling (#101) 2016-05-19 15:16:48 +10:00
Mark Sheahan 7e2e721fdf use ssh_FXP_STAT for Stat(); previously Stat() and Lstat() were both Lstat() 2016-04-26 12:07:21 -07:00
Matt Layher 051287be6d *: remove all named and naked returns 2016-01-07 15:56:04 -05:00
Matt Layher 9374ae613d *: golint: add and fix up comments on exported types 2016-01-07 15:16:34 -05:00
Matt Layher b348482b1a *: golint (part 1) 2016-01-07 12:10:24 -05:00
Matthew Sykes f5afc8315a Add Getwd to client 2015-12-22 09:04:46 -05:00
Mark Sheahan bce43f23ac Address review comments; alter server test to allow the user / group words to be different 2015-09-07 22:50:46 -07:00
Mark Sheahan cbd08aeb80 implement setstat & fsetstat 2015-09-07 02:13:07 -07:00
Mark Sheahan d80ae36051 rmdir and symlink packet handling 2015-09-07 01:05:16 -07:00
Mark Sheahan 7bb2083ca9 Address review comments; about to change decodePacket() 2015-09-06 23:55:15 -07:00
Mark Sheahan 0d8e136458 removing sftp server to client layer; using straight os.* calls 2015-09-06 19:36:47 -07:00
Mark Sheahan 4325c3654b fix format of 'name' packets (shortname, longname, attrs), add Stat 2015-08-05 12:57:28 -07:00
Mark Sheahan 2f3ef8b897 Merge branch 'master' into server 2015-08-04 21:11:01 -07:00
Mark Sheahan 0f2bc1aa17 server is passing the client integration tests now. I don't understand the ATTRs field, it has a name in it. 2015-07-31 23:09:51 -07:00
Mark Sheahan 435f753792 readdir, rename, remove 2015-07-31 15:46:13 -07:00
Mark Sheahan bf6b5bce28 fstat 2015-07-30 09:21:59 -07:00
Mark Sheahan c9cee8ac6f implement write 2015-07-29 17:37:58 -07:00
Mark Sheahan 2888b4a6b1 implement read 2015-07-29 17:24:24 -07:00
Mark Sheahan 058e1bee58 open & close 2015-07-26 01:32:19 -07:00
Mark Sheahan 91d0c9e68a mkdir 2015-07-25 19:07:33 -07:00
Mark Sheahan 5b6348f034 version, lstat 2015-07-25 01:19:29 -07:00
Dave Cheney c020667ac1 Make c.sendRequest concurrent
This is an attempt to permit overlapping requests.

For each request sent, we spin off a goroutine to send the request for us
then handle _a_ response. That goroutine will try to dispatch the request
to the original sender. As every request is initiated from the client, there
will always be a matching number of replies from the server so eventally
every worker goroutine will process a request and exit.
2015-05-23 22:51:29 +10:00
Dave Cheney 50631306d7 Push c.mu.Lock/Unlock down to sendRequest
Also includes gofmt cleanups
2015-05-23 17:10:22 +10:00
Maximilian Pachl 0b805e96f9 added statvfs@openssh.com extension request 2015-05-15 20:37:52 +02:00
Alexander Neumann 29ed2c7341 Run gofmt 2014-10-09 21:01:38 +02:00
Dave Cheney cbcfa1f2b9 removed unused field on fxpMkdir
Fixes #14 compatability issues with older sftp servers.
2014-09-28 13:02:29 +10:00
Dave Cheney ea8e50a388 Remove unused field in fxpOpenPacket
Update #14
2014-09-28 13:01:15 +10:00
Dave Cheney 5f305f8c6b Fix missing Id field in fxpRename
Fixes #20
2014-09-28 12:41:49 +10:00
Dave Cheney 11195960a5 Fix type that transposed capacity into length,
Updates #19
2014-09-28 12:39:40 +10:00
Matthieu Rakotojaona 6c93917172 Manually marshal readlink packet 2014-09-28 03:57:44 +02:00
Matthieu Rakotojaona c01839afa0 Manually marshal packets for more speed 2014-09-27 14:29:57 +02:00
Claudio Felber 119022645a Fixed an error in marshalUint64() that resulted in incorrect marshalling of values >= 2^24 2013-12-11 00:14:59 +01:00
Dave Cheney 69fafb0562 Fixed attr walking, readdir now works! 2013-11-05 22:11:34 +11:00
Dave Cheney aa9d9e3605 readdir isnt reading dirs properly 2013-11-05 17:33:47 +11:00
Dave Cheney 6ce8872642 Added recvPacket 2013-11-05 14:36:38 +11:00
Dave Cheney 9187a3b3b2 adedd string unmarshal 2013-11-05 12:31:20 +11:00
Dave Cheney 30b997f450 added unmarhshal for uint32/64 yptes 2013-11-05 12:23:48 +11:00
Dave Cheney 049a0ff391 implement rudamentary reflect based marshalling 2013-11-05 12:03:58 +11:00