diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml index 2759c3c97..d6c88a688 100644 --- a/res/values-ca/strings.xml +++ b/res/values-ca/strings.xml @@ -389,10 +389,6 @@ Si us plau, envia\'ns els errors, contribueix a millorar-lo a Tipus de seguretat Tipus d\'autenticació Cap - SSL/TLS (si és disponible) - SSL/TLS (sempre) - STARTTLS (si és disponible) - STARTTLS (sempre) Quan esborro missatges No els esborris del servidor diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index c28891705..7e83382d1 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -393,10 +393,6 @@ Posílejte prosím chybová hlášení, přispívejte novými funkcemi a ptejte Typ zabezpečení Typ ověření Žádné - SSL/TLS (je-li dostupné) - SSL/TLS (vždy) - STARTTLS (je-li dostupné) - STARTTLS (vždy) Když smažu zprávu Nemazat ji na serveru diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index c39b56048..bece6f525 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -389,10 +389,6 @@ Vær venlig at sende fejlrapporter, anmodning om nye funktioner, og spørgsmål Sikkerhed Autentifikations type Ingen - SSL/TLS (hvis tilgængelig) - SSL/TLS (altid) - STARTTLS (hvis tilgængelig) - STARTTLS (altid) Når jeg sletter en mail Undlad at slette på server diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 7df1011f0..3e685f573 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -387,10 +387,6 @@ Um Fehler zu melden, neue Funktionen vorzuschlagen oder Fragen zu stellen, besuc Sicherheitstyp Authentifizierungstyp Keine Verschlüsselung - SSL/TLS (falls verfügbar) - SSL/TLS (immer) - STARTTLS (falls verfügbar) - STARTTLS (immer) Beim Löschen von Nachrichten Nie von Server löschen diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index 9852d9964..7dde8f171 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -388,10 +388,6 @@ Ασφάλεια Πιστοποίηση Καμιά - SSL/TLS (αν υπάρχει) - SSL/TLS (πάντοτε) - STARTTLS (αν υπάρχει) - STARTTLS (πάντοτε) Κατά τη διαγραφή μηνύματος Να μη διαγράφεται στο server diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index b20ddf6e8..abb27998d 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -388,10 +388,6 @@ Por favor, envía los errores detectados, contribuye con nuevas funcionalidades Tipo de Seguridad Tipo de autentificación Ninguna - SSL/TLS (si disponible) - SSL/TLS (siempre) - STARTTLS (si disponible) - STARTTLS (siempre) Borrado de mensajes No borrar del servidor diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 7cdc8bdf4..59e6817e8 100755 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -389,10 +389,6 @@ Virheraportit, osallistuminen projektiin ja kysymykset: Mene osoitteeseen Suojauksen tyyppi Todennuksen tyyppi Ei mitään - SSL/TLS (jos käytettävissä) - SSL/TLS (aina) - STARTTLS (jos käytettävissä) - STARTTLS (aina) Kun viesti poistetaan Älä poista palvelimelta diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 01a545959..e925198f4 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -414,10 +414,6 @@ de plus Type de sécurité Type d\'authentification Aucun - SSL/TLS (si disponible) - SSL/TLS (toujours) - STARTTLS (si disponible) - STARTTLS (toujours) Supprimer les messages du serveur\u00A0: Jamais diff --git a/res/values-gl/strings.xml b/res/values-gl/strings.xml index a891ec599..81ea6942a 100644 --- a/res/values-gl/strings.xml +++ b/res/values-gl/strings.xml @@ -388,10 +388,6 @@ Por favor, envía os erros detectados, contribúe con novas funcionalidas e preg Tipo de Seguridade Tipo de autentificación Ningunha - SSL/TLS (se dispoñible) - SSL/TLS (sempre) - STARTTLS (se dispoñible) - STARTTLS (sempre) Borrado de mesaxes Non borrar do servidor diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 2c915e277..1d9f8b661 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -389,10 +389,6 @@ Hibajelentéseivel hozzájárul az újabb verziók tökéletesítéséhez, kérd Kapcsolat biztonsága Hitelesítés típus Nincs - SSL/TLS (ha elérhető) - SSL/TLS (mindig) - STARTTLS (ha elérhető) - STARTTLS (mindig) Üzenet törlésekor Ne törlődjön a szerverről diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 4718e0cf0..790138f30 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -388,10 +388,6 @@ Invia le tue segnalazioni, suggerisci nuove funzionalità e chiedi informazioni Tipo di protezione Tipo di autenticazione Nessuna - SSL/TLS (se disponibile) - SSL/TLS (sempre) - STARTTLS (se disponibile) - STARTTLS (sempre) Quando si elimina un messaggio Non eliminare dal server diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index c203bd31d..1d81f1e01 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -390,10 +390,6 @@ סוג אבטחה סוג אימות כלום - SSL/TLS (אם זמין) - SSL/TLS (תמיד) - STARTTLS (אם זמין) - STARTTLS (תמיד) כאשר אני מוחק הודעה אל תמחוק בשרת diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index 26001a089..4c0d10ff9 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -389,10 +389,6 @@ K-9 は大多数のメールクライアントと同様に、ほとんどのフ 保護された接続 認証タイプ 使用しない - 可能なら SSL/TLS を使用する - SSL/TLS を使用する - 可能なら STARTTLS を使用する - STARTTLS を使用する メール削除時の動作 サーバでは削除しない diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index be8001f93..8ce2a8600 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -387,10 +387,6 @@ K-9 메일은 대부분의 무료 hotmail 계정을 지원하지 않으며, 다 보안 연결 인증 방식 없음 - SSL/TLS (유효할 경우) - SSL/TLS (모든 인증서 허용) - STARTTLS (유효할 경우) - STARTTLS (모든 인증서 허용) 메시지 삭제 시 서버에는 메일을 삭제하지 않음 diff --git a/res/values-lt/strings.xml b/res/values-lt/strings.xml index f6650d610..39a5e9281 100644 --- a/res/values-lt/strings.xml +++ b/res/values-lt/strings.xml @@ -388,10 +388,6 @@ Praneškite apie klaidas, pridėkite naujų galimybių ir užduokite klausimus m Saugumas Tapatumo nustatymas Joks - SSL/TLS (jei įmanoma) - SSL/TLS (visada) - STARTTLS (jei įmanoma) - STARTTLS (visada) Kai pašalinu laišką Nešalinti serveryje diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index e20001522..3e2e94c3a 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -388,10 +388,6 @@ Graag foutrapporten, bijdrage nieuwe functies en vragen stellen op Beveiligings type Authenticatie type Geen - SSL/TLS (indien beschikbaar) - SSL/TLS (altijd) - STARTTLS (indien beschikbaar) - STARTTLS (altijd) Wanneer ik een bericht verwijder Verwijder niet van server diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 196d73e94..882d2f5a5 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -399,10 +399,6 @@ Wszelkie zgłoszenia usterek, zapytania oraz nowe pomysły prosimy przesyłać z Zabezpieczenia Rodzaj uwierzytelnienia Brak - SSL/TLS (jeśli dostępne) - SSL/TLS (zawsze) - STARTTLS (jeśli dostępne) - STARTTLS (zawsze) Gdy skasuję wiadomość Nie usuwaj z serwera diff --git a/res/values-pt-rBR/strings.xml b/res/values-pt-rBR/strings.xml index 0f268d1c1..cddd5feb4 100644 --- a/res/values-pt-rBR/strings.xml +++ b/res/values-pt-rBR/strings.xml @@ -388,10 +388,6 @@ Por favor, nos envie relatórios de bugs, contribua para novas melhorias e faça Tipo de segurança Tipo de autenticação Nenhum - SSL/TLS (se disponível) - SSL/TLS (sempre) - STARTTLS (se disponível) - STARTTLS (sempre) Quando eu excluir uma mensagem Não excluí-la do servidor diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 371472f61..714ba95b4 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -389,10 +389,6 @@ K-9 Mail — почтовый клиент для Android. Безопасность Аутентификация Нет - SSL/TLS (если доступно) - SSL/TLS (всегда) - STARTTLS (если доступно) - STARTTLS (всегда) Удалённое, на сервере Оставить diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml index 6641d617f..c57951a7b 100644 --- a/res/values-sk/strings.xml +++ b/res/values-sk/strings.xml @@ -388,10 +388,6 @@ Prosím, nahlasujte prípadné chyby, prispievajte novými funkciami a pýtajte Zabezpečenie Overenie Žiadne - SSL/TLS (ak je k dispozícii) - SSL/TLS (vždy) - STARTTLS (ak je k dispozícii) - STARTTLS (vždy) Akcia po vymazaní správy Ponechať na serveri diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index 47cc1ba23..8c57b59d3 100644 --- a/res/values-sv/strings.xml +++ b/res/values-sv/strings.xml @@ -389,10 +389,6 @@ Vänligen skicka felrapporter, hjälp till med nya funktioner och ställ frågor Säkerhetstyp Autentiseringstyp Ingen - SSL/TLS (om tillgängligt) - SSL/TLS (alltid) - STARTTLS (om tillgängligt) - STARTTLS (alltid) När jag raderar ett brev Radera inte på servern diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 152c515af..7f889465f 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -388,10 +388,6 @@ Lütfen hata raporlarınızı, istediğiniz yeni özellikleri ve sorularınızı Güvenlik tipi Kimlik doğrulama tipi Hiçbiri - SSL/TLS (Varsa) - SSL/TLS (daima) - STARTTLS (Varsa) - STARTTLS (Daima) Bir mesaj sildiğim zaman Sunucudan silme diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index 4b8886260..2e640af3d 100644 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -388,10 +388,6 @@ K-9 Mail це поштовий клієнт з відкритим вихідни Тип системи захисту Метод автентифікації Немає - SSL/TLS (якщо доступно) - SSL/TLS (завжди) - STARTTLS (якщо доступно) - STARTTLS (завжди) Коли повідомлення видалено Не видаляти на сервері diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 0b9b941e5..602db93bc 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -387,10 +387,6 @@ K-9改进的功能包括: 加密方法 身份验证方法 - SSL/TLS(如果可能的话) - SSL/TLS(总是) - STARTTLS(如果可能的话) - STARTTLS(总是) 当我删除邮件时 不要从服务器上删除 diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 3eb6532b3..ce35a86ad 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -361,10 +361,6 @@ 加密類型 身份驗證類型 - SSL/TLS(如果可用) - SSL/TLS(預設) - STARTTLS(如果可用) - STARTTLS(預設) 當我刪除郵件時 不要從伺服器上刪除 diff --git a/res/values/strings.xml b/res/values/strings.xml index 5a1c8103c..21962c369 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -399,10 +399,8 @@ Please submit bug reports, contribute new features and ask questions at Security Authentication None - SSL/TLS (if available) - SSL/TLS (always) - STARTTLS (if available) - STARTTLS (always) + SSL/TLS + STARTTLS When I delete a message Do not delete on server diff --git a/res/xml/providers.xml b/res/xml/providers.xml index 9ecbda571..ef28ec7c4 100644 --- a/res/xml/providers.xml +++ b/res/xml/providers.xml @@ -36,16 +36,12 @@ Valid incoming uri schemes are: imap IMAP with no transport security. - imap+tls IMAP with optional TLS transport security. - If TLS is not available the connection is made as "imap" imap+tls+ IMAP with required TLS transport security. If TLS is not available the conneciton fails. imap+ssl+ IMAP with required SSL transport security. If SSL is not available the connection fails. pop3 POP3 with no transport security. - pop3+tls POP3 with optional TLS transport security. - If TLS is not available the connection is made as "pop3" pop3+tls+ POP3 with required TLS transport security. If TLS is not available the conneciton fails. pop3+ssl+ POP3 with required SSL transport security. @@ -53,8 +49,6 @@ Valid outgoing uri schemes are: smtp SMTP with no transport security. - smtp+tls SMTP with optional TLS transport security. - If TLS is not available the connection is made as "smtp" smtp+tls+ SMTP with required TLS transport security. If TLS is not available the conneciton fails. smtp+ssl+ SMTP with required SSL transport security. @@ -127,8 +121,8 @@ - - + + @@ -154,10 +148,9 @@ - - - + + @@ -296,12 +289,12 @@ - - + + - - + + @@ -323,28 +316,18 @@ - - + + - - + + - - - - - - - - - - + + @@ -538,11 +521,11 @@ - - + + - - + + diff --git a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java index f05376499..9cd7243e3 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupIncoming.java @@ -327,7 +327,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener case NONE: port = mDefaultPort; break; - case STARTTLS_OPTIONAL: case STARTTLS_REQUIRED: if (WebDavStore.STORE_TYPE.equals(mStoreType)) { /* @@ -340,7 +339,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener port = mDefaultPort; } break; - case SSL_TLS_OPTIONAL: case SSL_TLS_REQUIRED: port = mDefaultSslPort; break; @@ -354,7 +352,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener private void updateAuthPlainTextFromSecurityType(ConnectionSecurity securityType) { switch (securityType) { case NONE: - case STARTTLS_OPTIONAL: AuthType.PLAIN.useInsecureText(true, mAuthTypeAdapter); break; default: diff --git a/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java index bb77aef11..7aadd43fd 100644 --- a/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java +++ b/src/com/fsck/k9/activity/setup/AccountSetupOutgoing.java @@ -235,11 +235,9 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, String port; switch (securityType) { case NONE: - case STARTTLS_OPTIONAL: case STARTTLS_REQUIRED: port = SMTP_PORT; break; - case SSL_TLS_OPTIONAL: case SSL_TLS_REQUIRED: port = SMTP_SSL_PORT; break; @@ -253,7 +251,6 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener, private void updateAuthPlainTextFromSecurityType(ConnectionSecurity securityType) { switch (securityType) { case NONE: - case STARTTLS_OPTIONAL: AuthType.PLAIN.useInsecureText(true, mAuthTypeAdapter); break; default: diff --git a/src/com/fsck/k9/mail/ConnectionSecurity.java b/src/com/fsck/k9/mail/ConnectionSecurity.java index 42ba3ee1a..510eda039 100644 --- a/src/com/fsck/k9/mail/ConnectionSecurity.java +++ b/src/com/fsck/k9/mail/ConnectionSecurity.java @@ -5,9 +5,7 @@ import com.fsck.k9.R; public enum ConnectionSecurity { NONE(R.string.account_setup_incoming_security_none_label), - STARTTLS_OPTIONAL(R.string.account_setup_incoming_security_tls_optional_label), STARTTLS_REQUIRED(R.string.account_setup_incoming_security_tls_label), - SSL_TLS_OPTIONAL(R.string.account_setup_incoming_security_ssl_optional_label), SSL_TLS_REQUIRED(R.string.account_setup_incoming_security_ssl_label); private final int mResourceId; diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 62b22b604..d52add785 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -146,11 +146,9 @@ public class ImapStore extends Store { * *

