diff options
author | Kenny Root <kenny@the-b.org> | 2015-09-07 22:15:57 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-09-07 22:15:57 -0700 |
commit | 57afa9bdc5b269a48bd27fc8455cab4cb956d02a (patch) | |
tree | 86e301f6769a92bf853e8d60b156a4e98f077ecf /app/src/main/java/org/connectbot/transport | |
parent | 747e11c6ff28fc833855b9979ce68a15b99915f6 (diff) | |
download | connectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.tar.gz connectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.tar.bz2 connectbot-57afa9bdc5b269a48bd27fc8455cab4cb956d02a.zip |
Never cache instances of the HostDatabase
Diffstat (limited to 'app/src/main/java/org/connectbot/transport')
-rw-r--r-- | app/src/main/java/org/connectbot/transport/SSH.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/src/main/java/org/connectbot/transport/SSH.java b/app/src/main/java/org/connectbot/transport/SSH.java index 4bad2f1..f3b85a6 100644 --- a/app/src/main/java/org/connectbot/transport/SSH.java +++ b/app/src/main/java/org/connectbot/transport/SSH.java @@ -141,7 +141,8 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException { // read in all known hosts from hostdb - KnownHosts hosts = manager.hostdb.getKnownHosts(); + HostDatabase hostDb = HostDatabase.get(manager); + KnownHosts hosts = hostDb.getKnownHosts(); Boolean result; String matchName = String.format(Locale.US, "%s:%d", hostname, port); @@ -172,7 +173,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC if (result == null) return false; if (result.booleanValue()) { // save this key in known database - manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); + hostDb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); } return result.booleanValue(); @@ -195,7 +196,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC result = bridge.promptHelper.requestBooleanPrompt(null, manager.res.getString(R.string.prompt_continue_connecting)); if (result != null && result.booleanValue()) { // save this key in known database - manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); + hostDb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); return true; } else { return false; @@ -249,13 +250,16 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC } else { bridge.outputLine(manager.res.getString(R.string.terminal_auth_pubkey_specific)); // use a specific key for this host, as requested - PubkeyBean pubkey = manager.pubkeydb.findPubkeyById(pubkeyId); + PubkeyDatabase pubkeyDb = PubkeyDatabase.get(manager); + PubkeyBean pubkey = pubkeyDb.findPubkeyById(pubkeyId); - if (pubkey == null) + if (pubkey == null) { bridge.outputLine(manager.res.getString(R.string.terminal_auth_pubkey_invalid)); - else - if (tryPublicKey(pubkey)) + } else { + if (tryPublicKey(pubkey)) { finishConnection(); + } + } } pubkeysExhausted = true; @@ -293,7 +297,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC /** * Attempt connection with database row pointed to by cursor. - * @param cursor + * @param pubkey * @return true for successful authentication * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException |