Don't fail the search if the token returned an error that indicates that it
legitimately couldn't find a CRL
This commit is contained in:
wtc%netscape.com 2003-01-24 06:37:03 +00:00
Родитель 84c3008db9
Коммит 228b3e52ed
1 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -32,7 +32,7 @@
*/
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: devtoken.c,v $ $Revision: 1.32 $ $Date: 2002/11/21 20:43:05 $ $Name: $";
static const char CVS_ID[] = "@(#) $RCSfile: devtoken.c,v $ $Revision: 1.33 $ $Date: 2003/01/24 06:37:03 $ $Name: $";
#endif /* DEBUG */
#ifndef NSSCKEPV_H
@ -393,7 +393,7 @@ find_objects
PRStatus *statusOpt
)
{
CK_RV ckrv;
CK_RV ckrv = CKR_OK;
CK_ULONG count;
CK_OBJECT_HANDLE *objectHandles;
CK_OBJECT_HANDLE staticObjects[OBJECT_STACK_SIZE];
@ -415,6 +415,7 @@ find_objects
objectHandles = nss_ZNEWARRAY(NULL, CK_OBJECT_HANDLE, arraySize);
}
if (!objectHandles) {
ckrv = CKR_HOST_MEMORY;
goto loser;
}
nssSession_EnterMonitor(session); /* ==== session lock === */
@ -459,6 +460,7 @@ find_objects
}
if (!objectHandles) {
nssSession_ExitMonitor(session);
ckrv = CKR_HOST_MEMORY;
goto loser;
}
}
@ -483,7 +485,23 @@ loser:
if (objectHandles && objectHandles != staticObjects) {
nss_ZFreeIf(objectHandles);
}
if (statusOpt) *statusOpt = PR_FAILURE;
/*
* These errors should be treated the same as if the objects just weren't
* found..
*/
if ((ckrv == CKR_ATTRIBUTE_TYPE_INVALID) ||
(ckrv == CKR_ATTRIBUTE_VALUE_INVALID) ||
(ckrv == CKR_DATA_INVALID) ||
(ckrv == CKR_DATA_LEN_RANGE) ||
(ckrv == CKR_FUNCTION_NOT_SUPPORTED) ||
(ckrv == CKR_TEMPLATE_INCOMPLETE) ||
(ckrv == CKR_TEMPLATE_INCONSISTENT)) {
nss_SetError(NSS_ERROR_NOT_FOUND);
if (statusOpt) *statusOpt = PR_SUCCESS;
} else {
if (statusOpt) *statusOpt = PR_FAILURE;
}
return (nssCryptokiObject **)NULL;
}