Commit Graph

1184 Commits

Author SHA1 Message Date
John Eikenberry 0277caa990 fix S_IFMT value on windows and plan9
Go defines S_IFMT on windows, plan9 and js/wasm as 0x1f000 instead of
0xf000. None of the the other S_IFxyz values (even on those mentioned)
include the "1" (in 0x1f000) which prevents them from matching the
bitmask.

This fixes that by overriding the S_IFMT value on the effected platforms
to be 0xf000, as it it on all others.
2020-01-02 12:59:24 -08:00
John Eikenberry 939a6934bc
Merge pull request #328 from vansante/fix-empty-attributes-panicking
Fix panics when attempting to get file attributes from too small byte slices
2019-12-30 12:17:42 -08:00
Paul van Santen f94839fd59
Add const for all attribute flags and add missing newline 2019-12-27 10:56:42 +01:00
Paul van Santen 1bb2f2849b
Fix panics when attempting to get file attributes from too small byte slice 2019-12-24 09:37:32 +01:00
John Eikenberry 8488d36ede
Merge pull request #315 from drakkan/extensions
make SFTP extensions configurable

Thanks @drakkan
2019-11-11 15:44:05 -08:00
Nicola Murino 429ee173fb make SFTP extensions configurable 2019-11-11 18:04:56 +01:00
John Eikenberry 6d50bf4a21
Merge pull request #316 from drakkan/posixrename
Fix posixrename and add a test case
2019-11-02 14:07:27 -07:00
John Eikenberry 4033788e3d
Merge pull request #317 from pkg/revert-313-master
Revert "Bug: windows specific issue on request-server.go"
2019-11-02 14:05:18 -07:00
John Eikenberry 5a3a7572f5
Revert "Bug: windows specific issue on request-server.go" 2019-11-02 21:04:45 +00:00
John Eikenberry 73241350c5
Merge pull request #313 from danfletcher1/master
Bug: windows specific issue on request-server.go
2019-11-02 14:03:59 -07:00
Nicola Murino f9e61c9b8f request-server: add test case for posixrename 2019-10-28 10:34:49 +01:00
Daniel Fletcher 5df8e92923 request-server: fix posixrename 2019-10-27 06:59:47 +01:00
Daniel Fletcher 313f3c181d Bug: InMemoryHandler() mimics a linux file system. When build for
windows filepath.Dir(), more specifically the clean function preforms
incorrectly in our situation. As the filesystem is constant we can do a
simplified dir() function to resolve the issue.
2019-10-23 10:45:52 +01:00
Daniel Fletcher 26d6af7a59 Bug: Rename function wasn't working for me, the type was not being
selected. I am unsure if this is the final solution as it will undo a
previous update that may resolve a differen issue.
2019-10-23 10:42:02 +01:00
John Eikenberry 515578a967
Merge pull request #311 from danfletcher1/master
Bug with sub folders/files of a renamed/removed path
2019-10-21 22:40:01 -07:00
Daniel Fletcher e9514f4967 Removed some unnecessary logging, and previous merge duplicated some code 2019-10-21 12:43:45 +01:00
Daniel Fletcher 4adf56b4e4 Merge branch 'master' of https://github.com/danfletcher1/sftp 2019-10-21 11:54:57 +01:00
Daniel Fletcher 67f906c100 When removing or renaming a folder, subfiles/folders of the path was not being updated 2019-10-21 11:52:48 +01:00
John Eikenberry 4350932b98
Merge pull request #312 from LeeEirc/bugfix_request
fix nil panic error
2019-10-13 20:02:35 -07:00
John Eikenberry 463bb932d3
Merge pull request #310 from pkg/issue-305-client-write
Issue 305 client write

Fixes #305
2019-10-13 19:30:09 -07:00
John Eikenberry c732bf9952 add method to get fxerr value for StatusError code
Need to get StatusError.Code (uint32) converted to fxerr type so you can
compare it to public (exported) ErrSSHFx[..] error types. This adds a
new method, FxCode(), to the StatusError objects to handle this case.

