# HG changeset patch # User Carl Byington # Date 1407182902 25200 # Node ID 2768eb029d7332e42a1ae9c4d4eba132ff833423 # Parent 20d0a1356c43b32e8961ad742478ce3cf6b122ed debug kex error diff -r 20d0a1356c43 -r 2768eb029d73 src/ch/ethz/ssh2/Connection.java --- 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(); diff -r 20d0a1356c43 -r 2768eb029d73 src/ch/ethz/ssh2/transport/ClientKexManager.java --- 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(); diff -r 20d0a1356c43 -r 2768eb029d73 src/ch/ethz/ssh2/transport/KexManager.java --- 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 HOSTKEY_ALGS = new ArrayList(); 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 KEX_ALGS = new ArrayList(); 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;