Possible forms:

*
-     * imap://auth:user:password@server:port CONNECTION_SECURITY_NONE
-     * imap+tls://auth:user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
-     * imap+tls+://auth:user:password@server:port CONNECTION_SECURITY_TLS_REQUIRED
-     * imap+ssl+://auth:user:password@server:port CONNECTION_SECURITY_SSL_REQUIRED
-     * imap+ssl://auth:user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
+     * imap://auth:user:password@server:port ConnectionSecurity.NONE
+     * imap+tls+://auth:user:password@server:port ConnectionSecurity.STARTTLS_REQUIRED
+     * imap+ssl+://auth:user:password@server:port ConnectionSecurity.SSL_TLS_REQUIRED
      * 
*/ public static ImapStoreSettings decodeUri(String uri) { @@ -171,21 +169,27 @@ public class ImapStore extends Store { } String scheme = imapUri.getScheme(); + /* + * Currently available schemes are: + * imap + * imap+tls+ + * imap+ssl+ + * + * The following are obsolete schemes that may be found in pre-existing + * settings from earlier versions or that may be found when imported. We + * continue to recognize them and re-map them appropriately: + * imap+tls + * imap+ssl + */ if (scheme.equals("imap")) { connectionSecurity = ConnectionSecurity.NONE; port = 143; - } else if (scheme.equals("imap+tls")) { - connectionSecurity = ConnectionSecurity.STARTTLS_OPTIONAL; - port = 143; - } else if (scheme.equals("imap+tls+")) { + } else if (scheme.startsWith("imap+tls")) { connectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED; port = 143; - } else if (scheme.equals("imap+ssl+")) { + } else if (scheme.startsWith("imap+ssl")) { connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED; port = 993; - } else if (scheme.equals("imap+ssl")) { - connectionSecurity = ConnectionSecurity.SSL_TLS_OPTIONAL; - port = 993; } else { throw new IllegalArgumentException("Unsupported protocol (" + scheme + ")"); } @@ -267,15 +271,9 @@ public class ImapStore extends Store { String scheme; switch (server.connectionSecurity) { - case SSL_TLS_OPTIONAL: - scheme = "imap+ssl"; - break; case SSL_TLS_REQUIRED: scheme = "imap+ssl+"; break; - case STARTTLS_OPTIONAL: - scheme = "imap+tls"; - break; case STARTTLS_REQUIRED: scheme = "imap+tls+"; break; @@ -2420,15 +2418,13 @@ public class ImapStore extends Store { SocketAddress socketAddress = new InetSocketAddress(addresses[i], mSettings.getPort()); - if (connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED || - connectionSecurity == ConnectionSecurity.SSL_TLS_OPTIONAL) { + if (connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) { SSLContext sslContext = SSLContext.getInstance("TLS"); - boolean secure = connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED; sslContext .init(null, new TrustManager[] { TrustManagerFactory.get( mSettings.getHost(), - mSettings.getPort(), secure) }, + mSettings.getPort(), true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext); } else { @@ -2473,19 +2469,17 @@ public class ImapStore extends Store { } } - if (mSettings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_OPTIONAL - || mSettings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_REQUIRED) { + if (mSettings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_REQUIRED) { if (hasCapability("STARTTLS")) { // STARTTLS executeSimpleCommand("STARTTLS"); SSLContext sslContext = SSLContext.getInstance("TLS"); - boolean secure = mSettings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_REQUIRED; sslContext.init(null, new TrustManager[] { TrustManagerFactory.get( mSettings.getHost(), - mSettings.getPort(), secure) }, + mSettings.getPort(), true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext, mSocket, mSettings.getHost(), mSettings.getPort(), true); @@ -2502,7 +2496,7 @@ public class ImapStore extends Store { if (responses.size() != 2) { throw new MessagingException("Invalid CAPABILITY response received"); } - } else if (mSettings.getConnectionSecurity() == ConnectionSecurity.STARTTLS_REQUIRED) { + } else { throw new MessagingException("TLS not supported but required"); } } diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 8acc7e079..e59cbb4ed 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -62,11 +62,9 @@ public class Pop3Store extends Store { * *

Possible forms:

*
-     * pop3://user:password@server:port CONNECTION_SECURITY_NONE
-     * pop3+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
-     * pop3+tls+://user:password@server:port CONNECTION_SECURITY_TLS_REQUIRED
-     * pop3+ssl+://user:password@server:port CONNECTION_SECURITY_SSL_REQUIRED
-     * pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
+     * pop3://user:password@server:port ConnectionSecurity.NONE
+     * pop3+tls+://user:password@server:port ConnectionSecurity.STARTTLS_REQUIRED
+     * pop3+ssl+://user:password@server:port ConnectionSecurity.SSL_TLS_REQUIRED
      * 
*/ public static ServerSettings decodeUri(String uri) { @@ -84,21 +82,27 @@ public class Pop3Store extends Store { } String scheme = pop3Uri.getScheme(); + /* + * Currently available schemes are: + * pop3 + * pop3+tls+ + * pop3+ssl+ + * + * The following are obsolete schemes that may be found in pre-existing + * settings from earlier versions or that may be found when imported. We + * continue to recognize them and re-map them appropriately: + * pop3+tls + * pop3+ssl + */ if (scheme.equals("pop3")) { connectionSecurity = ConnectionSecurity.NONE; port = 110; - } else if (scheme.equals("pop3+tls")) { - connectionSecurity = ConnectionSecurity.STARTTLS_OPTIONAL; - port = 110; - } else if (scheme.equals("pop3+tls+")) { + } else if (scheme.startsWith("pop3+tls")) { connectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED; port = 110; - } else if (scheme.equals("pop3+ssl+")) { + } else if (scheme.startsWith("pop3+ssl")) { connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED; port = 995; - } else if (scheme.equals("pop3+ssl")) { - connectionSecurity = ConnectionSecurity.SSL_TLS_OPTIONAL; - port = 995; } else { throw new IllegalArgumentException("Unsupported protocol (" + scheme + ")"); } @@ -161,15 +165,9 @@ public class Pop3Store extends Store { String scheme; switch (server.connectionSecurity) { - case SSL_TLS_OPTIONAL: - scheme = "pop3+ssl"; - break; case SSL_TLS_REQUIRED: scheme = "pop3+ssl+"; break; - case STARTTLS_OPTIONAL: - scheme = "pop3+tls"; - break; case STARTTLS_REQUIRED: scheme = "pop3+tls+"; break; @@ -299,13 +297,11 @@ public class Pop3Store extends Store { try { SocketAddress socketAddress = new InetSocketAddress(mHost, mPort); - if (mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED || - mConnectionSecurity == ConnectionSecurity.SSL_TLS_OPTIONAL) { + if (mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) { SSLContext sslContext = SSLContext.getInstance("TLS"); - final boolean secure = mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED; sslContext.init(null, new TrustManager[] { TrustManagerFactory.get(mHost, - mPort, secure) }, new SecureRandom()); + mPort, true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext); } else { mSocket = new Socket(); @@ -323,17 +319,15 @@ public class Pop3Store extends Store { String serverGreeting = executeSimpleCommand(null); mCapabilities = getCapabilities(); - if (mConnectionSecurity == ConnectionSecurity.STARTTLS_OPTIONAL - || mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { + if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { if (mCapabilities.stls) { executeSimpleCommand(STLS_COMMAND); SSLContext sslContext = SSLContext.getInstance("TLS"); - boolean secure = mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED; sslContext.init(null, new TrustManager[] { TrustManagerFactory.get( - mHost, mPort, secure) }, + mHost, mPort, true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext, mSocket, mHost, mPort, true); @@ -344,7 +338,7 @@ public class Pop3Store extends Store { throw new MessagingException("Unable to connect socket"); } mCapabilities = getCapabilities(); - } else if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { + } else { throw new MessagingException("TLS not supported but required"); } } diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index b0af15ef2..2e11e6c8f 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -82,11 +82,9 @@ public class WebDavStore extends Store { * *

Possible forms:

*
-     * webdav://user:password@server:port CONNECTION_SECURITY_NONE
-     * webdav+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
-     * webdav+tls+://user:password@server:port CONNECTION_SECURITY_TLS_REQUIRED
-     * webdav+ssl+://user:password@server:port CONNECTION_SECURITY_SSL_REQUIRED
-     * webdav+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
+     * webdav://user:password@server:port ConnectionSecurity.NONE
+     * webdav+tls+://user:password@server:port ConnectionSecurity.STARTTLS_REQUIRED
+     * webdav+ssl+://user:password@server:port ConnectionSecurity.SSL_TLS_REQUIRED
      * 
*/ public static WebDavStoreSettings decodeUri(String uri) { @@ -109,15 +107,23 @@ public class WebDavStore extends Store { } String scheme = webDavUri.getScheme(); + /* + * Currently available schemes are: + * webdav + * webdav+tls+ + * webdav+ssl+ + * + * The following are obsolete schemes that may be found in pre-existing + * settings from earlier versions or that may be found when imported. We + * continue to recognize them and re-map them appropriately: + * webdav+tls + * webdav+ssl + */ if (scheme.equals("webdav")) { connectionSecurity = ConnectionSecurity.NONE; - } else if (scheme.equals("webdav+ssl")) { - connectionSecurity = ConnectionSecurity.SSL_TLS_OPTIONAL; - } else if (scheme.equals("webdav+ssl+")) { + } else if (scheme.startsWith("webdav+ssl")) { connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED; - } else if (scheme.equals("webdav+tls")) { - connectionSecurity = ConnectionSecurity.STARTTLS_OPTIONAL; - } else if (scheme.equals("webdav+tls+")) { + } else if (scheme.startsWith("webdav+tls")) { connectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED; } else { throw new IllegalArgumentException("Unsupported protocol (" + scheme + ")"); @@ -203,15 +209,9 @@ public class WebDavStore extends Store { String scheme; switch (server.connectionSecurity) { - case SSL_TLS_OPTIONAL: - scheme = "webdav+ssl"; - break; case SSL_TLS_REQUIRED: scheme = "webdav+ssl+"; break; - case STARTTLS_OPTIONAL: - scheme = "webdav+tls"; - break; case STARTTLS_REQUIRED: scheme = "webdav+tls+"; break; @@ -367,9 +367,7 @@ public class WebDavStore extends Store { private String getRoot() { String root; if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED || - mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED || - mConnectionSecurity == ConnectionSecurity.STARTTLS_OPTIONAL || - mConnectionSecurity == ConnectionSecurity.SSL_TLS_OPTIONAL) { + mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) { root = "https"; } else { root = "http"; diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index 9c8142b4c..6f96fe430 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -38,11 +38,9 @@ public class SmtpTransport extends Transport { * *

Possible forms:

*
-     * smtp://user:password@server:port CONNECTION_SECURITY_NONE
-     * smtp+tls://user:password@server:port CONNECTION_SECURITY_TLS_OPTIONAL
-     * smtp+tls+://user:password@server:port CONNECTION_SECURITY_TLS_REQUIRED
-     * smtp+ssl+://user:password@server:port CONNECTION_SECURITY_SSL_REQUIRED
-     * smtp+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
+     * smtp://user:password@server:port ConnectionSecurity.NONE
+     * smtp+tls+://user:password@server:port ConnectionSecurity.STARTTLS_REQUIRED
+     * smtp+ssl+://user:password@server:port ConnectionSecurity.SSL_TLS_REQUIRED
      * 
*/ public static ServerSettings decodeUri(String uri) { @@ -61,21 +59,27 @@ public class SmtpTransport extends Transport { } String scheme = smtpUri.getScheme(); + /* + * Currently available schemes are: + * smtp + * smtp+tls+ + * smtp+ssl+ + * + * The following are obsolete schemes that may be found in pre-existing + * settings from earlier versions or that may be found when imported. We + * continue to recognize them and re-map them appropriately: + * smtp+tls + * smtp+ssl + */ if (scheme.equals("smtp")) { connectionSecurity = ConnectionSecurity.NONE; port = 587; - } else if (scheme.equals("smtp+tls")) { - connectionSecurity = ConnectionSecurity.STARTTLS_OPTIONAL; - port = 587; - } else if (scheme.equals("smtp+tls+")) { + } else if (scheme.startsWith("smtp+tls")) { connectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED; port = 587; - } else if (scheme.equals("smtp+ssl+")) { + } else if (scheme.startsWith("smtp+ssl")) { connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED; port = 465; - } else if (scheme.equals("smtp+ssl")) { - connectionSecurity = ConnectionSecurity.SSL_TLS_OPTIONAL; - port = 465; } else { throw new IllegalArgumentException("Unsupported protocol (" + scheme + ")"); } @@ -132,15 +136,9 @@ public class SmtpTransport extends Transport { String scheme; switch (server.connectionSecurity) { - case SSL_TLS_OPTIONAL: - scheme = "smtp+ssl"; - break; case SSL_TLS_REQUIRED: scheme = "smtp+ssl+"; break; - case STARTTLS_OPTIONAL: - scheme = "smtp+tls"; - break; case STARTTLS_REQUIRED: scheme = "smtp+tls+"; break; @@ -202,13 +200,11 @@ public class SmtpTransport extends Transport { for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], mPort); - if (mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED || - mConnectionSecurity == ConnectionSecurity.SSL_TLS_OPTIONAL) { + if (mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) { SSLContext sslContext = SSLContext.getInstance("TLS"); - boolean secure = mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED; sslContext.init(null, new TrustManager[] { TrustManagerFactory.get( - mHost, mPort, secure) }, + mHost, mPort, true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext); mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT); @@ -260,16 +256,14 @@ public class SmtpTransport extends Transport { m8bitEncodingAllowed = extensions.containsKey("8BITMIME"); - if (mConnectionSecurity == ConnectionSecurity.STARTTLS_OPTIONAL - || mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { + if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { if (extensions.containsKey("STARTTLS")) { executeSimpleCommand("STARTTLS"); SSLContext sslContext = SSLContext.getInstance("TLS"); - boolean secure = mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED; sslContext.init(null, new TrustManager[] { TrustManagerFactory.get(mHost, - mPort, secure) }, new SecureRandom()); + mPort, true) }, new SecureRandom()); mSocket = TrustedSocketFactory.createSocket(sslContext, mSocket, mHost, mPort, true); mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), @@ -281,7 +275,7 @@ public class SmtpTransport extends Transport { */ extensions = sendHello(localHost); secureConnection = true; - } else if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED) { + } else { throw new MessagingException("TLS not supported but required"); } }