Use NewTempCert and AddTempCert when importing because the cert may already exist

in the cache.
This commit is contained in:
relyea%netscape.com 2002-04-29 23:54:07 +00:00
parent 1bbd2fb18b
commit cec43732fb

View File

@ -915,7 +915,8 @@ cert_ImportCAChain(SECItem *certs, int numcerts, SECCertUsage certUsage, PRBool
}
}
cert = CERT_DecodeDERCertificate(derCert, PR_FALSE, NULL);
cert = CERT_NewTempCertificate(handle, derCert, NULL,
PR_FALSE, PR_FALSE);
if ( cert == NULL ) {
goto loser;
}
@ -923,9 +924,7 @@ cert_ImportCAChain(SECItem *certs, int numcerts, SECCertUsage certUsage, PRBool
/* get a default nickname for it */
nickname = CERT_MakeCANickname(cert);
cert->trust = &trust;
rv = PK11_ImportCert(PK11_GetInternalKeySlot(), cert,
CK_INVALID_HANDLE, nickname, PR_TRUE);
rv = CERT_AddTempCertToPerm(cert, nickname, &trust);
/* free the nickname */
if ( nickname ) {