summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 22:01:39 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 22:01:39 -0500
commit97826b14c7558748543b1558e5d2a37652cb2bba (patch)
tree4d015a13ae2488816dbd9ef85a85e2f3cf16074b
parentcea77b76b3fef912bd79e777f97d353aa50474b6 (diff)
downloadUXP-97826b14c7558748543b1558e5d2a37652cb2bba.tar
UXP-97826b14c7558748543b1558e5d2a37652cb2bba.tar.gz
UXP-97826b14c7558748543b1558e5d2a37652cb2bba.tar.lz
UXP-97826b14c7558748543b1558e5d2a37652cb2bba.tar.xz
UXP-97826b14c7558748543b1558e5d2a37652cb2bba.zip
Bug 1257058 - Distinguish 'empty password' from no password received to avoid shutdown crash.
Tag #1273
-rw-r--r--mailnews/imap/src/nsImapProtocol.cpp6
-rw-r--r--mailnews/imap/src/nsImapProtocol.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp
index 20cadc25c..f50a26fdd 100644
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -8463,7 +8463,7 @@ nsresult nsImapProtocol::GetPassword(nsCString &password,
NS_ENSURE_TRUE(msgWindow, NS_ERROR_NOT_AVAILABLE); // biff case
// Get the password from pw manager (harddisk) or user (dialog)
- nsAutoCString pwd; // GetPasswordWithUI truncates the password on Cancel
+ m_passwordObtained = false;
rv = m_imapServerSink->AsyncGetPassword(this,
newPasswordRequested,
password);
@@ -8472,7 +8472,7 @@ nsresult nsImapProtocol::GetPassword(nsCString &password,
PRIntervalTime sleepTime = kImapSleepTime;
m_passwordStatus = NS_OK;
ReentrantMonitorAutoEnter mon(m_passwordReadyMonitor);
- while (m_password.IsEmpty() && !NS_FAILED(m_passwordStatus) &&
+ while (!m_passwordObtained && !NS_FAILED(m_passwordStatus) &&
m_passwordStatus != NS_MSG_PASSWORD_PROMPT_CANCELLED &&
!DeathSignalReceived())
mon.Wait(sleepTime);
@@ -8504,6 +8504,7 @@ nsImapProtocol::OnPromptStart(bool *aResult)
*aResult = true;
// Notify the imap thread that we have a password.
+ m_passwordObtained = true;
ReentrantMonitorAutoEnter passwordMon(m_passwordReadyMonitor);
passwordMon.Notify();
return rv;
@@ -8517,6 +8518,7 @@ nsImapProtocol::OnPromptAuthAvailable()
NS_ENSURE_SUCCESS(rv, rv);
m_passwordStatus = imapServer->GetPassword(m_password);
// Notify the imap thread that we have a password.
+ m_passwordObtained = true;
ReentrantMonitorAutoEnter passwordMon(m_passwordReadyMonitor);
passwordMon.Notify();
return m_passwordStatus;
diff --git a/mailnews/imap/src/nsImapProtocol.h b/mailnews/imap/src/nsImapProtocol.h
index 32cf90e4c..b0cea7ced 100644
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -358,6 +358,7 @@ private:
nsCString m_password;
// Set to the result of nsImapServer::PromptPassword
nsresult m_passwordStatus;
+ bool m_passwordObtained;
bool m_imapThreadIsRunning;
void ImapThreadMainLoop(void);