OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 CERT_DestroyCertList(certs); | 2470 CERT_DestroyCertList(certs); |
2471 certs = NULL; | 2471 certs = NULL; |
2472 } | 2472 } |
2473 | 2473 |
2474 return certs; | 2474 return certs; |
2475 } | 2475 } |
2476 | 2476 |
2477 PK11SlotList * | 2477 PK11SlotList * |
2478 PK11_GetAllSlotsForCert(CERTCertificate *cert, void *arg) | 2478 PK11_GetAllSlotsForCert(CERTCertificate *cert, void *arg) |
2479 { | 2479 { |
2480 NSSCertificate *c = STAN_GetNSSCertificate(cert); | |
2481 /* add multiple instances to the cert list */ | |
2482 nssCryptokiObject **ip; | 2480 nssCryptokiObject **ip; |
2483 nssCryptokiObject **instances = nssPKIObject_GetInstances(&c->object); | |
2484 PK11SlotList *slotList; | 2481 PK11SlotList *slotList; |
| 2482 NSSCertificate *c; |
| 2483 nssCryptokiObject **instances; |
2485 PRBool found = PR_FALSE; | 2484 PRBool found = PR_FALSE; |
2486 | 2485 |
2487 if (!cert) { | 2486 if (!cert) { |
2488 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 2487 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
2489 return NULL; | 2488 return NULL; |
2490 } | 2489 } |
2491 | 2490 |
| 2491 c = STAN_GetNSSCertificate(cert); |
| 2492 if (!c) { |
| 2493 CERT_MapStanError(); |
| 2494 return NULL; |
| 2495 } |
| 2496 |
| 2497 /* add multiple instances to the cert list */ |
| 2498 instances = nssPKIObject_GetInstances(&c->object); |
2492 if (!instances) { | 2499 if (!instances) { |
2493 PORT_SetError(SEC_ERROR_NO_TOKEN); | 2500 PORT_SetError(SEC_ERROR_NO_TOKEN); |
2494 return NULL; | 2501 return NULL; |
2495 } | 2502 } |
2496 | 2503 |
2497 slotList = PK11_NewSlotList(); | 2504 slotList = PK11_NewSlotList(); |
2498 if (!slotList) { | 2505 if (!slotList) { |
2499 nssCryptokiObjectArray_Destroy(instances); | 2506 nssCryptokiObjectArray_Destroy(instances); |
2500 return NULL; | 2507 return NULL; |
2501 } | 2508 } |
2502 | 2509 |
2503 for (ip = instances; *ip; ip++) { | 2510 for (ip = instances; *ip; ip++) { |
2504 nssCryptokiObject *instance = *ip; | 2511 nssCryptokiObject *instance = *ip; |
2505 PK11SlotInfo *slot = instance->token->pk11slot; | 2512 PK11SlotInfo *slot = instance->token->pk11slot; |
2506 if (slot) { | 2513 if (slot) { |
2507 PK11_AddSlotToList(slotList, slot); | 2514 PK11_AddSlotToList(slotList, slot); |
2508 found = PR_TRUE; | 2515 found = PR_TRUE; |
2509 } | 2516 } |
2510 } | 2517 } |
2511 if (!found) { | 2518 if (!found) { |
2512 PK11_FreeSlotList(slotList); | 2519 PK11_FreeSlotList(slotList); |
2513 PORT_SetError(SEC_ERROR_NO_TOKEN); | 2520 PORT_SetError(SEC_ERROR_NO_TOKEN); |
2514 slotList = NULL; | 2521 slotList = NULL; |
2515 } | 2522 } |
2516 | 2523 |
2517 nssCryptokiObjectArray_Destroy(instances); | 2524 nssCryptokiObjectArray_Destroy(instances); |
2518 return slotList; | 2525 return slotList; |
2519 } | 2526 } |
OLD | NEW |