nssrv = nssToken_TraverseCertificatesByNickname(token, NULL, nick, &search);
filter_list_for_token_certs(nameList, token); nssrv = nssCertificateList_DoCallback(nameList, convert_cert, &pk11cb);
PK11_TraverseCertsForNicknameInSlot(SECItem *nickname, PK11SlotInfo *slot,	SECStatus(* callback)(CERTCertificate*, void *), void *arg){#ifdef NSS_CLASSIC    pk11DoCertCallback caller;    pk11TraverseSlot callarg;    CK_OBJECT_CLASS certClass = CKO_CERTIFICATE;    CK_ATTRIBUTE theTemplate[] = {	{ CKA_CLASS, NULL, 0 },	{ CKA_LABEL, NULL, 0 },    };    CK_ATTRIBUTE *attr = theTemplate;    int templateSize = sizeof(theTemplate)/sizeof(theTemplate[0]);    if(!nickname) {	return SECSuccess;    }    PK11_SETATTRS(attr,CKA_CLASS, &certClass, sizeof(certClass)); attr++;    PK11_SETATTRS(attr,CKA_LABEL,nickname->data,nickname->len);    if (slot == NULL) {	return SECSuccess;    }    caller.noslotcallback = callback;    caller.callback = NULL;    caller.itemcallback = NULL;    caller.callbackArg = arg;    callarg.callback = pk11_DoCerts;    callarg.callbackArg = (void *) & caller;    callarg.findTemplate = theTemplate;    callarg.templateCount = templateSize;    return PK11_TraverseSlot(slot, &callarg);#else    struct nss3_cert_cbstr pk11cb;    PRStatus nssrv = PR_SUCCESS;    NSSToken *token;    NSSTrustDomain *td;    NSSUTF8 *nick;    PRBool created = PR_FALSE;    nssTokenCertSearch search;    nssList *nameList;    pk11cb.callback = callback;    pk11cb.arg = arg;    if (nickname->data[nickname->len-1] != '\0') {	nick = nssUTF8_Create(NULL, nssStringType_UTF8String, 	                      nickname->data, nickname->len);	created = PR_TRUE;    } else {	nick = (NSSUTF8 *)nickname->data;    }    td = STAN_GetDefaultTrustDomain();    token = PK11Slot_GetNSSToken(slot);    if (!nssToken_SearchCerts(token, NULL)) {	nameList = filter_token_certs_nickname(token, nick);	if (nameList) {	    nssrv = nssCertificateList_DoCallback(nameList, 	                                          convert_cert, &pk11cb);	}    } else {	nameList = nssList_Create(NULL, PR_FALSE);	(void)nssTrustDomain_GetCertsForNicknameFromCache(td, nick, nameList);	filter_list_for_token_certs(nameList, token);	/* set the search criteria */	search.callback = convert_and_cache_cert;	search.cbarg = &pk11cb;	search.cached = nameList;	search.searchType = nssTokenSearchType_TokenOnly;	pk11cb.cached = nameList;	nssrv = nssCertificateList_DoCallback(nameList, 	                                      convert_cert, &pk11cb);	if (nssrv == PR_SUCCESS) {	    nssrv = nssToken_TraverseCertificatesByNickname(token, NULL,                                                             nick, &search);	}    }    if (nameList) {	nssList_Clear(nameList, cert_destructor);	nssList_Destroy(nameList);    }    if (created) nss_ZFreeIf(nick);    return (nssrv == PR_SUCCESS) ? SECSuccess : SECFailure;#endif}