diff --git a/mailnews/base/public/nsIMsgIncomingServer.idl b/mailnews/base/public/nsIMsgIncomingServer.idl index 3114e3a215cf..dadfc27e1b55 100644 --- a/mailnews/base/public/nsIMsgIncomingServer.idl +++ b/mailnews/base/public/nsIMsgIncomingServer.idl @@ -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; diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index a8a76b9baafe..e2fcf88ab6f2 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -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 diff --git a/mailnews/local/src/nsMovemailIncomingServer.cpp b/mailnews/local/src/nsMovemailIncomingServer.cpp index 3b9f699a08e1..3d24d1c9b91f 100644 --- a/mailnews/local/src/nsMovemailIncomingServer.cpp +++ b/mailnews/local/src/nsMovemailIncomingServer.cpp @@ -76,7 +76,7 @@ nsresult nsMovemailIncomingServer::GetLocalStoreType(char **type) { NS_ENSURE_ARG_POINTER(type); - *type = nsCRT::strdup("mailbox"); + *type = strdup("mailbox"); return NS_OK; } diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp index 4db6e50df22b..da3c9b5c8d3b 100644 --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -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 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) diff --git a/mailnews/mailnews.js b/mailnews/mailnews.js index dacea380a1ad..b15b0c596e55 100644 --- a/mailnews/mailnews.js +++ b/mailnews/mailnews.js @@ -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);