Did this vs trying to change types of existing fields to not break
backwards compatibility.
2019-10-13 19:18:35 -07:00
John Eikenberry 8067637962 add note in Create() docs about AWS + O_RDWR 2019-10-13 19:18:30 -07:00
Eric 3f23d5935f fix nil panic error when sshFxpExtendedPacket could not UnmarshalBinary ExtendedRequest 2019-10-11 14:31:08 +08:00
Daniel Fletcher b4e1be7c5d When removing or renaming a folder, subfiles/folders of the path was not being updated 2019-10-09 16:40:31 +01:00
John Eikenberry 84e6527392
Merge pull request #309 from wutz/master
fix: received packet too long
2019-09-29 14:37:50 -07:00
John Eikenberry 0852dbaaaf update go versions in travis 2019-09-29 14:00:25 -07:00
John Eikenberry dcef9e0d4a
Merge pull request #304 from drakkan/lint
fix lint issues and update to be more idiomatic
2019-09-29 13:12:10 -07:00
Taizeng Wu cfce8a5728 fix: received packet too long
Close #308
2019-09-29 14:39:33 +08:00
John Eikenberry 8fc59612f2
Merge pull request #307 from drakkan/transfer_errors
notify errors to readerAt and writerAt
2019-09-12 18:11:39 -07:00
Nicola Murino c5d967b3f6 notify errors to readerAt and writerAt
Add an optional interface that readerAt and writerAt can implement
to be notified about the error causing Serve() to exit with the
request still open.

Implement the TransferError interface in request-example.
This way we can run the request server example in debug mode, for example:

cd examples/request-server
go run -tags debug main.go

simulate a connection error killing an sftp client while uploading/downloading
and see the debug log that shows that the error is correctly notifyed

Fixes #306
2019-09-12 08:17:32 +02: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
John Eikenberry 43a60a90f4
Merge pull request #303 from drakkan/extensions
define supported extensions in one place and use for both server and …
2019-08-29 14:10:45 -07:00
Nicola Murino b519cb8db9 define supported extensions in one place and use for both server and request-server 2019-08-27 09:18:15 +02:00
John Eikenberry a760e7925e
Merge pull request #302 from tommie/announce-posix-rename
Announce the posix-rename extension in the server.
2019-08-27 02:21:13 +00:00
Tommie Gannert 687cea6a44 Announce the posix-rename extension in the server. 2019-08-26 09:02:10 +02:00
John Eikenberry 554cbc556f update versions to ignore on macOS 2019-08-25 20:59:02 -07:00
John Eikenberry 5a2fe52342 Merge branch 'soopsio-master' into test 2019-08-25 20:32:04 -07:00
John Eikenberry 5d724974df Merge branch 'kardianos-kardianos-server-ext' into test 2019-08-25 20:24:06 -07:00
John Eikenberry b6b7dd88b0 Merge branch 'tommie-hardlink' into test 2019-08-25 20:22:54 -07:00
soopsio 55133952b5 gracefully handle unknown extended packets
Fixed a problem that caused secureFX to crash when
errUnknownExtendedPacket in SFTP server mode
2019-08-25 20:19:45 -07:00
Daniel Theophanes e5ded3a9d1 sftp: support rename extension for server
Previously if a client makes an unsupported operation,
like a POSIX rename, it would exit the server.

Both support POSIX rename, and do not abort the connection
if there is an unsupported operation is made by the client.
2019-08-25 20:17:08 -07: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
John Eikenberry 3edd153f21 update to use go modules 2019-08-25 18:40:38 -07:00
John Eikenberry d4a0cecfdc remove unstandard error
All unmarshall calls return the same errShortPacket except this one for
no reason. Fix that.
2019-08-25 18:21:33 -07:00
John Eikenberry 79ae07e778
Merge pull request #293 from tommie/fixes
Allow -sftp to work in server_integration_test
2019-06-13 09:30:56 -07:00
Tommie Gannert 2b53636545 Allow -sftp to work in server_integration_test. 2019-06-12 09:20:07 +02:00
John Eikenberry 7843b1d164
Merge pull request #292 from sekky0905/remove-travis-sudo-setting
Remove sudo setting from travis.yml
2019-06-05 14:37:45 -07:00
sekky0905 bef7f04843 Remove sudo setting from travis.yml 2019-06-04 16:50:16 +09:00
John Eikenberry e98a7bef68
Merge pull request #289 from ncw/fix-288
Use Stat rather than Fstat in File.WriteTo to work around server bugs
2019-05-22 19:58:18 -07:00
Nick Craig-Wood 48c87f62c9 Use Stat rather than Fstat in File.WriteTo to work around server bugs
Before this change in File.WriteTo() we used Fstat to discover the
length of the file being transferred.  It appears that some SFTP
servers do not implement this properly perhaps because it is a seldom
used call.

After this change we replace the Fstat on the file handle with a Stat
of the path.  Stat is commonly used function and implemented correctly
in both the servers that had the problem with Fstat, thus working
around the problem.

The code before and after uses the same number of SFTP roundtrips so
performance should be identical.

Fixes #288
2019-05-21 12:02:15 +01:00