Bug 327181, Improve error reporting for invalid-certificate errors (error page for https, or combined dialog)
Code in mozilla/security/manager: r=rrelyea Code elsewhere: r=mconnor, sr=dveditz blocking1.9=mconnor git-svn-id: svn://10.0.0.236/trunk@237176 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -87,10 +87,6 @@ NS_IMPL_THREADSAFE_ADDREF(EmbedCertificates)
|
||||
NS_IMPL_THREADSAFE_RELEASE(EmbedCertificates)
|
||||
NS_INTERFACE_MAP_BEGIN(EmbedCertificates)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITokenPasswordDialogs)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBadCertListener)
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBadCertListener2)
|
||||
#endif
|
||||
NS_INTERFACE_MAP_ENTRY(nsICertificateDialogs)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClientAuthDialogs)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICertPickDialogs)
|
||||
@@ -129,40 +125,6 @@ EmbedCertificates::GetPassword(nsIInterfaceRequestor *ctx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo,
|
||||
nsIX509Cert *cert, PRInt16 *outAddType,
|
||||
PRBool *_retval)
|
||||
{
|
||||
*outAddType = ADD_TRUSTED_FOR_SESSION;
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo,
|
||||
const nsACString &targetURL,
|
||||
nsIX509Cert *cert, PRBool *_retval)
|
||||
{
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo,
|
||||
nsIX509Cert *cert, PRBool *_retval)
|
||||
{
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo,
|
||||
const nsACString &targetURL, nsIX509Cert *cert)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl)
|
||||
{
|
||||
@@ -278,86 +240,3 @@ EmbedCertificates::ConfirmKeyEscrow(nsIX509Cert *escrowAuthority, PRBool *_retva
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
NS_IMETHODIMP
|
||||
EmbedCertificates::ConfirmBadCertificate(
|
||||
nsIInterfaceRequestor *ctx,
|
||||
nsIX509Cert *cert,
|
||||
PRBool aSecSuccess,
|
||||
PRUint32 aError,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
gpointer pCert = NULL;
|
||||
guint messint = 0;
|
||||
nsCOMPtr<nsIDOMWindow> parent(do_GetInterface(ctx));
|
||||
|
||||
GtkMozEmbedCommon * common = nsnull;
|
||||
GtkMozEmbed *parentWidget = GTK_MOZ_EMBED(GetGtkWidgetForDOMWindow(parent));
|
||||
|
||||
if (!parentWidget) {
|
||||
EmbedCommon * embedcommon = EmbedCommon::GetInstance();
|
||||
if (embedcommon)
|
||||
common = GTK_MOZ_EMBED_COMMON(embedcommon->mCommon);
|
||||
}
|
||||
|
||||
if (!(aError & nsIX509Cert::VERIFIED_OK)) {
|
||||
pCert = (gpointer)cert;
|
||||
messint = GTK_MOZ_EMBED_CERT_VERIFIED_OK;
|
||||
if (aError & nsIX509Cert::NOT_VERIFIED_UNKNOWN) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_NOT_VERIFIED_UNKNOWN;
|
||||
}
|
||||
if (aError & nsIX509Cert::CERT_EXPIRED || aError & nsIX509Cert::CERT_REVOKED) {
|
||||
nsCOMPtr<nsIX509CertValidity> validity;
|
||||
rv = cert->GetValidity(getter_AddRefs(validity));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRTime notBefore, notAfter, timeToUse;
|
||||
PRTime now = PR_Now();
|
||||
rv = validity->GetNotBefore(¬Before);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = validity->GetNotAfter(¬After);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (LL_CMP(now, >, notAfter)) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_EXPIRED;
|
||||
timeToUse = notAfter;
|
||||
} else {
|
||||
messint |= GTK_MOZ_EMBED_CERT_REVOKED;
|
||||
timeToUse = notBefore;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aError & nsIX509Cert::CERT_NOT_TRUSTED) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_UNTRUSTED;
|
||||
}
|
||||
if (aError & nsIX509Cert::ISSUER_UNKNOWN) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_ISSUER_UNKNOWN;
|
||||
}
|
||||
if (aError & nsIX509Cert::ISSUER_NOT_TRUSTED) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_ISSUER_UNTRUSTED;
|
||||
}
|
||||
if (aError & nsIX509Cert::INVALID_CA) {
|
||||
messint |= GTK_MOZ_EMBED_CERT_INVALID_CA;
|
||||
}
|
||||
if (aError & nsIX509Cert::USAGE_NOT_ALLOWED) {
|
||||
}
|
||||
PRBool retVal = PR_FALSE;
|
||||
if (common) {
|
||||
g_signal_emit_by_name(common, "certificate-error", pCert, messint, &retVal);
|
||||
}
|
||||
if (retVal == PR_TRUE) {
|
||||
*_retval = PR_FALSE;
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
rv = NS_OK;
|
||||
*_retval = PR_TRUE;
|
||||
}
|
||||
pCert = NULL;
|
||||
} else {
|
||||
rv = NS_OK;
|
||||
*_retval = PR_TRUE;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
#ifndef __EmbedCertificates_h
|
||||
#define __EmbedCertificates_h
|
||||
#include "nsITokenPasswordDialogs.h"
|
||||
#include "nsIBadCertListener.h"
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
#include "nsIBadCertListener2.h"
|
||||
#endif
|
||||
#include "nsICertificateDialogs.h"
|
||||
#include "nsIClientAuthDialogs.h"
|
||||
#include "nsICertPickDialogs.h"
|
||||
@@ -63,10 +59,6 @@
|
||||
class EmbedPrivate;
|
||||
class EmbedCertificates
|
||||
: public nsITokenPasswordDialogs,
|
||||
public nsIBadCertListener,
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
public nsIBadCertListener2,
|
||||
#endif
|
||||
public nsICertificateDialogs,
|
||||
public nsIClientAuthDialogs,
|
||||
public nsICertPickDialogs,
|
||||
@@ -77,10 +69,6 @@ class EmbedCertificates
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSITOKENPASSWORDDIALOGS
|
||||
NS_DECL_NSIBADCERTLISTENER
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
NS_DECL_NSIBADCERTLISTENER2
|
||||
#endif
|
||||
NS_DECL_NSICERTIFICATEDIALOGS
|
||||
NS_DECL_NSICLIENTAUTHDIALOGS
|
||||
NS_DECL_NSICERTPICKDIALOGS
|
||||
|
||||
@@ -311,20 +311,6 @@ static const nsModuleComponentInfo defaultAppComps[] = {
|
||||
NS_TOKENPASSWORDSDIALOG_CONTRACTID,
|
||||
EmbedCertificatesConstructor
|
||||
},
|
||||
{
|
||||
EMBED_CERTIFICATES_DESCRIPTION,
|
||||
EMBED_CERTIFICATES_CID,
|
||||
NS_BADCERTLISTENER_CONTRACTID,
|
||||
EmbedCertificatesConstructor
|
||||
},
|
||||
#ifdef BAD_CERT_LISTENER2
|
||||
{
|
||||
EMBED_CERTIFICATES_DESCRIPTION,
|
||||
EMBED_CERTIFICATES_CID,
|
||||
NS_BADCERTLISTENER2_CONTRACTID,
|
||||
EmbedCertificatesConstructor
|
||||
},
|
||||
#endif
|
||||
{
|
||||
EMBED_CERTIFICATES_DESCRIPTION,
|
||||
EMBED_CERTIFICATES_CID,
|
||||
|
||||
Reference in New Issue
Block a user