Bug 135871: merged the latest fix from the tip. (Tag: NSS_3_4_BRANCH) NSS_3_4_BRANCH
authorwtc%netscape.com
Thu, 25 Apr 2002 21:23:33 +0000
branchNSS_3_4_BRANCH
changeset 3061 a58e9f09633cbcb3a3e8fda45a5e38666164d68e
parent 3057 1a8e700217376cdfb4fb6d747f32b28e95e96c68
child 3069 1ecffef293bd5d409689d0386d4c0b2240e430e8
push idunknown
push userunknown
push dateunknown
bugs135871
Bug 135871: merged the latest fix from the tip. (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,44 +2023,36 @@ 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++) {
-	    if ( keepCerts ) {
-		certs[fcerts] = CERT_DecodeDERCertificate(derCerts[i], 
-		                                          PR_FALSE,
-		                                          NULL);
-	    } else {
-		certs[fcerts] = CERT_NewTempCertificate(certdb,
-		                                        derCerts[i],
-		                                        NULL,
-		                                        PR_FALSE,
-		                                        PR_TRUE);
-	    }
+	    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
 		     * a nickname, we want to use that nickname if it a CA,
 		     * otherwise if there are more than one cert, we don't
 		     * know which cert it belongs to.
 		     */
-		    rv = PK11_ImportCert(PK11_GetInternalKeySlot(),certs[i],
-				CK_INVALID_HANDLE,NULL,PR_TRUE);
+		    rv = CERT_AddTempCertToPerm(certs[i], NULL, NULL);
 		} else {
-		    rv = PK11_ImportCert(PK11_GetInternalKeySlot(),certs[i],
-				CK_INVALID_HANDLE,nickname,PR_TRUE);
+		    rv = CERT_AddTempCertToPerm(certs[i], nickname, NULL);
 		}
 		if (rv == SECSuccess) {
 		    CERT_SaveImportedCert(certs[i], usage, caOnly, NULL);
 		}
 		/* don't care if it fails - keep going */
 	    }
 	}
     }