mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Pass interfaces to certs to the SSL dialogs through the new
nsIPKIParamBlock interface. Clean up some inconsistencies in nsPKIParamBlock implementation.
This commit is contained in:
parent
9b5b88fd95
commit
721ae99720
@ -22,21 +22,23 @@
|
||||
*/
|
||||
|
||||
|
||||
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
|
||||
const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
|
||||
const nsIX509Cert = Components.interfaces.nsIX509Cert;
|
||||
|
||||
var params;
|
||||
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
|
||||
params = window.arguments[0].QueryInterface(nsIPKIParamBlock);
|
||||
var connectURL = params.GetString(1);
|
||||
var certURL = params.GetString(2);
|
||||
var isupport = params.getISupportAtIndex(1);
|
||||
var cert = isupport.QueryInterface(nsIX509Cert);
|
||||
|
||||
var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");
|
||||
|
||||
var message1 = bundle.formatStringFromName("mismatchDomainMsg1",
|
||||
[ connectURL, certURL ],
|
||||
[ connectURL, cert.commonName ],
|
||||
2);
|
||||
var message2 = bundle.formatStringFromName("mismatchDomainMsg2",
|
||||
[ connectURL ],
|
||||
|
@ -22,25 +22,27 @@
|
||||
*/
|
||||
|
||||
|
||||
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
|
||||
const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
|
||||
const nsIX509Cert = Components.interfaces.nsIX509Cert;
|
||||
|
||||
var params;
|
||||
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
|
||||
serverName = params.GetString(1);
|
||||
params = window.arguments[0].QueryInterface(nsIPKIParamBlock);
|
||||
var isupport = params.getISupportAtIndex(1);
|
||||
var cert = isupport.QueryInterface(nsIX509Cert);
|
||||
|
||||
var bundle = srGetStrBundle("chrome://pippki/locale/newserver.properties");
|
||||
var gBundleBrand = srGetStrBundle("chrome://global/locale/brand.properties");
|
||||
|
||||
var brandName = gBundleBrand.GetStringFromName("brandShortName");
|
||||
var message1 = bundle.formatStringFromName("newServerMessage1",
|
||||
[ serverName, brandName ],
|
||||
[ cert.commonName, brandName ],
|
||||
2);
|
||||
var message4 = bundle.formatStringFromName("newServerMessage4",
|
||||
[ serverName ],
|
||||
[ cert.commonName ],
|
||||
1);
|
||||
setText("message1", message1);
|
||||
setText("message4", message4);
|
||||
|
@ -22,14 +22,14 @@
|
||||
*/
|
||||
|
||||
|
||||
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
|
||||
const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
|
||||
const nsIX509Cert = Components.interfaces.nsIX509Cert;
|
||||
|
||||
var params;
|
||||
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
params = window.arguments[0].QueryInterface(nsIDialogParamBlock);
|
||||
params = window.arguments[0].QueryInterface(nsIPKIParamBlock);
|
||||
|
||||
var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");
|
||||
var message1 = params.GetString(1);
|
||||
|
@ -281,10 +281,7 @@ nsNSSDialogs::UnknownIssuer(nsITransportSecurityInfo *socketInfo,
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString commonName;
|
||||
rv = cert->GetCommonName(getter_Copies(commonName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = block->SetString(1, commonName);
|
||||
rv = block->SetISupportAtIndex(1, cert);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -344,15 +341,11 @@ nsNSSDialogs::MismatchDomain(nsITransportSecurityInfo *socketInfo,
|
||||
if (!block)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsXPIDLString commonName;
|
||||
rv = cert->GetCommonName(getter_Copies(commonName));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = block->SetString(1, targetURL);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetString(2, commonName);
|
||||
rv = block->SetISupportAtIndex(1, cert);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -436,6 +429,10 @@ nsNSSDialogs::CertExpired(nsITransportSecurityInfo *socketInfo,
|
||||
|
||||
rv = block->SetString(1,message1);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = block->SetISupportAtIndex(1, cert);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -115,6 +115,7 @@ nsPKIParamBlock::SetNumberISupports(PRInt32 numISupports)
|
||||
mNumISupports = 0;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
memset(mSupports, 0, sizeof(nsISupports*)*mNumISupports);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -128,13 +129,14 @@ nsPKIParamBlock::SetISupportAtIndex(PRInt32 index, nsISupports *object)
|
||||
if (mSupports == nsnull) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
memset(mSupports, 0, sizeof(nsISupports*)*mNumISupports);
|
||||
}
|
||||
nsresult rv = InBounds(index, mNumISupports);
|
||||
if (rv != NS_OK)
|
||||
return rv;
|
||||
|
||||
mSupports[index-1] = object;
|
||||
NS_ADDREF(mSupports[index-1]);
|
||||
mSupports[index] = object;
|
||||
NS_IF_ADDREF(mSupports[index]);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -147,7 +149,7 @@ nsPKIParamBlock::GetISupportAtIndex(PRInt32 index, nsISupports **_retval)
|
||||
if (rv != NS_OK)
|
||||
return rv;
|
||||
|
||||
*_retval = mSupports[index-1];
|
||||
*_retval = mSupports[index];
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user