Commit Graph

977 Commits

Author SHA1 Message Date
Cassondra Foesch 5b7cbe6684 creating a file at a dangling symlink should make the target filename 2020-09-17 14:23:59 +00:00
Cassondra Foesch d4a89094dc dangling links ok, but overwriting is not 2020-09-17 14:05:55 +00:00
Cassondra Foesch 18c9a7a273 support for O_EXCL 2020-09-17 13:46:13 +00:00
Cassondra Foesch 72a9e15fa5 handle O_EXCL|O_CREATE 2020-09-17 12:58:38 +00:00
Cassondra Foesch f05f53fcbb handle when os.O_CREATE not set 2020-09-17 12:56:04 +00:00
Cassondra Foesch 5471c643dd replace assert.Nil with {assert,require}.NoError 2020-09-17 12:52:54 +00:00
Cassondra Foesch cd54350fbe ListerAt polishing 2020-09-17 12:14:59 +00:00
Cassondra Foesch 115b73076b refactor ListerAt functionality 2020-09-17 12:03:39 +00:00
Cassondra Foesch dc4f208617 fetch follows symlinks, lfetch does not 2020-09-17 11:47:19 +00:00
Cassondra Foesch d96ad30fc5 test: symlinks should be followed recursively 2020-09-17 11:40:22 +00:00
Cassondra Foesch 328101fbc9 go fmt 2020-09-17 09:54:29 +00:00
Cassondra Foesch 82f3e48fbd refactor memFile 2020-09-17 09:53:13 +00:00
Cassondra Foesch c05b4d1c30
Merge pull request #380 from fhs/plan9
Fix build on Plan 9
2020-09-17 09:29:16 +00:00
Fazlul Shahriar b89e2825a4
Replace an one-case switch statement with an if-statement 2020-09-15 18:43:45 -04:00
Fazlul Shahriar bbd5cf2737
Merge branch 'master' into plan9 2020-09-15 12:06:10 -04:00
Cassondra Foesch 37434b9e08
Merge pull request #382 from willnorris/enotdir
server: use os.IsNotExist to map sshFxNoSuchFile
2020-09-15 11:48:29 +00:00
Fazlul Shahriar 5a6519c8a7
Rename stat_unix.go to stat_posix.go 2020-09-14 11:39:42 -04:00
Will Norris 8df2eb9876 server: better handle IsNotExist errors
Return early from statusFromError if os.IsNotExist is true.
2020-09-14 07:58:12 -07:00
Will Norris 28f6fd9187 server: use os.IsNotExist to map sshFxNoSuchFile
Always use os.IsNotExist to identify any OS specific error types that
represent missing files or directories.  This resolves an issue on
Windows where some system errors (ENOTDIR) were not being identified as
'not found' errors and mapped to sshFxNoSuchFile.

fixes #381
2020-09-13 21:38:21 -07:00
Nicola Murino ec5b80d98e
Merge pull request #379 from drakkan/lstat
request-server: add lstat support
2020-09-11 09:11:46 +02: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 644f91ba0e
Merge pull request #378 from drakkan/maligned
pack structures so they have less size

This is a micro optimization, it fixes warnings like this one:

packet.go:707:24: struct of size 32 bytes could be of size 24 bytes
2020-09-08 10:23:00 +02:00
Nicola Murino 3177348ca5 pack structures so they have less size
This is a micro optimization, it fixes warnings like this one:

packet.go:707:24: struct of size 32 bytes could be of size 24 bytes
2020-09-08 10:18:15 +02:00
Nicola Murino ba3e280524 request-server: add lstat support
Add LstatFileLister, an optional interface for FileLister, if this
interface is implemented Lstat requests will call it otherwirse they
will be handled in the same way as Stat, as before
2020-09-06 08:26:58 +02:00
Nicola Murino 7a079e8e55
Merge pull request #377 from drakkan/rs_rw
request-server: implement Open method
2020-09-05 22:15:20 +02:00
Nicola Murino 29c94d06cc request-server: simplify "Open" method handling 2020-09-03 18:17:31 +02:00
Nicola Murino 703dd9827c request-server: set request state only if there is no error 2020-09-03 16:40:14 +02:00
Nicola Murino f70d440af3 memory handler: use POSIX paths 2020-09-02 19:26:46 +02:00
Nicola Murino 9284f1d6ac only check OpenFileWriter interface if Read flags is true
Improve memory handler and some test case
Improve nil check for Close and TransferError interfaces
2020-09-02 19:21:12 +02:00
Nicola Murino ea67d57ce5 request-server: implement Open method
add an optional interface to FileWriter to allow to open a file for both
writing and reading

