mirror of
https://github.com/moparisthebest/k-9
synced 2025-03-02 01:21:45 -05:00
Eliminate the LOGIN authentication option from SMTP
The LOGIN option is no longer offered to users as a choice. This does *not* eliminate the SASL LOGIN authentication mechanism. Any pre-existing LOGIN setting or any imported LOGIN setting will still be recognized. In all cases, a user setting of either "Normal password" or "LOGIN" will result in the SASL PLAIN mechanism being tried first if available, otherwise SASL LOGIN will be tried if available. This mirrors similar behavior that exists for IMAP.
This commit is contained in:
parent
dc9720ca13
commit
90fedf7125
src/com/fsck/k9
@ -56,6 +56,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
||||
private ViewGroup mRequireLoginSettingsView;
|
||||
private Spinner mSecurityTypeView;
|
||||
private Spinner mAuthTypeView;
|
||||
private ArrayAdapter<AuthType> mAuthTypeAdapter;
|
||||
private Button mNextButton;
|
||||
private Account mAccount;
|
||||
private boolean mMakeDefault;
|
||||
@ -125,10 +126,11 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
||||
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mSecurityTypeView.setAdapter(securityTypesAdapter);
|
||||
|
||||
ArrayAdapter<AuthType> authTypesAdapter = new ArrayAdapter<AuthType>(this,
|
||||
android.R.layout.simple_spinner_item, AuthType.values());
|
||||
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mAuthTypeView.setAdapter(authTypesAdapter);
|
||||
AuthType[] acceptableAuthTypes = {AuthType.AUTOMATIC, AuthType.PLAIN, AuthType.CRAM_MD5};
|
||||
mAuthTypeAdapter = new ArrayAdapter<AuthType>(this,
|
||||
android.R.layout.simple_spinner_item, acceptableAuthTypes);
|
||||
mAuthTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mAuthTypeView.setAdapter(mAuthTypeAdapter);
|
||||
|
||||
/*
|
||||
* Calls validateFields() which enables or disables the Next button
|
||||
@ -196,7 +198,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
if (authType != null) {
|
||||
int position = AuthType.valueOf(authType).ordinal();
|
||||
int position = mAuthTypeAdapter.getPosition(AuthType.valueOf(authType));
|
||||
mAuthTypeView.setSelection(position, false);
|
||||
}
|
||||
|
||||
|
@ -305,12 +305,11 @@ public class SmtpTransport extends Transport {
|
||||
}
|
||||
}
|
||||
|
||||
boolean useAuthLogin = AuthType.LOGIN.equals(mAuthType);
|
||||
boolean useAuthPlain = AuthType.PLAIN.equals(mAuthType);
|
||||
boolean useAuthPlain = AuthType.PLAIN.equals(mAuthType) || AuthType.LOGIN.equals(mAuthType);
|
||||
boolean useAuthCramMD5 = AuthType.CRAM_MD5.equals(mAuthType);
|
||||
|
||||
// Automatically choose best authentication method if none was explicitly selected
|
||||
boolean useAutomaticAuth = !(useAuthLogin || useAuthPlain || useAuthCramMD5);
|
||||
boolean useAutomaticAuth = !(useAuthPlain || useAuthCramMD5);
|
||||
|
||||
boolean authLoginSupported = false;
|
||||
boolean authPlainSupported = false;
|
||||
@ -360,11 +359,7 @@ public class SmtpTransport extends Transport {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
} else if (useAuthLogin || (useAutomaticAuth && authLoginSupported)) {
|
||||
if (!authPlainSupported && K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP) {
|
||||
Log.d(K9.LOG_TAG, "Using LOGIN as authentication method although the " +
|
||||
"server didn't advertise support for it in EHLO response.");
|
||||
}
|
||||
} else if (useAutomaticAuth && authLoginSupported) {
|
||||
saslAuthLogin(mUsername, mPassword);
|
||||
} else {
|
||||
throw new MessagingException("No valid authentication mechanism found.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user