Commit Graph

38 Commits

Author SHA1 Message Date
Cassondra Foesch d1903fbd46 rework client to prevent after-close usage, and support perm at open 2024-01-19 00:20:23 +00:00
Cassondra Foesch a61b35f5a3 remove racing stdout 2022-01-31 21:25:18 +00:00
Cassondra Foesch bb06e29d17 get integration tests passing on WSL for GOOS=windows 2022-01-31 21:12:49 +00:00
Nicola Murino f8d38c99d3 server integration test: add Windows sftp server path 2021-04-24 10:27:59 +02:00
Cassondra Foesch f1e28f8a88 Improve benchmarks and errors 2021-03-17 11:03:51 +00:00
Fazlul Shahriar 6120cae121
Fix build on Plan 9
All test are passing on Plan 9, and I've also verified
`examples/go-sftp-server` is working.
2020-09-10 18:18:22 -04:00
Nicola Murino 1f178f9671 the allocator can now be enabled per request
Other minor changes as per review comments
2020-03-18 09:36:07 +01:00
Nicola Murino 3f969fcd59 add optional AllocationModeOptimized
after processing a packet we keep in memory the allocated slices and we reuse
them for new packets.
Slices are allocated in:

- recvPacket
- when we receive a sshFxpReadPacket (downloads)

The allocated slices have a fixed size = maxMsgLength.

Allocated slices are referenced to the request order id and are marked for reuse
after a request is served in maybeSendPackets.

The allocator is added to the packetManager struct and it is cleaned at the end
of the Serve() function.

This allocation mode is optional and disabled by default
2020-03-14 19:42:19 +01:00
Nicola Murino 07905cb843 server integration test: add /usr/lib/ssh/sftp-server to search paths
os some distro, for example ArchLinux, the sftp-server CLI is in this
path
2020-02-14 17:27:18 +01:00
John Eikenberry 3c6b3a4ff1 add test to exercise file upload resume
Simulates resuming a file upload where more data is appended to the same
file (eg. network error, uploading log files, etc). Currently broken in
the server as it uses O_APPEND + WriteAt() which don't work together.
2020-01-03 12:44:31 -08:00
Nicola Murino b4ea0fd6f6 fix lint issues
These lint issues remain:

- request-errors.go, aliases for new error types
- request-attrs.go, UidGid. Changing this will break compatibility
2019-08-30 17:04:37 +02:00
Tommie Gannert 2c24eaad1c Implement the hardlink@openssh.com extension.
Both client and server. This is documented in

  https://github.com/openssh/openssh-portable/blob/master/PROTOCOL

Draft 7 of SFTP added support for SSH_FXP_LINK which supports both
symlinks and hardlinks, but unfortunately OpenSSH doesn't support
that:

  https://tools.ietf.org/html/draft-ietf-secsh-filexfer-07#section-7.7

Adding support for this as an option would be a nice extension to
this.
2019-08-25 20:16:37 -07:00
Tommie Gannert 2b53636545 Allow -sftp to work in server_integration_test. 2019-06-12 09:20:07 +02:00
Daniel Theophanes d8ec5de5ee sftp: update tests to finish and not panic on windows
Many Unix assuptions have been made when testing.
Previously running tests on windows threw a panic
part way through the tests. After these changes
many more tests pass when the fix was isolated
to the test itself, and none panic.

Some tests are skipped because they do make sense
on windows (chmod, chown), while others are skipped
just to how the test was implemented.

Lastly, some of the external executables were hard coded.
Change these to look paths in TestMain first. This is done
to better support windows, where openssh may be installed and
sftp and sftp-server may both be in the PATH.
2019-01-18 16:29:07 -08:00
John Eikenberry 161bbaf9a8 a few code simplifications
ran gosimple over the code and made suggested adjustments
2018-02-15 11:17:19 -08:00
John Eikenberry f128182572 skip timestamp field in server comparison test
Timestamps on some directories can vary during the test (eg. /tmp).
2018-01-17 11:43:54 -08:00
John Eikenberry 98203f5a83 remove ssh-agent requirement for integration tests
Thanks @tv42 for this code. I took it from his PR; #92.
2017-08-23 14:46:20 -07:00
John Eikenberry 13ec2164f5 mispelling in test output 2017-08-23 14:20:45 -07:00
Dave Cheney f3fc26f1c3 General server cleanups (#103)
- no need to initalise mutexes, their zero value is valid
- make NewServer simpler, 90% of use cases already had an
  io.ReadWriteCloser, in the single case that it it is easy to provide a
  simple wrapper.
2016-05-29 16:32:05 +10:00
Matt Layher 8e47c759f5 server: remote rootDir parameter, as it does nothing 2016-01-16 12:41:01 -05:00
Matt Layher 403657b31e server: use functional options for NewServer 2016-01-11 11:52:51 -05:00
Matt Layher b348482b1a *: golint (part 1) 2016-01-07 12:10:24 -05:00
Dave Cheney fe1bd71a2f s/wercker/travis 2015-12-25 18:24:07 +01:00
Mark Sheahan e4daa2d013 added server integration test for recursive put and recursive get 2015-09-08 17:54:28 -07:00
Mark Sheahan d7309968cd add more tests; bug setting S_IFREG caused openssh sftp to refuse to get the file 2015-09-08 17:03:18 -07: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 c69ab311ab all tests invoking external binaries considered integration tests to satisfy wercker 2015-09-07 02:28:33 -07:00
Mark Sheahan 20391fc5d1 skip server tests if the openssh sftp client binary is unavailable 2015-09-07 02:20:58 -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 0aec5ce5ec use merge-to target branches, not ScriptRock ones 2015-09-06 21:54:42 -07:00
Mark Sheahan d9371ace46 skipping integration tests for server unless specified 2015-09-06 21:43:59 -07:00
Mark Sheahan c36e806e57 runLs output matching openssh for some stuff 2015-09-06 21:37:33 -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 1502f6c9e6 compare golang sftp subsystem to openssh 2015-08-07 00:51:14 -07:00
Mark Sheahan f9e831be30 proper ssh closing sequence 2015-08-05 23:24:33 -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 82ef5086ee server integration test scaffolding 2015-08-04 23:37:18 -07:00