Discussion:
mina-sshd git commit: [SSHD-852] If standard or default port used in known hosts hash value then return original host name/address as-is as the host's pattern
l***@apache.org
2018-10-21 04:25:28 UTC
Permalink
Repository: mina-sshd
Updated Branches:
refs/heads/master f19bd2e34 -> f8ae0a295


[SSHD-852] If standard or default port used in known hosts hash value then return original host name/address as-is as the host's pattern


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/f8ae0a29
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/f8ae0a29
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/f8ae0a29

Branch: refs/heads/master
Commit: f8ae0a295a90d2ea867135d43bb2b5faf292b83c
Parents: f19bd2e
Author: Lyor Goldstein <***@apache.org>
Authored: Sun Oct 21 07:25:11 2018 +0300
Committer: Lyor Goldstein <***@apache.org>
Committed: Sun Oct 21 07:25:11 2018 +0300

----------------------------------------------------------------------
.../org/apache/sshd/client/config/hosts/KnownHostHashValue.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/f8ae0a29/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
----------------------------------------------------------------------
diff --git a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
index 294d6a4..bf43462 100644
--- a/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
+++ b/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/KnownHostHashValue.java
@@ -135,6 +135,10 @@ public class KnownHostHashValue {
}

public static String createHostPattern(String host, int port) {
+ if ((port <= 0) || (port == ConfigFileReaderSupport.DEFAULT_PORT)) {
+ return host;
+ }
+
try {
return appendHostPattern(new StringBuilder(host.length() + 8 /* port if necessary */), host, port).toString();
} catch (IOException e) {

Loading...