forked from apache/mina-sshd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-384: SFTP: improve FileChannel locking
SSH_FXP_BLOCK is available only in SFTPv6. It was introduced in draft 08. Throw an UnsupportedOperationException if the negotiated SFTP version is lower. Respect the contract of FileChannel.lock(): a shared lock can be requested only if the channel was opened for reading, and an exclusive lock only if the channel is writable. Check this, and throw appropriate exceptions if the condition is violated. Pass on the correct lock flags to the server. At the server, repeat the version check, and respect the flags passed. Since Java does not have delete locks we map them to write locks. The draft RFC[1] is silent on what to do if no flags are passed at all: we use an exclusive write lock if the handle was opened for writing, and a shared read lock otherwise. We cannot throw an exception since we must be able to support old Apache MINA sshd clients that sent zero as lock flags. [1] https://www.ietf.org/archive/id/draft-ietf-secsh-filexfer-13.txt Bug: apache#384
- Loading branch information
Showing
6 changed files
with
199 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.