|
|
@ -742,6 +742,24 @@ public class EmailService implements AutoCloseable {
|
|
|
|
((ErrnoException) ex.getCause().getCause()).errno == OsConstants.EACCES)
|
|
|
|
((ErrnoException) ex.getCause().getCause()).errno == OsConstants.EACCES)
|
|
|
|
throw new SecurityException("EACCES Please check 'Restrict data usage' in the Android app settings", ex);
|
|
|
|
throw new SecurityException("EACCES Please check 'Restrict data usage' in the Android app settings", ex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ssl_harden && ConnectionHelper.isUnsupportedProtocol(ex)) {
|
|
|
|
|
|
|
|
EntityLog.log(context, EntityLog.Type.Network, "Unsuported protocol");
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
this.insecure = true;
|
|
|
|
|
|
|
|
factory = new SSLSocketFactoryService(context,
|
|
|
|
|
|
|
|
host, port, true, false,
|
|
|
|
|
|
|
|
false, false, false, false,
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
true, true,
|
|
|
|
|
|
|
|
factory.key, factory.chain, factory.trustedFingerprint);
|
|
|
|
|
|
|
|
properties.put("mail." + protocol + ".ssl.socketFactory", factory);
|
|
|
|
|
|
|
|
_connect(main, port, require_id, user, factory);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} catch (GeneralSecurityException ex1) {
|
|
|
|
|
|
|
|
Log.e(ex1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
boolean ioError = false;
|
|
|
|
boolean ioError = false;
|
|
|
|
Throwable ce = ex;
|
|
|
|
Throwable ce = ex;
|
|
|
|
while (ce != null) {
|
|
|
|
while (ce != null) {
|
|
|
@ -818,6 +836,7 @@ public class EmailService implements AutoCloseable {
|
|
|
|
throw new MessagingException(ex1.getMessage(), ex1);
|
|
|
|
throw new MessagingException(ex1.getMessage(), ex1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1111,6 +1130,8 @@ public class EmailService implements AutoCloseable {
|
|
|
|
private boolean secure;
|
|
|
|
private boolean secure;
|
|
|
|
private boolean ssl_harden;
|
|
|
|
private boolean ssl_harden;
|
|
|
|
private boolean ssl_harden_strict;
|
|
|
|
private boolean ssl_harden_strict;
|
|
|
|
|
|
|
|
private PrivateKey key;
|
|
|
|
|
|
|
|
private X509Certificate[] chain;
|
|
|
|
private String trustedFingerprint;
|
|
|
|
private String trustedFingerprint;
|
|
|
|
private SSLSocketFactory factory;
|
|
|
|
private SSLSocketFactory factory;
|
|
|
|
private X509Certificate certificate;
|
|
|
|
private X509Certificate certificate;
|
|
|
@ -1125,6 +1146,8 @@ public class EmailService implements AutoCloseable {
|
|
|
|
this.secure = !insecure;
|
|
|
|
this.secure = !insecure;
|
|
|
|
this.ssl_harden = ssl_harden;
|
|
|
|
this.ssl_harden = ssl_harden;
|
|
|
|
this.ssl_harden_strict = ssl_harden_strict;
|
|
|
|
this.ssl_harden_strict = ssl_harden_strict;
|
|
|
|
|
|
|
|
this.key = key;
|
|
|
|
|
|
|
|
this.chain = chain;
|
|
|
|
this.trustedFingerprint = fingerprint;
|
|
|
|
this.trustedFingerprint = fingerprint;
|
|
|
|
|
|
|
|
|
|
|
|
TrustManager[] tms = SSLHelper.getTrustManagers(
|
|
|
|
TrustManager[] tms = SSLHelper.getTrustManagers(
|
|
|
|