summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache/src
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2018-11-17 18:44:27 +0100
committerThomas Wolf <thomas.wolf@paranor.ch>2018-11-17 18:55:06 +0100
commitc567b6ecde6b055441f52f0f36dcf8b9d0fe5068 (patch)
treee50c57f8945a2a8eec911e5e6f9e8bb6cc21d883 /org.eclipse.jgit.ssh.apache/src
parent00b235f0b86769ec6781a8114cd741f3cba08de5 (diff)
downloadjgit-c567b6ecde6b055441f52f0f36dcf8b9d0fe5068.tar.gz
jgit-c567b6ecde6b055441f52f0f36dcf8b9d0fe5068.zip
Apache MINA sshd client: don't leak HostConfigEntry
ProxyDataFactory had a parameter of type HostConfigEntry, but actually it wasn't used anywhere. Remove it -- it was the last leaked type from Apache MINA sshd. Also use the logger provided by upstream SshClient instead of creating a new Logger. Bug: 520927 Change-Id: Iaa78bbb998a5e574fa091664b75c48a3b9cfb897 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.ssh.apache/src')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java13
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/DefaultProxyDataFactory.java5
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/ProxyDataFactory.java6
3 files changed, 7 insertions, 17 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
index 9e9340482f..212b67fe33 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java
@@ -81,8 +81,6 @@ import org.eclipse.jgit.transport.SshConstants;
import org.eclipse.jgit.transport.sshd.KeyCache;
import org.eclipse.jgit.transport.sshd.ProxyData;
import org.eclipse.jgit.transport.sshd.ProxyDataFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Customized {@link SshClient} for JGit. It creates specialized
@@ -90,7 +88,7 @@ import org.slf4j.LoggerFactory;
* were created for, and it loads all KeyPair identities lazily.
*/
public class JGitSshClient extends SshClient {
- private static Logger LOG = LoggerFactory.getLogger(JGitSshClient.class);
+
/**
* We need access to this during the constructor of the ClientSession,
* before setConnectAddress() can have been called. So we have to remember
@@ -146,7 +144,7 @@ public class JGitSshClient extends SshClient {
setAttribute(HOST_CONFIG_ENTRY, hostConfig);
setAttribute(ORIGINAL_REMOTE_ADDRESS, address);
// Proxy support
- ProxyData proxy = getProxyData(hostConfig, address);
+ ProxyData proxy = getProxyData(address);
if (proxy != null) {
address = configureProxy(proxy, address);
proxy.clearPassword();
@@ -161,10 +159,9 @@ public class JGitSshClient extends SshClient {
}
}
- private ProxyData getProxyData(HostConfigEntry hostConfig,
- InetSocketAddress remoteAddress) {
+ private ProxyData getProxyData(InetSocketAddress remoteAddress) {
ProxyDataFactory factory = getProxyDatabase();
- return factory == null ? null : factory.get(hostConfig, remoteAddress);
+ return factory == null ? null : factory.get(remoteAddress);
}
private InetSocketAddress configureProxy(ProxyData proxyData,
@@ -187,7 +184,7 @@ public class JGitSshClient extends SshClient {
proxyData.getUser(), proxyData.getPassword()));
return address;
default:
- LOG.warn(format(SshdText.get().unknownProxyProtocol,
+ log.warn(format(SshdText.get().unknownProxyProtocol,
proxy.type().name()));
return remoteAddress;
}
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/DefaultProxyDataFactory.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/DefaultProxyDataFactory.java
index d83e31fa2b..97e0da0428 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/DefaultProxyDataFactory.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/DefaultProxyDataFactory.java
@@ -50,8 +50,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
-import org.apache.sshd.client.config.hosts.HostConfigEntry;
-
/**
* A default implementation of a {@link ProxyDataFactory} based on the standard
* {@link java.net.ProxySelector}.
@@ -61,8 +59,7 @@ import org.apache.sshd.client.config.hosts.HostConfigEntry;
public class DefaultProxyDataFactory implements ProxyDataFactory {
@Override
- public ProxyData get(HostConfigEntry hostConfig,
- InetSocketAddress remoteAddress) {
+ public ProxyData get(InetSocketAddress remoteAddress) {
try {
List<Proxy> proxies = ProxySelector.getDefault()
.select(new URI(Proxy.Type.SOCKS.name(),
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/ProxyDataFactory.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/ProxyDataFactory.java
index 1446d6ecea..334fff4f64 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/ProxyDataFactory.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/ProxyDataFactory.java
@@ -44,8 +44,6 @@ package org.eclipse.jgit.transport.sshd;
import java.net.InetSocketAddress;
-import org.apache.sshd.client.config.hosts.HostConfigEntry;
-
/**
* Interface for obtaining {@link ProxyData} to connect through some proxy.
*
@@ -59,12 +57,10 @@ public interface ProxyDataFactory {
* {@link ProxyData} contains a password, the {@link SshdSession} will clear
* it once it is no longer needed.
*
- * @param hostConfig
- * from the ssh config that we're going to connect for
* @param remoteAddress
* to connect to
* @return the {@link ProxyData} or {@code null} if a direct connection is
* to be made
*/
- ProxyData get(HostConfigEntry hostConfig, InetSocketAddress remoteAddress);
+ ProxyData get(InetSocketAddress remoteAddress);
}