PRBool found;
PRBool found, inCache;
retrieve_cert(NSSToken *t, nssSession *session, CK_OBJECT_HANDLE h, void *arg){    PRStatus nssrv;    PRBool found;    nssTokenCertSearch *search = (nssTokenCertSearch *)arg;    NSSCertificate *cert = NULL;    nssListIterator *instances;    nssCryptokiInstance *ci;    CK_ATTRIBUTE derValue = { CKA_VALUE, NULL, 0 };    if (search->cached) {	NSSCertificate csi; /* a fake cert for indexing */	nssrv = nssCKObject_GetAttributes(h, &derValue, 1,	                                  NULL, session, t->slot);	NSS_CK_ATTRIBUTE_TO_ITEM(&derValue, &csi.encoding);	cert = (NSSCertificate *)nssList_Get(search->cached, &csi);	nss_ZFreeIf(csi.encoding.data);    }    found = PR_FALSE;    if (cert) {	nssCertificate_AddRef(cert);	instances = cert->object.instances;	for (ci  = (nssCryptokiInstance *)nssListIterator_Start(instances);	     ci != (nssCryptokiInstance *)NULL;	     ci  = (nssCryptokiInstance *)nssListIterator_Next(instances))	{	    if (ci->handle == h && ci->token == t) {		found = PR_TRUE;		break;	    }	}	nssListIterator_Finish(instances);    } else {	cert = get_token_cert(t, session, h);	if (!cert) return PR_FAILURE;    }    if (!found) {	PRBool isTokenObject;	/* XXX this is incorrect if the search is over both types */	isTokenObject = (search->searchType == nssTokenSearchType_TokenOnly) ?	                PR_TRUE : PR_FALSE;	ci = create_cryptoki_instance(cert->object.arena, t, h, isTokenObject);	if (!ci) {	    NSSCertificate_Destroy(cert);	    return PR_FAILURE;	}	nssList_Add(cert->object.instanceList, ci);	/* XXX Fix this! */	nssListIterator_Destroy(cert->object.instances);	cert->object.instances = nssList_CreateIterator(cert->object.instanceList);    }    nssrv = (*search->callback)(cert, search->cbarg);    NSSCertificate_Destroy(cert);    return nssrv;}