mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Eliminate WebDAV STARTTLS security choice
STARTTLS doesn't really apply to WebDAV and should never have been made available as an option. Pre-existing settings will be re-mapped to SSL/TLS.
This commit is contained in:
parent
14a0a7a2a7
commit
9dc5338501
@ -68,6 +68,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
private ArrayAdapter<AuthType> mAuthTypeAdapter;
|
||||
private String mDefaultPort = "";
|
||||
private String mDefaultSslPort = "";
|
||||
private ConnectionSecurity[] mConnectionSecurityChoices = ConnectionSecurity.values();
|
||||
|
||||
public static void actionIncomingSettings(Activity context, Account account, boolean makeDefault) {
|
||||
Intent i = new Intent(context, AccountSetupIncoming.class);
|
||||
@ -124,11 +125,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
}
|
||||
});
|
||||
|
||||
ArrayAdapter<ConnectionSecurity> securityTypesAdapter = new ArrayAdapter<ConnectionSecurity>(this,
|
||||
android.R.layout.simple_spinner_item, ConnectionSecurity.values());
|
||||
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||
|
||||
mAuthTypeAdapter = AuthType.getArrayAdapter(this);
|
||||
mAuthTypeView.setAdapter(mAuthTypeAdapter);
|
||||
|
||||
@ -189,9 +185,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
int position = mAuthTypeAdapter.getPosition(settings.authenticationType);
|
||||
mAuthTypeView.setSelection(position, false);
|
||||
|
||||
// Select currently configured security type
|
||||
mSecurityTypeView.setSelection(settings.connectionSecurity.ordinal(), false);
|
||||
|
||||
mStoreType = settings.type;
|
||||
if (Pop3Store.STORE_TYPE.equals(settings.type)) {
|
||||
serverLabelView.setText(R.string.account_setup_incoming_pop_server_label);
|
||||
@ -231,6 +224,9 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
serverLabelView.setText(R.string.account_setup_incoming_webdav_server_label);
|
||||
mDefaultPort = WEBDAV_PORT;
|
||||
mDefaultSslPort = WEBDAV_SSL_PORT;
|
||||
mConnectionSecurityChoices = new ConnectionSecurity[] {
|
||||
ConnectionSecurity.NONE,
|
||||
ConnectionSecurity.SSL_TLS_REQUIRED };
|
||||
|
||||
// Hide the unnecessary fields
|
||||
findViewById(R.id.imap_path_prefix_section).setVisibility(View.GONE);
|
||||
@ -258,6 +254,14 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
throw new Exception("Unknown account type: " + mAccount.getStoreUri());
|
||||
}
|
||||
|
||||
ArrayAdapter<ConnectionSecurity> securityTypesAdapter = new ArrayAdapter<ConnectionSecurity>(this,
|
||||
android.R.layout.simple_spinner_item, mConnectionSecurityChoices);
|
||||
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||
|
||||
// Select currently configured security type
|
||||
mSecurityTypeView.setSelection(settings.connectionSecurity.ordinal(), false);
|
||||
|
||||
/*
|
||||
* Updates the port when the user changes the security type. This allows
|
||||
* us to show a reasonable default which the user can change.
|
||||
@ -325,19 +329,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
||||
String port;
|
||||
switch (securityType) {
|
||||
case NONE:
|
||||
port = mDefaultPort;
|
||||
break;
|
||||
case STARTTLS_REQUIRED:
|
||||
if (WebDavStore.STORE_TYPE.equals(mStoreType)) {
|
||||
/*
|
||||
* The concept of STARTTLS is not really applicable for WebDav and should never
|
||||
* have been made a user-selectable option. But now we must support the setting
|
||||
* if it exists.
|
||||
*/
|
||||
port = mDefaultSslPort;
|
||||
} else {
|
||||
port = mDefaultPort;
|
||||
}
|
||||
port = mDefaultPort;
|
||||
break;
|
||||
case SSL_TLS_REQUIRED:
|
||||
port = mDefaultSslPort;
|
||||
|
@ -83,7 +83,6 @@ public class WebDavStore extends Store {
|
||||
* <p>Possible forms:</p>
|
||||
* <pre>
|
||||
* 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
|
||||
* </pre>
|
||||
*/
|
||||
@ -110,21 +109,19 @@ public class WebDavStore extends Store {
|
||||
/*
|
||||
* 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+tls+
|
||||
* webdav+ssl
|
||||
*/
|
||||
if (scheme.equals("webdav")) {
|
||||
connectionSecurity = ConnectionSecurity.NONE;
|
||||
} else if (scheme.startsWith("webdav+ssl")) {
|
||||
} else if (scheme.startsWith("webdav+")) {
|
||||
connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED;
|
||||
} else if (scheme.startsWith("webdav+tls")) {
|
||||
connectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported protocol (" + scheme + ")");
|
||||
}
|
||||
@ -212,9 +209,6 @@ public class WebDavStore extends Store {
|
||||
case SSL_TLS_REQUIRED:
|
||||
scheme = "webdav+ssl+";
|
||||
break;
|
||||
case STARTTLS_REQUIRED:
|
||||
scheme = "webdav+tls+";
|
||||
break;
|
||||
default:
|
||||
case NONE:
|
||||
scheme = "webdav";
|
||||
@ -366,8 +360,7 @@ public class WebDavStore extends Store {
|
||||
|
||||
private String getRoot() {
|
||||
String root;
|
||||
if (mConnectionSecurity == ConnectionSecurity.STARTTLS_REQUIRED ||
|
||||
mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) {
|
||||
if (mConnectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) {
|
||||
root = "https";
|
||||
} else {
|
||||
root = "http";
|
||||
|
Loading…
Reference in New Issue
Block a user