Mercurial > 510Connectbot
changeset 373:2768eb029d73
debug kex error
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 04 Aug 2014 13:08:22 -0700 |
parents | 20d0a1356c43 |
children | 597138203c15 |
files | src/ch/ethz/ssh2/Connection.java src/ch/ethz/ssh2/transport/ClientKexManager.java src/ch/ethz/ssh2/transport/KexManager.java |
diffstat | 3 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/Connection.java Mon Aug 04 12:11:12 2014 -0700 +++ b/src/ch/ethz/ssh2/Connection.java Mon Aug 04 13:08:22 2014 -0700 @@ -672,13 +672,16 @@ * run forever. */ - public synchronized void close() { + // cannot be synchronized, since Connection.connect() is synchronized, and + // if the key exchange fails, another thread will try to close(). + + public void close() { log.debug("Connection.close()"); Throwable t = new Throwable("Closed due to user request."); close(t, false); } - public synchronized void close(Throwable t, boolean hard) { + public void close(Throwable t, boolean hard) { log.debug(String.format("Connection.close(%s hard=%b)", t.getMessage(), hard)); if (cm != null) { cm.closeAllChannels();
--- a/src/ch/ethz/ssh2/transport/ClientKexManager.java Mon Aug 04 12:11:12 2014 -0700 +++ b/src/ch/ethz/ssh2/transport/ClientKexManager.java Mon Aug 04 13:08:22 2014 -0700 @@ -160,10 +160,10 @@ } if (kxs.np.kex_algo.equals("diffie-hellman-group1-sha1") || - kxs.np.kex_algo.equals("diffie-hellman-group14-sha1") || - kxs.np.kex_algo.equals("ecdh-sha2-nistp256") || - kxs.np.kex_algo.equals("ecdh-sha2-nistp384") || - kxs.np.kex_algo.equals("ecdh-sha2-nistp521")) { + kxs.np.kex_algo.equals("diffie-hellman-group14-sha1") || + kxs.np.kex_algo.equals("ecdh-sha2-nistp256") || + kxs.np.kex_algo.equals("ecdh-sha2-nistp384") || + kxs.np.kex_algo.equals("ecdh-sha2-nistp521")) { kxs.dhx = GenericDhExchange.getInstance(kxs.np.kex_algo); kxs.dhx.init(kxs.np.kex_algo); kxs.hashAlgo = kxs.dhx.getHashAlgo();
--- a/src/ch/ethz/ssh2/transport/KexManager.java Mon Aug 04 12:11:12 2014 -0700 +++ b/src/ch/ethz/ssh2/transport/KexManager.java Mon Aug 04 13:08:22 2014 -0700 @@ -40,22 +40,22 @@ private static final ArrayList<String> HOSTKEY_ALGS = new ArrayList<String>(); static { + HOSTKEY_ALGS.add("ssh-rsa"); + HOSTKEY_ALGS.add("ssh-dss"); HOSTKEY_ALGS.add("ecdsa-sha2-nistp256"); HOSTKEY_ALGS.add("ecdsa-sha2-nistp384"); HOSTKEY_ALGS.add("ecdsa-sha2-nistp521"); - HOSTKEY_ALGS.add("ssh-rsa"); - HOSTKEY_ALGS.add("ssh-dss"); } private static final ArrayList<String> KEX_ALGS = new ArrayList<String>(); static { - KEX_ALGS.add("ecdh-sha2-nistp256"); - KEX_ALGS.add("ecdh-sha2-nistp384"); - KEX_ALGS.add("ecdh-sha2-nistp521"); KEX_ALGS.add("diffie-hellman-group-exchange-sha256"); KEX_ALGS.add("diffie-hellman-group-exchange-sha1"); KEX_ALGS.add("diffie-hellman-group14-sha1"); KEX_ALGS.add("diffie-hellman-group1-sha1"); + KEX_ALGS.add("ecdh-sha2-nistp256"); + KEX_ALGS.add("ecdh-sha2-nistp384"); + KEX_ALGS.add("ecdh-sha2-nistp521"); } KexState kxs;