diff options
author | Kenny Root <kenny@the-b.org> | 2015-09-11 10:57:30 -0700 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2015-09-11 11:01:56 -0700 |
commit | 2baa56c2629532adad82d0f67abe9dd568a24760 (patch) | |
tree | a2389ad30251f44dfa9c388cf8c1cee18e5c1338 /app/src/main/java/org/connectbot/transport/SSH.java | |
parent | 5d2ebeaa409fb2f74fe9eb799793cc004f9d9d29 (diff) | |
download | connectbot-2baa56c2629532adad82d0f67abe9dd568a24760.tar.gz connectbot-2baa56c2629532adad82d0f67abe9dd568a24760.tar.bz2 connectbot-2baa56c2629532adad82d0f67abe9dd568a24760.zip |
Revert "Never cache instances of the HostDatabase"
This reverts commit 57afa9bdc5b269a48bd27fc8455cab4cb956d02a.
This won't work with injection and makes testing a bit harder, so revert
it.
Diffstat (limited to 'app/src/main/java/org/connectbot/transport/SSH.java')
-rw-r--r-- | app/src/main/java/org/connectbot/transport/SSH.java | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/app/src/main/java/org/connectbot/transport/SSH.java b/app/src/main/java/org/connectbot/transport/SSH.java index f3b85a6..4bad2f1 100644 --- a/app/src/main/java/org/connectbot/transport/SSH.java +++ b/app/src/main/java/org/connectbot/transport/SSH.java @@ -141,8 +141,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException { // read in all known hosts from hostdb - HostDatabase hostDb = HostDatabase.get(manager); - KnownHosts hosts = hostDb.getKnownHosts(); + KnownHosts hosts = manager.hostdb.getKnownHosts(); Boolean result; String matchName = String.format(Locale.US, "%s:%d", hostname, port); @@ -173,7 +172,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC if (result == null) return false; if (result.booleanValue()) { // save this key in known database - hostDb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); + manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); } return result.booleanValue(); @@ -196,7 +195,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 - hostDb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); + manager.hostdb.saveKnownHost(hostname, port, serverHostKeyAlgorithm, serverHostKey); return true; } else { return false; @@ -250,16 +249,13 @@ 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 - PubkeyDatabase pubkeyDb = PubkeyDatabase.get(manager); - PubkeyBean pubkey = pubkeyDb.findPubkeyById(pubkeyId); + PubkeyBean pubkey = manager.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; @@ -297,7 +293,7 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC /** * Attempt connection with database row pointed to by cursor. - * @param pubkey + * @param cursor * @return true for successful authentication * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException |