зеркало из https://github.com/mozilla/gecko-dev.git
catch non-present tokens before searching them
This commit is contained in:
Родитель
255cb21359
Коммит
ee8ba26ef6
|
@ -2540,6 +2540,9 @@ PK11_TraverseCertsForSubjectInSlot(CERTCertificate *cert, PK11SlotInfo *slot,
|
|||
td = STAN_GetDefaultTrustDomain();
|
||||
NSSITEM_FROM_SECITEM(&subject, &cert->derSubject);
|
||||
token = PK11Slot_GetNSSToken(slot);
|
||||
if (!nssToken_IsPresent(token)) {
|
||||
return SECSuccess;
|
||||
}
|
||||
collection = nssCertificateCollection_Create(td, NULL);
|
||||
if (!collection) {
|
||||
return SECFailure;
|
||||
|
@ -2627,6 +2630,10 @@ PK11_TraverseCertsForNicknameInSlot(SECItem *nickname, PK11SlotInfo *slot,
|
|||
nssTokenSearchType tokenOnly = nssTokenSearchType_TokenOnly;
|
||||
pk11cb.callback = callback;
|
||||
pk11cb.arg = arg;
|
||||
token = PK11Slot_GetNSSToken(slot);
|
||||
if (!nssToken_IsPresent(token)) {
|
||||
return SECSuccess;
|
||||
}
|
||||
if (nickname->data[nickname->len-1] != '\0') {
|
||||
nick = nssUTF8_Create(NULL, nssStringType_UTF8String,
|
||||
nickname->data, nickname->len);
|
||||
|
@ -2635,7 +2642,6 @@ PK11_TraverseCertsForNicknameInSlot(SECItem *nickname, PK11SlotInfo *slot,
|
|||
nick = (NSSUTF8 *)nickname->data;
|
||||
}
|
||||
td = STAN_GetDefaultTrustDomain();
|
||||
token = PK11Slot_GetNSSToken(slot);
|
||||
collection = nssCertificateCollection_Create(td, NULL);
|
||||
if (!collection) {
|
||||
goto loser;
|
||||
|
@ -2722,6 +2728,9 @@ PK11_TraverseCertsInSlot(PK11SlotInfo *slot,
|
|||
NSSCertificate **certs;
|
||||
nssTokenSearchType tokenOnly = nssTokenSearchType_TokenOnly;
|
||||
tok = PK11Slot_GetNSSToken(slot);
|
||||
if (!nssToken_IsPresent(tok)) {
|
||||
return SECSuccess;
|
||||
}
|
||||
collection = nssCertificateCollection_Create(td, NULL);
|
||||
if (!collection) {
|
||||
return SECFailure;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.39 $ $Date: 2002/04/18 17:30:05 $ $Name: $";
|
||||
static const char CVS_ID[] = "@(#) $RCSfile: trustdomain.c,v $ $Revision: 1.40 $ $Date: 2002/04/18 19:37:12 $ $Name: $";
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifndef DEV_H
|
||||
|
@ -285,8 +285,10 @@ NSSTrustDomain_FindTokenByName
|
|||
tok != (NSSToken *)NULL;
|
||||
tok = (NSSToken *)nssListIterator_Next(td->tokens))
|
||||
{
|
||||
myName = nssToken_GetName(tok);
|
||||
if (nssUTF8_Equal(tokenName, myName, &nssrv)) break;
|
||||
if (nssToken_IsPresent(tok)) {
|
||||
myName = nssToken_GetName(tok);
|
||||
if (nssUTF8_Equal(tokenName, myName, &nssrv)) break;
|
||||
}
|
||||
}
|
||||
nssListIterator_Finish(td->tokens);
|
||||
return tok;
|
||||
|
|
Загрузка…
Ссылка в новой задаче