Fixes #374
2020-08-30 10:40:22 +02:00
Cassondra Foesch 60ec050bd0
Merge pull request #376 from pkg/update-go-mod-for-1-12
Update go.mod dependencies ahead of 1.12 release
2020-08-26 12:13:37 +00:00
Cassondra Foesch 1d7625b475 update go.mod dependencies 2020-08-26 08:40:23 +00:00
Nicola Murino 06ab92ee39
Merge pull request #373 from drakkan/fsetstat
request server: add support for SSH_FXP_FSETSTAT
2020-08-25 18:06:22 +02:00
Nicola Murino 07229f28f5 Improve Fsetstat test case 2020-08-25 14:39:22 +02:00
Nicola Murino b6bdd772b5 truncate should not change offset
improved Fsetstat test case
2020-08-25 07:46:42 +02:00
Nicola Murino 4da3253ee1 travis: add 1.15 2020-08-24 15:22:09 +02:00
Nicola Murino a011842257 request server: add support for SSH_FXP_FSETSTAT
we need to add a case for this packet inside the packet worker otherwise
it will be handled in hasHandle case and it will become a "Put" request.

Client side if a Truncate request is called on the open file we should
send a FSETSTAT packet, the request is on the handle, and not a SETSTAT
packet that should be used for paths and not for handle.
2020-08-24 15:00:36 +02:00
Cassondra Foesch 2c442348ca
Merge pull request #375 from tklauser/revert-pr-370
Revert PR #370
2020-08-24 11:27:10 +00:00
Tobias Klauser 7d8a855595 Revert PR #370
This reverts commit 3cda2a1c6b / PR #370.

Reason for revert: this broke the Travis CI build, see
https://github.com/pkg/sftp/pull/370#issuecomment-678610816
2020-08-24 11:22:05 +02:00
Cassondra Foesch a6e55f601f
Merge pull request #372 from pkg/hotfix/add-a-mutex-for-File-Read
Add a mutex to protect f.offset in new File.Read
2020-08-21 08:04:05 +00:00
Cassondra Foesch 4550e71d6e Add a mutex to protect f.offset in new File.Read 2020-08-19 11:09:42 +00:00
Cassondra Foesch 3ee8d0ba91
Merge pull request #285 from polygon-io/master
Add io.ReaderAt interface compatibility
2020-08-19 11:07:14 +00:00
Cassondra Foesch 79788b4a5c
Merge pull request #370 from tklauser/request-unix-test
Exclude test/example code in non-test builds
2020-08-19 11:02:29 +00:00
Tobias Klauser 3cda2a1c6b Exclude test/example code in non-test builds
The fakeFileInfoSys and testOsSys funcs are only used in tests, so
rename the files they are defined in to request_*_test.go to exclude
them from non-test builds.

Also rename request-example.go to request_example_test.go to exclude it
as well, since it uses said funcs in example code.
2020-08-10 14:14:59 +02:00
Cassondra Foesch b508b936be
Merge pull request #363 from pkg/patch/RequestServer-Serve-bugs
RequestServer.Serve bugs found looking at PR-361
2020-07-31 12:49:47 +00:00
Cassondra Foesch eace420102
Merge branch 'master' into patch/RequestServer-Serve-bugs 2020-07-25 10:50:34 +00:00
Cassondra Foesch f129610309
Merge pull request #366 from drakkan/simplify
remove redundant types declaration
2020-07-25 10:47:09 +00:00
Cassondra Foesch dce5f46339
Merge pull request #365 from drakkan/deps_update
update deps
2020-07-25 10:46:05 +00:00
Nicola Murino 1acb74f50a remove redundant types declaration 2020-07-25 10:17:41 +02:00
Nicola Murino 124fca874e update deps 2020-07-24 21:02:01 +02:00