1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Provide notification if STARTTLS is not available

This commit is contained in:
Joe Steele 2014-02-28 12:47:43 -05:00
parent daea7f1ecd
commit 14a0a7a2a7
3 changed files with 35 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import java.nio.charset.CodingErrorAction;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.security.Security; import java.security.Security;
import java.security.cert.CertificateException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -2497,7 +2498,16 @@ public class ImapStore extends Store {
throw new MessagingException("Invalid CAPABILITY response received"); throw new MessagingException("Invalid CAPABILITY response received");
} }
} else { } else {
throw new MessagingException("TLS not supported but required"); /*
* This exception triggers a "Certificate error"
* notification that takes the user to the incoming
* server settings for review. This might be needed if
* the account was configured with an obsolete
* "STARTTLS (if available)" setting.
*/
throw new CertificateValidationException(
"STARTTLS connection security not available",
new CertificateException());
} }
} }

View File

@ -18,12 +18,14 @@ import com.fsck.k9.net.ssl.TrustedSocketFactory;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
@ -339,7 +341,16 @@ public class Pop3Store extends Store {
} }
mCapabilities = getCapabilities(); mCapabilities = getCapabilities();
} else { } else {
throw new MessagingException("TLS not supported but required"); /*
* This exception triggers a "Certificate error"
* notification that takes the user to the incoming
* server settings for review. This might be needed if
* the account was configured with an obsolete
* "STARTTLS (if available)" setting.
*/
throw new CertificateValidationException(
"STARTTLS connection security not available",
new CertificateException());
} }
} }

View File

@ -19,6 +19,7 @@ import com.fsck.k9.net.ssl.TrustedSocketFactory;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.IOException; import java.io.IOException;
@ -27,6 +28,7 @@ import java.io.UnsupportedEncodingException;
import java.net.*; import java.net.*;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.util.*; import java.util.*;
@ -276,7 +278,16 @@ public class SmtpTransport extends Transport {
extensions = sendHello(localHost); extensions = sendHello(localHost);
secureConnection = true; secureConnection = true;
} else { } else {
throw new MessagingException("TLS not supported but required"); /*
* This exception triggers a "Certificate error"
* notification that takes the user to the incoming
* server settings for review. This might be needed if
* the account was configured with an obsolete
* "STARTTLS (if available)" setting.
*/
throw new CertificateValidationException(
"STARTTLS connection security not available",
new CertificateException());
} }
} }