Second part of bug 413721 - the (AOL/Netscape) redirection type code is
not used and should be removed r+sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@247425 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
86a0728370
commit
0f1f89f8bb
@ -235,7 +235,6 @@ NS_IMPL_ADDREF_INHERITED(nsSmtpProtocol, nsMsgAsyncWriteProtocol)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSmtpProtocol, nsMsgAsyncWriteProtocol)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSmtpProtocol)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMsgLogonRedirectionRequester)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMsgAsyncWriteProtocol)
|
||||
|
||||
nsSmtpProtocol::nsSmtpProtocol(nsIURI * aURL)
|
||||
@ -323,12 +322,6 @@ void nsSmtpProtocol::Initialize(nsIURI * aURL)
|
||||
smtpServer->GetHelloArgument(getter_Copies(m_helloArgument));
|
||||
}
|
||||
|
||||
rv = RequestOverrideInfo(smtpServer);
|
||||
// if we aren't waiting for a login override, then go ahead an
|
||||
// open the network connection like we normally would have.
|
||||
if (NS_SUCCEEDED(rv) && TestFlag(SMTP_WAIT_FOR_REDIRECTION))
|
||||
return;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
nsCAutoString hostName;
|
||||
aURL->GetAsciiHost(hostName);
|
||||
@ -1041,9 +1034,8 @@ PRInt32 nsSmtpProtocol::AuthLoginResponse(nsIInputStream * stream, PRUint32 leng
|
||||
// if LOGIN enabled, clear it if we failed.
|
||||
ClearFlag(SMTP_AUTH_LOGIN_ENABLED);
|
||||
|
||||
// Only forget the password if we didn't get here from the redirection
|
||||
// and if we've no mechanism left.
|
||||
if (!TestFlag(SMTP_AUTH_ANY_ENABLED) && mLogonCookie.IsEmpty())
|
||||
// Only forget the password if we've no mechanism left.
|
||||
if (!TestFlag(SMTP_AUTH_ANY_ENABLED))
|
||||
{
|
||||
smtpServer->ForgetPassword();
|
||||
if (m_usernamePrompted)
|
||||
@ -1173,17 +1165,13 @@ PRInt32 nsSmtpProtocol::AuthLoginStep1()
|
||||
if (username.IsEmpty() || password.IsEmpty())
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
}
|
||||
else if (!TestFlag(SMTP_USE_LOGIN_REDIRECTION))
|
||||
|
||||
GetPassword(getter_Copies(password));
|
||||
if (password.IsEmpty())
|
||||
{
|
||||
GetPassword(getter_Copies(password));
|
||||
if (password.IsEmpty())
|
||||
{
|
||||
m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
}
|
||||
m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
}
|
||||
else
|
||||
password.Assign(mLogonCookie);
|
||||
|
||||
if (TestFlag(SMTP_AUTH_CRAM_MD5_ENABLED))
|
||||
PR_snprintf(buffer, sizeof(buffer), "AUTH CRAM-MD5" CRLF);
|
||||
@ -1243,17 +1231,12 @@ PRInt32 nsSmtpProtocol::AuthLoginStep2()
|
||||
nsresult rv;
|
||||
nsCAutoString password;
|
||||
|
||||
if (!TestFlag(SMTP_USE_LOGIN_REDIRECTION))
|
||||
GetPassword(getter_Copies(password));
|
||||
if (password.IsEmpty())
|
||||
{
|
||||
GetPassword(getter_Copies(password));
|
||||
if (password.IsEmpty())
|
||||
{
|
||||
m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
}
|
||||
m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
|
||||
}
|
||||
else
|
||||
password.Assign(mLogonCookie);
|
||||
|
||||
if (!password.IsEmpty())
|
||||
{
|
||||
@ -1606,22 +1589,7 @@ PRInt32 nsSmtpProtocol::SendMessageResponse()
|
||||
|
||||
nsresult nsSmtpProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer )
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// if we are currently waiting for login redirection information
|
||||
// then hold off on loading the url....but be sure to remember
|
||||
// aConsumer so we can use it later...
|
||||
if (TestFlag(SMTP_WAIT_FOR_REDIRECTION))
|
||||
{
|
||||
// mark a pending load...
|
||||
SetFlag(SMTP_LOAD_URL_PENDING);
|
||||
mPendingConsumer = aConsumer;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
ClearFlag(SMTP_LOAD_URL_PENDING);
|
||||
|
||||
// otherwise begin loading the url
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 status = 0;
|
||||
m_continuationResponse = -1; /* init */
|
||||
@ -2024,111 +1992,3 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword)
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsSmtpProtocol::RequestOverrideInfo(nsISmtpServer * aSmtpServer)
|
||||
{
|
||||
// We don't have a redirection type - get out and proceed normally.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionError(const PRUnichar *pErrMsg, PRBool aBadPassword)
|
||||
{
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||
|
||||
NS_ENSURE_TRUE(smtpServer, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(m_logonRedirector, NS_ERROR_FAILURE);
|
||||
|
||||
m_logonRedirector = nsnull; // we don't care about it anymore
|
||||
|
||||
// step (1) alert the user about the error
|
||||
nsCOMPtr<nsIPrompt> dialog;
|
||||
if (m_runningURL && pErrMsg && pErrMsg[0])
|
||||
{
|
||||
m_runningURL->GetPrompt(getter_AddRefs(dialog));
|
||||
if (dialog)
|
||||
dialog->Alert(nsnull, pErrMsg);
|
||||
}
|
||||
|
||||
// step (2) if they entered a bad password, forget about it!
|
||||
if (aBadPassword && smtpServer)
|
||||
smtpServer->ForgetPassword();
|
||||
|
||||
// step (3) we need to let the originator of the send url request know that an
|
||||
// error occurred and we aren't sending the message...in our case, this will
|
||||
// force the user back into the compose window and they can try to send it
|
||||
// again.
|
||||
|
||||
// this will cause another dialog to get thrown up....
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(m_runningURL);
|
||||
mailNewsUrl->SetUrlState(PR_FALSE /* stopped running url */, NS_ERROR_COULD_NOT_LOGIN_TO_SMTP_SERVER);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* Logon Redirection Progress */
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionProgress(nsMsgLogonRedirectionState pState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* reply with logon redirection data. */
|
||||
NS_IMETHODIMP nsSmtpProtocol::OnLogonRedirectionReply(const PRUnichar * aHost, unsigned short aPort, const char * aCookieData, unsigned short aCookieSize)
|
||||
{
|
||||
NS_ENSURE_ARG(aHost);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
|
||||
NS_ENSURE_TRUE(smtpServer, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(m_logonRedirector, NS_ERROR_FAILURE);
|
||||
|
||||
// we used to logoff from the requestor but we don't want to do
|
||||
// that anymore in the success case. We want to end up caching the
|
||||
// external connection for the entire session.
|
||||
m_logonRedirector = nsnull; // we don't care about it anymore
|
||||
|
||||
// remember the logon cookie
|
||||
mLogonCookie.Assign(aCookieData, aCookieSize);
|
||||
|
||||
//currently the server isn't returning a valid auth logon capability
|
||||
// this line is just a HACK to force us to use auth login.
|
||||
SetFlag(SMTP_AUTH_LOGIN_ENABLED);
|
||||
// currently the account manager isn't properly setting the authMethod
|
||||
// preference for servers which require redirectors. This is another
|
||||
// HACK ALERT....we'll force it to be set...
|
||||
m_prefAuthMethod = PREF_AUTH_ANY;
|
||||
|
||||
// now that we have a host and port to connect to,
|
||||
// open up the channel...
|
||||
NS_ConvertUTF16toUTF8 hostUTF8(aHost);
|
||||
PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Connecting to: %s on port %d.", hostUTF8.get(), aPort));
|
||||
nsCOMPtr<nsIInterfaceRequestor> callbacks;
|
||||
nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(m_runningURL));
|
||||
if (smtpUrl)
|
||||
smtpUrl->GetNotificationCallbacks(getter_AddRefs(callbacks));
|
||||
|
||||
nsCOMPtr<nsIProxyInfo> proxyInfo;
|
||||
rv = NS_ExamineForProxy("mailto", hostUTF8.get(), aPort, getter_AddRefs(proxyInfo));
|
||||
if (NS_FAILED(rv)) proxyInfo = nsnull;
|
||||
|
||||
// pass in "ssl" for connectionType if you want this to be over SSL
|
||||
rv = OpenNetworkSocketWithInfo(hostUTF8.get(), aPort, nsnull /* connectionType */, proxyInfo, callbacks);
|
||||
|
||||
// we are no longer waiting for a logon redirection reply
|
||||
ClearFlag(SMTP_WAIT_FOR_REDIRECTION);
|
||||
|
||||
// check to see if we had a pending LoadUrl call...be sure to
|
||||
// do this after we clear the SMTP_WAIT_FOR_REDIRECTION flag =).
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(m_runningURL);
|
||||
if (TestFlag(SMTP_LOAD_URL_PENDING))
|
||||
rv = LoadUrl(url , mPendingConsumer);
|
||||
|
||||
mPendingConsumer = nsnull; // we don't need to remember this anymore...
|
||||
|
||||
// since we are starting this url load out of the normal loading process,
|
||||
// we probably should stop the url from running and throw up an error dialog
|
||||
// if for some reason we didn't successfully load the url...
|
||||
|
||||
// we may want to always return NS_OK regardless of an error
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsISmtpUrl.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsIMsgLogonRedirector.h"
|
||||
#include "nsMsgLineBuffer.h"
|
||||
#include "nsIAuthModule.h"
|
||||
|
||||
@ -88,20 +87,6 @@ SMTP_SEND_AUTH_GSSAPI_STEP // 25
|
||||
#define SMTP_EHLO_STARTTLS_ENABLED 0x00000008
|
||||
#define SMTP_EHLO_SIZE_ENABLED 0x00000010
|
||||
|
||||
// if we are using a login redirection
|
||||
// and we are waiting for it to give us the
|
||||
// host and port to connect to, then this flag
|
||||
// will be set...
|
||||
#define SMTP_WAIT_FOR_REDIRECTION 0x00000020
|
||||
// if we are using login redirection and we received a load Url
|
||||
// request while we were stil waiting for the redirection information
|
||||
// then we'll look in this field
|
||||
#define SMTP_LOAD_URL_PENDING 0x00000040
|
||||
// if we are using login redirection, then this flag will be set.
|
||||
// Note, this is different than the flag for whether we are waiting
|
||||
// for login redirection information.
|
||||
#define SMTP_USE_LOGIN_REDIRECTION 0x00000080
|
||||
|
||||
// insecure mechanisms follow
|
||||
#define SMTP_AUTH_LOGIN_ENABLED 0x00000100
|
||||
#define SMTP_AUTH_PLAIN_ENABLED 0x00000200
|
||||
@ -133,12 +118,10 @@ typedef enum _PrefTrySSL {
|
||||
PREF_SECURE_ALWAYS_SMTPS = 3
|
||||
} PrefTrySSL;
|
||||
|
||||
class nsSmtpProtocol : public nsMsgAsyncWriteProtocol,
|
||||
public nsIMsgLogonRedirectionRequester
|
||||
class nsSmtpProtocol : public nsMsgAsyncWriteProtocol
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIMSGLOGONREDIRECTIONREQUESTER
|
||||
|
||||
// Creating a protocol instance requires the URL which needs to be run.
|
||||
nsSmtpProtocol(nsIURI * aURL);
|
||||
@ -155,16 +138,10 @@ public:
|
||||
NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status);
|
||||
|
||||
private:
|
||||
// logon redirection related variables and methods
|
||||
nsresult RequestOverrideInfo(nsISmtpServer * aSmtpServer); // kicks off the request to get redirection info for the server
|
||||
nsCString mLogonCookie; // an opaque cookie we pass to certain servers to logon
|
||||
// if we are asked to load a url while we are blocked waiting for redirection information,
|
||||
// then we'll store the url consumer in mPendingConsumer until we can actually load
|
||||
// the url.
|
||||
nsCOMPtr<nsISupports> mPendingConsumer;
|
||||
// we cache the logon redirector in the short term so after we receive
|
||||
// the redirect information we can logoff the redirector...
|
||||
nsCOMPtr <nsIMsgLogonRedirector> m_logonRedirector;
|
||||
|
||||
// the nsISmtpURL that is currently running
|
||||
nsCOMPtr<nsISmtpUrl> m_runningURL;
|
||||
|
||||
@ -61,7 +61,6 @@ XPIDLSRCS = \
|
||||
nsIMailboxSpec.idl \
|
||||
nsIImapMailFolderSink.idl \
|
||||
nsIMsgImapMailFolder.idl \
|
||||
nsIMsgLogonRedirector.idl \
|
||||
nsIImapHeaderXferInfo.idl \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
typedef long nsMsgLogonRedirectionState;
|
||||
interface nsIPrompt;
|
||||
|
||||
[scriptable, uuid(e20261f6-df4f-11d3-b9f9-00108335942a)]
|
||||
interface nsMsgLogonRedirectionStates
|
||||
{
|
||||
const long Idle = 0;
|
||||
const long Connecting = 1;
|
||||
const long Negotiating = 2;
|
||||
const long Waiting = 3;
|
||||
const long Validating = 4;
|
||||
};
|
||||
|
||||
typedef long nsMsgLogonRedirectionServiceID;
|
||||
|
||||
[scriptable, uuid(182CB845-EB0D-11d3-98B7-001083010E9B)]
|
||||
interface nsMsgLogonRedirectionServiceIDs
|
||||
{
|
||||
const long Imap = 0;
|
||||
const long Smtp = 1;
|
||||
const long AbSync = 2;
|
||||
};
|
||||
|
||||
[scriptable, uuid(3c882b66-df4f-11d3-b9f9-00108335942a)]
|
||||
interface nsIMsgLogonRedirectionRequester : nsISupports
|
||||
{
|
||||
/* Erron on processing the logon redirection */
|
||||
void OnLogonRedirectionError(in wstring pErrMsg, in boolean badPassword);
|
||||
|
||||
/* Logon Redirection Progress */
|
||||
void OnLogonRedirectionProgress(in nsMsgLogonRedirectionState pState);
|
||||
|
||||
/* reply with logon redirection data. */
|
||||
void OnLogonRedirectionReply(in wstring pHost, in unsigned short pPort, in string pCookieData, in unsigned short pCookieSize);
|
||||
};
|
||||
|
||||
/* This is the service we use to request a logon redirection. */
|
||||
[scriptable, uuid(e0c72903-c956-4c2b-8bdf-3ffb95315967)]
|
||||
interface nsIMsgLogonRedirector : nsISupports
|
||||
{
|
||||
// RequiresPassword --> if the subsequent logon call still requires a password to succeed, then the
|
||||
// redirector will return true for this. If the redirector already has a connection open and doesn't really
|
||||
// need a password again, then this will return false. This method gives us a poor man's version of password
|
||||
// caching so the redirection requestor doesn't have to prompt for a password every time the requestor
|
||||
// wishes to log on.
|
||||
// aUserName --> the user name we wish to log in under...
|
||||
boolean requiresPassword(in string aUserName);
|
||||
void logon(in string userName, in string password, in nsIPrompt aPrompt, in nsIMsgLogonRedirectionRequester listener, in nsMsgLogonRedirectionServiceID aServiceID);
|
||||
void logoff(in string userName); /* might not need this one */
|
||||
};
|
||||
|
||||
@ -103,7 +103,6 @@ NS_IMPL_RELEASE_INHERITED(nsImapIncomingServer, nsMsgIncomingServer)
|
||||
NS_INTERFACE_MAP_BEGIN(nsImapIncomingServer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIImapServerSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIImapIncomingServer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMsgLogonRedirectionRequester)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISubscribableServer)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIUrlListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMsgIncomingServer)
|
||||
@ -113,8 +112,6 @@ nsImapIncomingServer::nsImapIncomingServer()
|
||||
m_connectionCache = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
m_urlQueue = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
|
||||
m_capability = kCapabilityUndefined;
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
m_redirectedLogonRetries = 0;
|
||||
mDoingSubscribeDialog = PR_FALSE;
|
||||
mDoingLsub = PR_FALSE;
|
||||
m_canHaveFilters = PR_TRUE;
|
||||
@ -2119,186 +2116,6 @@ NS_IMETHODIMP nsImapIncomingServer::GetManageMailAccountUrl(nsACString& manageMa
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsImapIncomingServer::RequestOverrideInfo(nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
||||
contractID.Append('/');
|
||||
m_logonRedirector = do_GetService(contractID.get(), &rv);
|
||||
if (m_logonRedirector && NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIMsgLogonRedirectionRequester> logonRedirectorRequester;
|
||||
rv = QueryInterface(NS_GET_IID(nsIMsgLogonRedirectionRequester), getter_AddRefs(logonRedirectorRequester));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCAutoString password;
|
||||
nsCAutoString userName;
|
||||
PRBool requiresPassword = PR_TRUE;
|
||||
GetRealUsername(userName);
|
||||
m_logonRedirector->RequiresPassword(userName.get(), &requiresPassword);
|
||||
if (requiresPassword)
|
||||
{
|
||||
GetPassword(password);
|
||||
|
||||
if (password.IsEmpty())
|
||||
PromptForPassword(password, aMsgWindow);
|
||||
|
||||
if (password.IsEmpty()) // if still empty then the user canceld out of the password dialog
|
||||
{
|
||||
// be sure to clear the waiting for connection info flag because we aren't waiting
|
||||
// anymore for a connection...
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
SetUserAuthenticated(PR_TRUE); // we are already authenicated
|
||||
nsCOMPtr<nsIPrompt> dialogPrompter;
|
||||
if (aMsgWindow)
|
||||
aMsgWindow->GetPromptDialog(getter_AddRefs(dialogPrompter));
|
||||
rv = m_logonRedirector->Logon(userName.get(), password.get(),
|
||||
dialogPrompter, logonRedirectorRequester,
|
||||
nsMsgLogonRedirectionServiceIDs::Imap);
|
||||
if (NS_FAILED(rv))
|
||||
return OnLogonRedirectionError(nsnull, PR_TRUE);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionError(const PRUnichar *pErrMsg, PRBool badPassword)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsString progressString;
|
||||
GetImapStringByID(IMAP_REDIRECT_LOGIN_FAILED, progressString);
|
||||
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
PRUint32 urlQueueCnt = 0;
|
||||
// pull the url out of the queue so we can get the msg window, and try to rerun it.
|
||||
m_urlQueue->Count(&urlQueueCnt);
|
||||
|
||||
nsCOMPtr<nsISupports> aSupport;
|
||||
nsCOMPtr<nsIImapUrl> aImapUrl;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl;
|
||||
if (urlQueueCnt > 0)
|
||||
{
|
||||
aSupport = getter_AddRefs(m_urlQueue->ElementAt(0));
|
||||
aImapUrl = do_QueryInterface(aSupport, &rv);
|
||||
mailnewsUrl = do_QueryInterface(aSupport, &rv);
|
||||
}
|
||||
|
||||
if (mailnewsUrl)
|
||||
mailnewsUrl->GetMsgWindow(getter_AddRefs(msgWindow));
|
||||
|
||||
// don't put up alert if no msg window - it means we're biffing.
|
||||
if (msgWindow)
|
||||
FEAlert(progressString, msgWindow);
|
||||
|
||||
// If password is bad then clean up all cached passwords.
|
||||
if (badPassword)
|
||||
ForgetPassword();
|
||||
|
||||
PRBool resetUrlState = PR_FALSE;
|
||||
if (badPassword && ++m_redirectedLogonRetries <= 3)
|
||||
{
|
||||
// this will force a reprompt for the password.
|
||||
// ### DMB TODO display error message?
|
||||
if (urlQueueCnt > 0)
|
||||
{
|
||||
nsCOMPtr <nsIImapProtocol> imapProtocol;
|
||||
|
||||
if (aImapUrl)
|
||||
{
|
||||
nsCOMPtr <nsIImapProtocol> protocolInstance ;
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
rv = GetImapConnection(NS_GetCurrentThread(), aImapUrl,
|
||||
getter_AddRefs(protocolInstance));
|
||||
// If users cancel the login then we need to reset url state.
|
||||
if (rv == NS_BINDING_ABORTED)
|
||||
resetUrlState = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
resetUrlState = PR_TRUE;
|
||||
|
||||
// Either user cancel (2nd, 3rd or 4th) login or all tries fail we'll
|
||||
// have to reset url state so that next login will work correctly.
|
||||
if (resetUrlState)
|
||||
{
|
||||
m_redirectedLogonRetries = 0; // reset so next attempt will start at 0.
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
if (urlQueueCnt > 0)
|
||||
{
|
||||
// Reset url state.
|
||||
if (mailnewsUrl)
|
||||
mailnewsUrl->SetUrlState(PR_FALSE, NS_MSG_ERROR_URL_ABORTED);
|
||||
|
||||
m_urlQueue->RemoveElementAt(0);
|
||||
m_urlConsumers.RemoveElementAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Logon Redirection Progress */
|
||||
NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionProgress(nsMsgLogonRedirectionState pState)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* reply with logon redirection data. */
|
||||
NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionReply(const PRUnichar *pHost, unsigned short pPort, const char *pCookieData, unsigned short pCookieSize)
|
||||
{
|
||||
PRBool urlRun = PR_FALSE;
|
||||
nsresult rv;
|
||||
nsCOMPtr <nsIImapProtocol> imapProtocol;
|
||||
nsCAutoString cookie(pCookieData, pCookieSize);
|
||||
// we used to logoff the external requestor...we no longer need to do that.
|
||||
|
||||
m_redirectedLogonRetries = 0; // we got through, so reset this counter.
|
||||
|
||||
PRUint32 cnt = 0;
|
||||
|
||||
m_urlQueue->Count(&cnt);
|
||||
if (cnt > 0)
|
||||
{
|
||||
nsCOMPtr<nsIImapUrl> aImapUrl(do_QueryElementAt(m_urlQueue, 0, &rv));
|
||||
|
||||
if (aImapUrl)
|
||||
{
|
||||
nsCOMPtr<nsISupports> aConsumer = (nsISupports*)m_urlConsumers.ElementAt(0);
|
||||
|
||||
nsCOMPtr <nsIImapProtocol> protocolInstance ;
|
||||
rv = GetImapConnection(NS_GetCurrentThread(), aImapUrl,
|
||||
getter_AddRefs(protocolInstance));
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
if (NS_SUCCEEDED(rv) && protocolInstance)
|
||||
{
|
||||
protocolInstance->OverrideConnectionInfo(pHost, pPort, cookie.get());
|
||||
nsCOMPtr<nsIURI> url = do_QueryInterface(aImapUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && url)
|
||||
{
|
||||
rv = protocolInstance->LoadImapUrl(url, aConsumer);
|
||||
urlRun = PR_TRUE;
|
||||
}
|
||||
|
||||
m_urlQueue->RemoveElementAt(0);
|
||||
m_urlConsumers.RemoveElementAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_waitingForConnectionInfo = PR_FALSE;
|
||||
NS_ASSERTION(PR_FALSE, "got redirection response with no queued urls");
|
||||
// Need to clear this even if we don't have any urls in the queue.
|
||||
// Otherwise, we'll never clear it and we'll never request override info.
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::StartPopulatingWithUri(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *uri)
|
||||
{
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "nsMsgIncomingServer.h"
|
||||
#include "nsIImapServerSink.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIMsgLogonRedirector.h"
|
||||
#include "nsISubscribableServer.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsAdapterEnumerator.h"
|
||||
@ -58,7 +57,6 @@ class nsIEventTarget;
|
||||
class nsImapIncomingServer : public nsMsgIncomingServer,
|
||||
public nsIImapIncomingServer,
|
||||
public nsIImapServerSink,
|
||||
public nsIMsgLogonRedirectionRequester,
|
||||
public nsISubscribableServer,
|
||||
public nsIUrlListener
|
||||
|
||||
@ -75,7 +73,6 @@ public:
|
||||
|
||||
NS_DECL_NSIIMAPINCOMINGSERVER
|
||||
NS_DECL_NSIIMAPSERVERSINK
|
||||
NS_DECL_NSIMSGLOGONREDIRECTIONREQUESTER
|
||||
NS_DECL_NSISUBSCRIBABLESERVER
|
||||
NS_DECL_NSIURLLISTENER
|
||||
|
||||
@ -123,7 +120,6 @@ private:
|
||||
nsIImapProtocol** aImapConnection);
|
||||
nsresult CreateProtocolInstance(nsIEventTarget *aEventTarget,
|
||||
nsIImapProtocol ** aImapConnection);
|
||||
nsresult RequestOverrideInfo(nsIMsgWindow *aMsgWindow);
|
||||
nsresult CreateHostSpecificPrefName(const char *prefPrefix, nsCAutoString &prefName);
|
||||
|
||||
nsresult DoomUrlIfChannelHasError(nsIImapUrl *aImapUrl, PRBool *urlDoomed);
|
||||
@ -141,13 +137,10 @@ private:
|
||||
nsCString m_manageMailAccountUrl;
|
||||
PRPackedBool m_readPFCName;
|
||||
PRPackedBool m_userAuthenticated;
|
||||
PRPackedBool m_waitingForConnectionInfo;
|
||||
PRPackedBool mDoingSubscribeDialog;
|
||||
PRPackedBool mDoingLsub;
|
||||
PRPackedBool m_shuttingDown;
|
||||
nsCString m_pfcName;
|
||||
PRInt32 m_redirectedLogonRetries;
|
||||
nsCOMPtr<nsIMsgLogonRedirector> m_logonRedirector;
|
||||
|
||||
// subscribe dialog stuff
|
||||
nsresult AddFolderToSubscribeDialog(const char *parentUri, const char *uri,const char *folderName);
|
||||
|
||||
@ -77,7 +77,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIImapIncomingServer.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIMsgLogonRedirector.h"
|
||||
#include "nsICacheListener.h"
|
||||
#include "nsIImapHeaderXferInfo.h"
|
||||
#include "nsMsgLineBuffer.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user