tomaswolf opened a new issue, #384: URL: https://github.com/apache/mina-sshd/issues/384
### Version master ### Bug description The following code fails: ``` SftpFileSystemProvider provider = ...; FileChannel channel = provider.newFileChannel(somePath, StandardOpenOptions.READ); FileLock lock = channel.lock(from, to, true); ``` This creates a read-only file channel and tries to obtain a shared (read) lock. It fails with an Apache MINA sshd server returning a general failure. ### Actual behavior Obtaining the lock throws an exception. ### Expected behavior The lock can be obtained (if there are no conflicts). ### Relevant log output _No response_ ### Other information - File locking is available only in SFTP v6. Current code doesn't check for this. - The client always sends zero as lock flags; it should send the appropriate read/write lock flags. - The server ignores flags passed, and also does not check for the SFTP version. - Shared read locks can obtained only if the channel was opened for reading; exclusive write locks only if the channel was opened for writing. The client could check this condition before even making any server call. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org