Skip to content

Commit c11bfcc

Browse files
frothgatomaswolf
authored andcommitted
GH-281: Follow first-match semantics specified for ssh config file
OpenSSH applies _all_ values from _all_ matching entries in an SSH config file. For most keys, the first setting encountered is taken and later values are ignored. Some keys, such as IdentityFile, behave differently and build up a list instead. Previously, the code tried to figure out a "best match", and applied only the values from that entry. The new behavior is compatible with OpenSSH. Move the findMatchingEntries() methods from HostPatternsHolder to HostConfigEntry, where they make more sense. Add tests for the new behavior, and adapt some existing tests. Bug: #281
1 parent f887414 commit c11bfcc

File tree

6 files changed

+342
-593
lines changed

6 files changed

+342
-593
lines changed

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
* [GH-268](https://github.com/apache/mina-sshd/issues/268) (Regression in 2.9.0) Heartbeat should throw an exception if no reply arrives within the timeout.
2828
* [GH-275](https://github.com/apache/mina-sshd/issues/275) SFTP: be more lenient when reading `SSH_FXP_STATUS` replies.
29+
* [GH-281](https://github.com/apache/mina-sshd/issues/281) Use OpenSSH first-match semantics for processing HostConfigEntries.
2930
* [GH-282](https://github.com/apache/mina-sshd/issues/282) Correct setting file permissions on newly written host key files on Windows.
3031
* [GH-283](https://github.com/apache/mina-sshd/issues/283) Fix handling of `CoreModuleProperties.PASSWORD_PROMPTS`.
3132
* [GH-285](https://github.com/apache/mina-sshd/issues/285) Fix compilation failure on Java 19.
@@ -36,7 +37,7 @@
3637
* [GH-300](https://github.com/apache/mina-sshd/issues/300) Read the channel id in `SSH_MSG_CHANNEL_OPEN_CONFIRMATION` as unsigned int.
3738
* [GH-313](https://github.com/apache/mina-sshd/issues/313) Log exceptions in the SFTP subsystem before sending a failure status reply.
3839
* [GH-322](https://github.com/apache/mina-sshd/issues/322) Add basic Android O/S awareness.
39-
* [GH-325](https://github.com/apache/mina-sshd/issues/325) SftpFileSystemProvider: fix deletions of symlinks through Files.delete().
40+
* [GH-325](https://github.com/apache/mina-sshd/issues/325) SftpFileSystemProvider: fix deletions of symlinks through `Files.delete()`.
4041

4142

4243
* [SSHD-1295](https://issues.apache.org/jira/browse/SSHD-1295) Fix cancellation of futures and add options to cancel futures on time-outs.

0 commit comments

Comments
 (0)