Commit Graph

1073 Commits

Author SHA1 Message Date
Cassondra Foesch 5a5e762d06 bug: doesn't return buf.Err 2023-03-27 17:25:27 +00:00
Cassondra Foesch bd61319b07 refactor sshfx encoding, fix link rot, go fmt 2023-03-27 17:05:24 +00:00
Nicola Murino 971c283182
Merge pull request #537 from ncw/fix-readfrom
Stop ReadFromWithConcurrency sending more data than it needs to
2023-02-13 19:01:17 +01:00
Nick Craig-Wood 8add055936 Stop ReadFromWithConcurrency sending more data than it needs to
It was discovered that the ReadFrom method for uploading files in
pkg/sftp was sending more data than it needed to.

This was tracked down to the ReadFromWithConcurrency method forgetting
to truncate the packets it was sending to the size Read.

This was giving the remote server more work to do as it was writing
and re-writing parts of a file.

See: https://github.com/rclone/rclone/issues/6763
2023-02-13 14:18:36 +00:00
Nicola Murino 2489717da0
Merge pull request #535 from drakkan/errwrap
statusFromError: improve support for error wrapping
2023-01-04 09:27:18 +01:00
Nicola Murino 08880975fb statusFromError: improve support for error wrapping 2022-12-25 17:21:42 +01:00
Cassondra Foesch 707787e8bc
Merge pull request #533 from DavidKorczynski/cifuzz-int
CI: add CIFuzz integration
2022-11-23 02:59:43 +01:00
David Korczynski f6678103bd CI: add CIFuzz integration 2022-11-22 03:16:20 -08:00
Nicola Murino e4133ab7e9 go.mod: update crypto dependency to the latest tagged version 2022-10-20 07:47:26 +02:00
Cassondra Foesch 7da137aa03
Merge pull request #528 from mafredri/mafredri/add-workdir-to-server
Add support for working directory in Server
2022-10-18 20:21:25 +02:00
Mathias Fredriksson 8514370390 Fix PR comments (build tags, %q) 2022-10-18 19:36:12 +03:00
Mathias Fredriksson c93b0a0af2 Refactor tests and make `toLocalPath` a method on `Server` 2022-10-18 18:17:45 +03:00
Mathias Fredriksson b3f237d7ad Add linux counterpart test 2022-10-18 11:19:29 +03:00
Mathias Fredriksson d0f04135b1 Add test for invalid input on Windows 2022-10-18 11:17:10 +03:00
Mathias Fredriksson bf40a02d09 Cleanup intent of `toLocalPath` test 2022-10-18 11:15:09 +03:00
Mathias Fredriksson ae4859f1cd Update tests for `toLocalPath` 2022-10-17 17:20:39 +03:00
Mathias Fredriksson 32ac60b179 Fix use of double-toLocalPath in `sshFxpOpendirPacket` 2022-10-17 17:11:18 +03:00
Mathias Fredriksson 78e59618f6 Revert unintended change 2022-10-17 17:09:17 +03:00
Mathias Fredriksson ff98544388 Simplify test 2022-10-17 17:08:58 +03:00
Mathias Fredriksson 7de2651135 Simplify path check in `toLocalPath` 2022-10-17 17:08:45 +03:00
Nicola Murino 88c72168ab CI: update actions 2022-10-16 16:21:12 +02: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
Nicola Murino 43b3a5532d
Merge pull request #526 from georgmu/request-server-relative-symlinks
request server: handle relative symlinks
2022-10-16 15:57:09 +02:00
Mathias Fredriksson 624034d7c4 Add tests for toLocalPath 2022-10-15 18:11:05 +03: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 eb2fffbb98 request server: fix symlink handling for relative links 2022-10-14 17:16:43 +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
Mathias Fredriksson 6a7168cf46 Add support for working directory in Server
This commit allows the working directory for the (old) Server
implementation to be changed without doing a `os.Chdir` first.

The feature can be enabled with `sftp.WithServerWorkingDirectory(dir)`
passed as an option to `sftp.NewServer`.

It is useful when the `sftp` is used as part of a larger service that
does more than just serve `sftp` and using `os.Chdir` is not an option.

The fallback behavior (when the option is not specified) is that the
path remains unmodified (as before).
2022-10-14 15:54:59 +03:00
Nicola Murino 3aa4378d78
Merge pull request #525 from pkg/document_symlink_packet_weirdness
Document the weirdness of the reversal of arguments to SSH_FXP_SYMLINK
2022-09-29 11:02:23 +02:00
Cassondra Foesch 975b486c5e document the weirdness of the reversal of arguments to SSH_FXP_SYMLINK 2022-09-29 08:51:09 +00:00
Nicola Murino 628507938e
Merge pull request #521 from drakkan/CI
CI: update Go versions
2022-08-31 18:07:57 +02:00
Nicola Murino 27d8571ed3 CI: update Go versions 2022-08-31 17:21:23 +02:00
Nicola Murino 811ed177f0
Merge pull request #516 from drakkan/realpath
RealPathFileLister: allow to return an error
2022-08-31 17:18:46 +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 cf523d99b5
Merge pull request #513 from pkg/better-client-startup-diagnostic-messages
More context for EOF during client setup
2022-07-11 14:26:53 +02:00
Cassondra Foesch aad3ee1c0e an even better error message 2022-07-11 11:34:22 +00:00
Cassondra Foesch cc19e20d72 more context for EOF during client setup 2022-06-29 12:13:03 +00:00
Cassondra Foesch a17a626ab8
Remove unreachable and duplicated return statement
I’m confident blame will show I am at fault here, not sure how I missed it, and why `go vet` didn’t catch it either.
2022-03-30 09:17:11 +00:00
Nicola Murino dcfc1d5e41
Merge pull request #499 from drakkan/write-seq
writeToSequential: improve tests for write errors
2022-03-03 12:34:17 +01:00
Nicola Murino c7fdf5e5c6 writeToSequential: improve tests for write errors 2022-03-03 12:30:24 +01:00
Nicola Murino 59b2472859
Merge pull request #498 from drakkan/startdir
request server: add WithStartDirectory option
2022-03-03 12:09:40 +01:00
Hilari Moragrega 65f24bcee4 Improved test with CR feedback 2022-03-03 09:43:16 +01:00
Hilari Moragrega c2c0f6090e Return writer error if not nil in writeSequential 2022-03-03 09:43:11 +01:00
Nicola Murino 03407a734b mark RealPathFileLister as deprecated 2022-03-02 18:44:54 +01:00
Nicola Murino 98b35dcfc3 request server: add WithStartDirectory option 2022-03-02 18:33:41 +01:00
Nicola Murino aa9a37d639
Merge pull request #492 from pkg/bug/extended-packets-no-path-convert
[bug] PosixRename and Hardlink don’t convert remote paths to local paths
2022-02-01 09:17:30 +01: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
Cassondra Foesch 7cbc4bdd2f PosixRename, Hardlink: need to convert remote paths to local paths 2022-01-31 21:12:05 +00:00
Cassondra Foesch 7d25d533c9
Merge pull request #490 from glebteterin/bug-489
Fix missing io.EOF when concurency is disabled #489
2022-01-19 19:28:00 +00:00