mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Bug 516464 - Remove passwords from cache when password manager contents are changed to prevent stale password attempts.
Tag #1273
This commit is contained in:
parent
d0d5ec75d5
commit
86d4e9d3a6
4 changed files with 54 additions and 10 deletions
|
|
@ -49,6 +49,7 @@
|
|||
#include "nsIMsgFilter.h"
|
||||
#include "nsIArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#define PORT_NOT_SET -1
|
||||
|
||||
|
|
@ -64,12 +65,51 @@ nsMsgIncomingServer::nsMsgIncomingServer():
|
|||
{
|
||||
}
|
||||
|
||||
nsresult nsMsgIncomingServer::Init()
|
||||
{
|
||||
// We need to know when the password manager changes.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
NS_ENSURE_TRUE(observerService, NS_ERROR_UNEXPECTED);
|
||||
|
||||
observerService->AddObserver(this, "passwordmgr-storage-changed", false);
|
||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsMsgIncomingServer::~nsMsgIncomingServer()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsMsgIncomingServer, nsIMsgIncomingServer,
|
||||
nsISupportsWeakReference)
|
||||
nsISupportsWeakReference, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::Observe(nsISupports *aSubject, const char* aTopic,
|
||||
const char16_t *aData)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// When the state of the password manager changes we need to clear the
|
||||
// password from the cache in case the user just removed it.
|
||||
if (strcmp(aTopic, "passwordmgr-storage-changed") == 0)
|
||||
{
|
||||
rv = ForgetSessionPassword();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
else if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0)
|
||||
{
|
||||
// Now remove ourselves from the observer service as well.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
NS_ENSURE_TRUE(observerService, NS_ERROR_UNEXPECTED);
|
||||
|
||||
observerService->RemoveObserver(this, "passwordmgr-storage-changed");
|
||||
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::SetServerBusy(bool aServerBusy)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "nsIMsgFilterPlugin.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsIMsgPluggableStore.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsIMsgFolderCache;
|
||||
class nsIMsgProtocolInfo;
|
||||
|
|
@ -36,13 +37,16 @@ class nsIMsgProtocolInfo;
|
|||
#define IMETHOD_VISIBILITY NS_VISIBILITY_DEFAULT
|
||||
|
||||
class NS_MSG_BASE nsMsgIncomingServer : public nsIMsgIncomingServer,
|
||||
public nsSupportsWeakReference
|
||||
public nsSupportsWeakReference,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
nsMsgIncomingServer();
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIMSGINCOMINGSERVER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
protected:
|
||||
virtual ~nsMsgIncomingServer();
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ NS_DEFINE_NAMED_CID(NS_MSGCOMPUTILS_CID);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppAbDirectoryDelegator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppComposeDelegator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppIncomingServerDelegator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(JaCppIncomingServerDelegator, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppMsgFolderDelegator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppSendDelegator)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(JaCppUrlDelegator)
|
||||
|
|
@ -620,7 +620,7 @@ NS_DEFINE_NAMED_CID(JACPPURLDELEGATOR_CID);
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapUrl)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapProtocol)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsIMAPHostSessionList, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapIncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsImapIncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapMailFolder)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImapMockChannel)
|
||||
|
|
@ -646,14 +646,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsPop3Service)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoneService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgLocalMailFolder)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParseMailMessageState)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPop3IncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRssIncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPop3IncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsRssIncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRssService)
|
||||
#ifdef HAVE_MOVEMAIL
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMovemailIncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMovemailIncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMovemailService)
|
||||
#endif /* HAVE_MOVEMAIL */
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoIncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNoIncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgBrkMBoxStore)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgMaildirStore)
|
||||
|
||||
|
|
@ -728,7 +728,7 @@ NS_DEFINE_NAMED_CID(NS_FTS3TOKENIZER_CID);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNntpUrl)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNntpService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNntpIncomingServer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNntpIncomingServer, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNNTPArticleList)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNNTPNewsgroupPost)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNNTPNewsgroupList)
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ nsMsgSendLater::Observe(nsISupports *aSubject, const char* aTopic,
|
|||
|
||||
mTimerSet = false;
|
||||
}
|
||||
else if (!strcmp(aTopic, "xpcom-shutdown"))
|
||||
else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
|
||||
{
|
||||
// We're shutting down. Unsubscribe from the unsentFolder notifications
|
||||
// they aren't any use to us now, we don't want to start sending more
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue