зеркало из https://github.com/mozilla/gecko-dev.git
HTTP authentication stores rejected user/pass combos in password manager
bug 91968 patch=Nivedita@netscape.com r=morse sr=darin
This commit is contained in:
Родитель
f14e77e640
Коммит
a9d2b6cb8b
|
@ -42,6 +42,7 @@
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
|
#include "nsIPasswordManager.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
|
static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
|
||||||
|
|
||||||
|
@ -1441,6 +1442,7 @@ nsHttpChannel::GetCredentials(const char *challenges,
|
||||||
LOG(("clearing bad credentials from the auth cache\n"));
|
LOG(("clearing bad credentials from the auth cache\n"));
|
||||||
// ok, we've already tried this user:pass combo, so clear the
|
// ok, we've already tried this user:pass combo, so clear the
|
||||||
// corresponding entry from the auth cache.
|
// corresponding entry from the auth cache.
|
||||||
|
ClearPasswordManagerEntry(host, port, realm.get(), entry->User());
|
||||||
authCache->SetAuthEntry(host, port, nsnull, realm.get(),
|
authCache->SetAuthEntry(host, port, nsnull, realm.get(),
|
||||||
nsnull, nsnull, nsnull, nsnull, nsnull);
|
nsnull, nsnull, nsnull, nsnull, nsnull);
|
||||||
entry = nsnull;
|
entry = nsnull;
|
||||||
|
@ -2740,3 +2742,22 @@ nsHttpChannel::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsHttpChannel::ClearPasswordManagerEntry(const char *host, PRInt32 port, const char *realm, const PRUnichar *user)
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIPasswordManager> passWordManager = do_GetService(NS_PASSWORDMANAGER_CONTRACTID, &rv);
|
||||||
|
if (passWordManager) {
|
||||||
|
nsCAutoString domain;
|
||||||
|
domain.Assign(host);
|
||||||
|
domain.Append(':');
|
||||||
|
domain.AppendInt(port);
|
||||||
|
|
||||||
|
domain.Append(" (");
|
||||||
|
domain.Append(realm);
|
||||||
|
domain.Append(')');
|
||||||
|
|
||||||
|
passWordManager->RemoveUser(domain.get(), user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ private:
|
||||||
void SetAuthorizationHeader(nsHttpAuthCache *, nsHttpAtom header, const char *host, PRInt32 port, const char *path, PRUnichar **user, PRUnichar **pass);
|
void SetAuthorizationHeader(nsHttpAuthCache *, nsHttpAtom header, const char *host, PRInt32 port, const char *path, PRUnichar **user, PRUnichar **pass);
|
||||||
void AddAuthorizationHeaders();
|
void AddAuthorizationHeaders();
|
||||||
nsresult GetCurrentPath(char **);
|
nsresult GetCurrentPath(char **);
|
||||||
|
void ClearPasswordManagerEntry(const char *host, PRInt32 port, const char *realm, const PRUnichar *user);
|
||||||
|
|
||||||
static void *PR_CALLBACK AsyncRedirect_EventHandlerFunc(PLEvent *);
|
static void *PR_CALLBACK AsyncRedirect_EventHandlerFunc(PLEvent *);
|
||||||
static void PR_CALLBACK AsyncRedirect_EventCleanupFunc(PLEvent *);
|
static void PR_CALLBACK AsyncRedirect_EventCleanupFunc(PLEvent *);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче