Created
December 16, 2015 21:30
-
-
Save octo47/e9790299b8b7a102e351 to your computer and use it in GitHub Desktop.
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
diff --git a/src/main/java/com/jcraft/jsch/JSch.java b/src/main/java/com/jcraft/jsch/JSch.java | |
index b6bc84b..cbe31f3 100644 | |
--- a/src/main/java/com/jcraft/jsch/JSch.java | |
+++ b/src/main/java/com/jcraft/jsch/JSch.java | |
@@ -29,6 +29,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
package com.jcraft.jsch; | |
+import java.io.File; | |
+import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.Vector; | |
@@ -202,6 +204,16 @@ public class JSch{ | |
catch(Exception e){ | |
} | |
*/ | |
+ | |
+ File f = new File(Util.checkTilde("~/.ssh/config")); | |
+ if (f.exists()) { | |
+ try { | |
+ ConfigRepository configRepository = OpenSSHConfig.parseFile(f.getAbsolutePath()); | |
+ this.setConfigRepository(configRepository); | |
+ } catch (IOException e) { | |
+ throw new RuntimeException("Can't use openssh config " + f.getPath(), e); | |
+ } | |
+ } | |
} | |
/** | |
diff --git a/src/main/java/com/jcraft/jsch/Session.java b/src/main/java/com/jcraft/jsch/Session.java | |
index 39e9029..16dac4f 100644 | |
--- a/src/main/java/com/jcraft/jsch/Session.java | |
+++ b/src/main/java/com/jcraft/jsch/Session.java | |
@@ -2615,8 +2615,7 @@ break; | |
return hostkeyRepository; | |
} | |
- /* | |
- // setProxyCommand("ssh -l user2 host2 -o 'ProxyCommand ssh user1@host1 nc host2 22' nc %h %p") | |
+ // setProxyCommand("ssh -l user2 host2 -o 'ProxyCommand ssh user1@host1 nc host2 22' nc %h %p") | |
public void setProxyCommand(String command){ | |
setProxy(new ProxyCommand(command)); | |
} | |
@@ -2653,7 +2652,6 @@ break; | |
} | |
} | |
} | |
- */ | |
private void applyConfig() throws JSchException { | |
ConfigRepository configRepository = jsch.getConfigRepository(); | |
@@ -2767,6 +2765,10 @@ break; | |
setConfig("ClearAllForwardings", value); | |
} | |
+ value = config.getValue("ProxyCommand"); | |
+ if (value != null && !value.equalsIgnoreCase("none")) { | |
+ setProxyCommand(value); | |
+ } | |
} | |
private void applyConfigChannel(ChannelSession channel) throws JSchException { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment