mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
fix 249240 add pref to disable logon_fallback for pop3, and handle other authentication problems, patch by me and ch.ey@gmx.net, r=me and ch.ey@gmx.net, sr=mscott
This commit is contained in:
parent
c154911697
commit
58def2143c
@ -56,7 +56,7 @@ interface nsIUrlListener;
|
||||
* often you will want to add extra interfaces that give you server-specific
|
||||
* attributes and methods.
|
||||
*/
|
||||
[scriptable, uuid(55569286-ee09-45ec-a83b-96d0273a5ed8)]
|
||||
[scriptable, uuid(dc2f06f9-0ee8-47ad-901e-168d14323576)]
|
||||
interface nsIMsgIncomingServer : nsISupports {
|
||||
|
||||
/**
|
||||
@ -178,6 +178,11 @@ interface nsIMsgIncomingServer : nsISupports {
|
||||
/* should we use secure authentication? */
|
||||
attribute boolean useSecAuth;
|
||||
|
||||
/* if a logon mechanism fails, should we fallback to a different
|
||||
mechanism?
|
||||
*/
|
||||
attribute boolean logonFallback;
|
||||
|
||||
/* can server support a secure channel? */
|
||||
readonly attribute boolean isSecureServer;
|
||||
|
||||
|
@ -1727,6 +1727,7 @@ NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Username, "userName")
|
||||
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, PrefPassword, "password")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, IsSecure, "isSecure")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, UseSecAuth, "useSecAuth")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LogonFallback, "logon_fallback");
|
||||
NS_IMPL_SERVERPREF_INT(nsMsgIncomingServer, BiffMinutes, "check_time")
|
||||
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Type, "type")
|
||||
// in 4.x, this was "mail.pop3_gets_new_mail" for pop and
|
||||
|
@ -76,7 +76,7 @@ nsresult
|
||||
nsMovemailIncomingServer::GetLocalStoreType(char **type)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(type);
|
||||
*type = nsCRT::strdup("mailbox");
|
||||
*type = strdup("mailbox");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -705,10 +705,12 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
|
||||
nsXPIDLString passwordTemplate;
|
||||
// if the last prompt got us a bad password then show a special dialog
|
||||
if (TestFlag(POP3_PASSWORD_FAILED))
|
||||
{
|
||||
// if we haven't successfully logged onto the server in this session,
|
||||
{
|
||||
// if we haven't successfully logged onto the server in this session
|
||||
// and tried at least twice or if the server threw the specific error,
|
||||
// forget the password.
|
||||
if (!isAuthenticated && m_pop3ConData->logonFailureCount > 1)
|
||||
if ((!isAuthenticated && m_pop3ConData->logonFailureCount > 1) ||
|
||||
TestFlag(POP3_AUTH_FAILURE))
|
||||
rv = server->ForgetPassword();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mStringService->GetStringByID(POP3_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC, getter_Copies(passwordTemplate));
|
||||
@ -733,7 +735,7 @@ nsresult nsPop3Protocol::GetPassword(char ** aPassword, PRBool *okayValue)
|
||||
nsTextFormatter::smprintf_free(passwordPromptString);
|
||||
}
|
||||
|
||||
ClearFlag(POP3_PASSWORD_FAILED);
|
||||
ClearFlag(POP3_PASSWORD_FAILED|POP3_AUTH_FAILURE);
|
||||
if (NS_FAILED(rv))
|
||||
m_pop3ConData->next_state = POP3_ERROR_DONE;
|
||||
} // if we have a server
|
||||
@ -982,13 +984,14 @@ nsPop3Protocol::WaitForResponse(nsIInputStream* inputStream, PRUint32 length)
|
||||
|
||||
if(pauseForMoreData || !line)
|
||||
{
|
||||
m_pop3ConData->pause_for_read = PR_TRUE; /* don't pause */
|
||||
m_pop3ConData->pause_for_read = PR_TRUE; /* pause */
|
||||
|
||||
PR_Free(line);
|
||||
return(ln);
|
||||
}
|
||||
|
||||
|
||||
PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
|
||||
|
||||
|
||||
if(*line == '+')
|
||||
{
|
||||
m_pop3ConData->command_succeeded = PR_TRUE;
|
||||
@ -1383,7 +1386,15 @@ PRInt32 nsPop3Protocol::AuthFallback()
|
||||
? POP3_PASSWORD_FAILURE : POP3_USERNAME_FAILURE));
|
||||
|
||||
// response code received shows that server is certain about the
|
||||
// credential was wrong -> no fallback, show alert and pw dialog
|
||||
// credential was wrong, or fallback has been disabled by pref
|
||||
// -> no fallback, show alert and pw dialog
|
||||
PRBool logonFallback = PR_TRUE;
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
|
||||
if (server)
|
||||
server->GetLogonFallback(&logonFallback);
|
||||
if (!logonFallback)
|
||||
SetFlag(POP3_AUTH_FAILURE);
|
||||
|
||||
if (TestFlag(POP3_AUTH_FAILURE))
|
||||
{
|
||||
Error((m_password_already_sent)
|
||||
|
@ -389,6 +389,7 @@ pref("mail.server.default.login_at_startup", false);
|
||||
pref("mail.server.default.allows_specialfolders_usage", true);
|
||||
pref("mail.server.default.canCreateFolders", true);
|
||||
pref("mail.server.default.canFileMessages", true);
|
||||
pref("mail.server.default.logon_fallback", true);
|
||||
|
||||
// special enhancements for IMAP servers
|
||||
pref("mail.server.default.store_read_mail_in_pfc", false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user