зеркало из https://github.com/mozilla/pjs.git
Bug 379997: don't delete logins if authentication fails, patch by Justin Dolske <dolske@mozilla.com>, r+sr=biesi
This commit is contained in:
Родитель
83f5e9271f
Коммит
7868c73939
|
@ -65,7 +65,6 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsCPasswordManager.h"
|
||||
#include "nsAuthInformationHolder.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
|
@ -802,21 +801,6 @@ nsFtpState::R_pass() {
|
|||
if (mResponseCode/100 == 5 || mResponseCode==421) {
|
||||
// There is no difference between a too-many-users error,
|
||||
// a wrong-password error, or any other sort of error
|
||||
// So we need to tell wallet to forget the password if we had one,
|
||||
// and error out. That will then show the error message, and the
|
||||
// user can retry if they want to
|
||||
|
||||
if (!mPassword.IsEmpty()) {
|
||||
nsCOMPtr<nsIPasswordManager> pm =
|
||||
do_GetService(NS_PASSWORDMANAGER_CONTRACTID);
|
||||
if (pm) {
|
||||
nsCAutoString prePath;
|
||||
nsresult rv = mChannel->URI()->GetPrePath(prePath);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get prepath");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
pm->RemoveUser(prePath, EmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
// If the login was anonymous, and it failed, try again with a username
|
||||
if (mAnonymous) {
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "nsIIDNService.h"
|
||||
#include "nsIStreamListenerTee.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsCPasswordManager.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
|
@ -2744,7 +2743,6 @@ nsHttpChannel::GetCredentialsForChallenge(const char *challenge,
|
|||
LOG((" clearing bad auth cache entry\n"));
|
||||
// ok, we've already tried this user identity, so clear the
|
||||
// corresponding entry from the auth cache.
|
||||
ClearPasswordManagerEntry(scheme.get(), host, port, realm.get(), entry->User());
|
||||
authCache->ClearAuthEntry(scheme.get(), host, port, realm.get());
|
||||
entry = nsnull;
|
||||
ident->Clear();
|
||||
|
@ -4633,31 +4631,6 @@ nsHttpChannel::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHttpChannel::ClearPasswordManagerEntry(const char *scheme,
|
||||
const char *host,
|
||||
PRInt32 port,
|
||||
const char *realm,
|
||||
const PRUnichar *user)
|
||||
{
|
||||
// XXX scheme is currently unused. see comments in PromptForIdentity
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPasswordManager> passWordManager = do_GetService(NS_PASSWORDMANAGER_CONTRACTID, &rv);
|
||||
if (passWordManager) {
|
||||
nsCAutoString domain;
|
||||
domain.Assign(host);
|
||||
domain.Append(':');
|
||||
domain.AppendInt(port);
|
||||
|
||||
domain.AppendLiteral(" (");
|
||||
domain.Append(realm);
|
||||
domain.Append(')');
|
||||
|
||||
passWordManager->RemoveUser(domain, nsDependentString(user));
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHttpChannel::DoAuthRetry(nsAHttpConnection *conn)
|
||||
{
|
||||
|
|
|
@ -208,7 +208,6 @@ private:
|
|||
void SetAuthorizationHeader(nsHttpAuthCache *, nsHttpAtom header, const char *scheme, const char *host, PRInt32 port, const char *path, nsHttpAuthIdentity &ident);
|
||||
void AddAuthorizationHeaders();
|
||||
nsresult GetCurrentPath(nsACString &);
|
||||
void ClearPasswordManagerEntry(const char *scheme, const char *host, PRInt32 port, const char *realm, const PRUnichar *user);
|
||||
nsresult DoAuthRetry(nsAHttpConnection *);
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче