Bug 462806. Don't init PSM to deal with random JARs. Save that for signed JARs. r=dveditz, sr=vlad, a=beltzner

This commit is contained in:
Boris Zbarsky 2008-11-18 14:11:35 -05:00
parent dc6bb35407
commit dc71f62826
2 changed files with 13 additions and 10 deletions

View File

@ -376,15 +376,8 @@ nsJAR::GetCertificatePrincipal(const char* aFilename, nsIPrincipal** aPrincipal)
return NS_ERROR_NULL_POINTER;
*aPrincipal = nsnull;
//-- Get the signature verifier service
nsresult rv;
nsCOMPtr<nsISignatureVerifier> verifier =
do_GetService(SIGNATURE_VERIFIER_CONTRACTID, &rv);
if (NS_FAILED(rv)) // No signature verifier available
return NS_OK;
//-- Parse the manifest
rv = ParseManifest(verifier);
nsresult rv = ParseManifest();
if (NS_FAILED(rv)) return rv;
if (mGlobalStatus == JAR_NO_MANIFEST)
return NS_OK;
@ -525,7 +518,7 @@ nsJAR::ReadLine(const char** src)
#define JAR_SF_HEADER (const char*)"Signature-Version: 1.0"
nsresult
nsJAR::ParseManifest(nsISignatureVerifier* verifier)
nsJAR::ParseManifest()
{
//-- Verification Step 1
if (mParsedManifest)
@ -612,6 +605,16 @@ nsJAR::ParseManifest(nsISignatureVerifier* verifier)
return NS_OK;
}
//-- Get the signature verifier service
nsCOMPtr<nsISignatureVerifier> verifier =
do_GetService(SIGNATURE_VERIFIER_CONTRACTID, &rv);
if (NS_FAILED(rv)) // No signature verifier available
{
mGlobalStatus = JAR_NO_MANIFEST;
mParsedManifest = PR_TRUE;
return NS_OK;
}
//-- Verify that the signature file is a valid signature of the SF file
PRInt32 verifyError;
rv = verifier->VerifySignature(sigBuffer, sigLen, manifestBuffer, manifestLen,

View File

@ -154,7 +154,7 @@ class nsJAR : public nsIZipReader, public nsIJAR
//-- Private functions
PRFileDesc* OpenFile();
nsresult ParseManifest(nsISignatureVerifier* verifier);
nsresult ParseManifest();
void ReportError(const char* aFilename, PRInt16 errorCode);
nsresult LoadEntry(const char* aFilename, char** aBuf,
PRUint32* aBufLen = nsnull);