bug 135871, CERT_ImportCerts not storing temp certs NSS_3_4_BRANCH
authorwtc%netscape.com
Thu, 25 Apr 2002 20:48:22 +0000
branchNSS_3_4_BRANCH
changeset 3057 1a8e700217376cdfb4fb6d747f32b28e95e96c68
parent 3056 a9dba030060553f19213a1c76e4d32a0cf4661b1
child 3061 a58e9f09633cbcb3a3e8fda45a5e38666164d68e
push idunknown
push userunknown
push dateunknown
bugs135871
bug 135871, CERT_ImportCerts not storing temp certs r=relyea (Tag: NSS_3_4_BRANCH)
security/nss/lib/certdb/certdb.c
--- a/security/nss/lib/certdb/certdb.c
+++ b/security/nss/lib/certdb/certdb.c
@@ -2023,18 +2023,27 @@ CERT_ImportCerts(CERTCertDBHandle *certd
     if ( ncerts ) {
 	certs = (CERTCertificate**)PORT_ZAlloc(sizeof(CERTCertificate *) * ncerts );
 	if ( certs == NULL ) {
 	    return(SECFailure);
 	}
     
 	/* decode all of the certs into the temporary DB */
 	for ( i = 0, fcerts= 0; i < ncerts; i++) {
-	    certs[fcerts] = CERT_DecodeDERCertificate(derCerts[i], PR_FALSE,
-						NULL);
+	    if ( keepCerts ) {
+		certs[fcerts] = CERT_DecodeDERCertificate(derCerts[i], 
+		                                          PR_FALSE,
+		                                          NULL);
+	    } else {
+		certs[fcerts] = CERT_NewTempCertificate(certdb,
+		                                        derCerts[i],
+		                                        NULL,
+		                                        PR_FALSE,
+		                                        PR_TRUE);
+	    }
 	    if (certs[fcerts]) fcerts++;
 	}
 
 	if ( keepCerts ) {
 	    for ( i = 0; i < fcerts; i++ ) {
 		SECKEY_UpdateCertPQG(certs[i]);
 		if(CERT_IsCACert(certs[i], NULL) && (fcerts > 1)) {
 		    /* if we are importing only a single cert and specifying