mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-23 16:18:50 -05:00
Don't crash when trying to connect to an non-SSL service using SSL
Fixes issue 3798
This commit is contained in:
parent
6c7639023d
commit
e3f6561008
@ -153,9 +153,17 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
||||
afe.getMessage() == null ? "" : afe.getMessage());
|
||||
} catch (final CertificateValidationException cve) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", cve);
|
||||
acceptKeyDialog(
|
||||
R.string.account_setup_failed_dlg_certificate_message_fmt,
|
||||
cve);
|
||||
|
||||
// Avoid NullPointerException in acceptKeyDialog()
|
||||
if (TrustManagerFactory.getLastCertChain() != null) {
|
||||
acceptKeyDialog(
|
||||
R.string.account_setup_failed_dlg_certificate_message_fmt,
|
||||
cve);
|
||||
} else {
|
||||
showErrorDialog(
|
||||
R.string.account_setup_failed_dlg_server_message_fmt,
|
||||
(cve.getMessage() == null ? "" : cve.getMessage()));
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", t);
|
||||
showErrorDialog(
|
||||
|
@ -76,6 +76,8 @@ public final class TrustManagerFactory {
|
||||
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType)
|
||||
throws CertificateException {
|
||||
// FIXME: Using a static field to store the certificate chain is a bad idea. Instead
|
||||
// create a CertificateException subclass and store the chain there.
|
||||
TrustManagerFactory.setLastCertChain(chain);
|
||||
try {
|
||||
defaultTrustManager.checkServerTrusted(chain, authType);
|
||||
|
Loading…
Reference in New Issue
Block a user