dustin-ward
9b553ccfda
Add support for zos/s390x
2024-04-04 16:26:47 -04:00
Nicola Murino
c4323ce9f2
minor improvements to some test cases
...
TestRequestReadlink: use "/does-not-exist" to test readlink on non-existent
file.
TestRequestAttributes: use 0700 for perm attrs instead of 700
2022-10-16 16:06:46 +02:00
Georg Müller
9183e7fd79
request-server: Introduce ReadlinkFileLister
...
ReadlinkFileLister with its Readlink method allows returning paths without
misusing the os.FileInfo interface, whose Name() method should only return
the base name of a file.
By implementing ReadlinkFileLister, it is possible to easily return
symlinks of any kind (absolute, relative, multiple directory levels)
2022-10-14 17:17:08 +02:00
Georg Müller
a3a11ee58f
request-server: extend symlink testcase
...
* add tests for sub directories
* add tests for relative symlink targets
* improve error messages
2022-10-14 17:16:38 +02:00
Nicola Murino
51a5aa4e04
RealPathFileLister: allow to return an error
...
added legacyRealPathFileLister for backward compatibility
Fixes #512
2022-07-16 09:55:51 +02:00
Nicola Murino
98b35dcfc3
request server: add WithStartDirectory option
2022-03-02 18:33:41 +01:00
Cassondra Foesch
f525d180b6
Merge pull request #456 from pkg/refactor/regroup-and-lint
...
Regroup marshling/unmarshaling and lint
2021-08-20 22:59:08 +00:00
Cassondra Foesch
7ad9c6f9ac
Merge pull request #461 from codesoap/unchecked
...
Check for two more errors in tests
2021-08-20 22:57:31 +00:00
codesoap
90ae4b588c
Check for two more errors in tests
2021-08-20 21:27:27 +02:00
codesoap
997499abb6
Fix a few misspells
2021-08-20 21:00:33 +02:00
Cassondra Foesch
68f4ca6663
linting
2021-08-11 11:12:34 +00:00
Nicola Murino
0b43101c5b
fix as per review
2021-04-27 18:06:39 +02:00
Nicola Murino
db2d41339c
request server: add an optional RealpathFileLister interface
...
This allow to customize the responses for SSH_FXP_REALPATH requests
and so implementing features like a start directory
2021-04-27 11:08:29 +02:00
Cassondra Foesch
fef2628887
remove write/read race condition
2021-02-22 12:04:43 +00:00
Cassondra Foesch
e3d9bf1123
early return error, happy path straight
2021-02-22 12:04:43 +00:00
Cassondra Foesch
c6aaae51f9
cleanup a t.Fatalf
2021-02-22 12:04:43 +00:00
Nicola Murino
14bb577288
client statVFS: normalize the returned error
...
added a test case for the request server to check os.IsNotExist error
2021-02-10 19:35:30 +01:00
Nicola Murino
5dbfeffd12
request-server: add StatVFS support
2021-02-10 19:13:19 +01:00
Nicola Murino
75eca30139
request-server test: set size for the error channel to 1
...
This way even if we do not read from this channel, there is not a
blocked goroutine left hanging
2020-11-18 08:57:15 +01:00
Nicola Murino
863783342b
request-server: add test cases for server errors
2020-11-16 17:38:12 +01:00
Nicola Murino
732b2a30fb
request server: fix handles leak in error case
...
For open/opendir requests we create a new handle and close it
when the client sends an SSH_FXP_CLOSE but if we return an error the
client will never send the close packet so we have to close the handle
ourselves
2020-11-16 14:34:09 +01:00
Cassondra Foesch
c46216738b
symlink loop testing
2020-09-29 17:39:30 +00:00
Cassondra Foesch
a0a2273fde
Test that Rename does not overwrite, and PosixRename does
2020-09-25 16:13:45 +00:00
Cassondra Foesch
6f2abc6af1
O_CREAT|O_EXCL can go through a directory symlink, but cannot create a dangling symlink target
2020-09-25 14:01:02 +00:00
Cassondra Foesch
8279444a65
oops mkdir on a dangling symlink SHOULD NOT work
2020-09-25 13:33:06 +00:00
Cassondra Foesch
2ac0d4ad11
more require over assert found during coding
2020-09-21 14:29:50 +00:00
Cassondra Foesch
99283be930
extract newfile creation to normalize how files/dirs/symlinks are made
2020-09-17 15:31:22 +00:00
Cassondra Foesch
ffc579dce4
test parent directory before making a symlink
2020-09-17 14:48:19 +00:00
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
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
Fazlul Shahriar
bbd5cf2737
Merge branch 'master' into plan9
2020-09-15 12:06:10 -04: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
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
703dd9827c
request-server: set request state only if there is no error
2020-09-03 16:40:14 +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
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
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
97b9df616e
Merge pull request #355 from drakkan/path
...
cleanPath: use path.IsAbs after converting ToSlash
2020-07-16 19:17:56 +00:00
Nicola Murino
abc70d5950
improve test cases for cleanPath
2020-06-29 18:27:11 +02:00
Nicola Murino
2fc68482d2
remove NewRequestServerWithOptions
...
we can keep compatibility removing the error return value from
RequestServerOption
2020-03-19 13:20:22 +01: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