if(!testCert && PK11_IsInternal(cert->slot)) { testCert = CERT_FindCertByDERCert(CERT_GetDefaultCertDB(), &cert->safeBagContent.certBag->value.x509Cert); }  if(testCert) { if(!testCert->nickname) { cert->removeExisting = PR_TRUE; } CERT_DestroyCertificate(testCert); if(cert->noInstall && !cert->removeExisting) { return; } }
sec_pkcs12_validate_cert(sec_PKCS12SafeBag *cert,			 sec_PKCS12SafeBag *key,			 SEC_PKCS12NicknameCollisionCallback nicknameCb,			 void *wincx){    CERTCertificate *leafCert, *testCert;    if(!cert) {	return;    }        cert->validated = PR_TRUE;    if(!nicknameCb) {	cert->problem = PR_TRUE;	cert->error = SEC_ERROR_NO_MEMORY;	cert->noInstall = PR_TRUE;	return;    }    if(!cert->safeBagContent.certBag) {	cert->noInstall = PR_TRUE;	cert->problem = PR_TRUE;	cert->error = SEC_ERROR_PKCS12_CORRUPT_PFX_STRUCTURE;	return;    }    cert->noInstall = PR_FALSE;    cert->removeExisting = PR_FALSE;    cert->problem = PR_FALSE;    cert->error = 0;    leafCert = CERT_DecodeDERCertificate(	 &cert->safeBagContent.certBag->value.x509Cert, PR_FALSE, NULL);    if(!leafCert) {	cert->noInstall = PR_TRUE;	cert->problem = PR_TRUE;	cert->error = SEC_ERROR_NO_MEMORY;	return;    }    testCert = PK11_FindCertFromDERCert(cert->slot, leafCert, wincx);    CERT_DestroyCertificate(leafCert);    /* if we can't find the certificate through the PKCS11 interface,     * we should check the cert database directly, if we are     * importing to an internal slot.     */    if(!testCert && PK11_IsInternal(cert->slot)) {	testCert = CERT_FindCertByDERCert(CERT_GetDefaultCertDB(),				 &cert->safeBagContent.certBag->value.x509Cert);    }    if(testCert) {	if(!testCert->nickname) {	    cert->removeExisting = PR_TRUE;	}	CERT_DestroyCertificate(testCert);	if(cert->noInstall && !cert->removeExisting) {	    return;	}    }    sec_pkcs12_validate_cert_nickname(cert, key, nicknameCb, wincx);}