OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* | 5 /* |
6 * Implementation of OCSP services, for both client and server. | 6 * Implementation of OCSP services, for both client and server. |
7 * (XXX, really, mostly just for client right now, but intended to do both.) | 7 * (XXX, really, mostly just for client right now, but intended to do both.) |
8 */ | 8 */ |
9 | 9 |
10 #include "prerror.h" | 10 #include "prerror.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 552 } |
553 | 553 |
554 static void | 554 static void |
555 ocsp_RemoveCacheItem(OCSPCacheData *cache, OCSPCacheItem *item) | 555 ocsp_RemoveCacheItem(OCSPCacheData *cache, OCSPCacheItem *item) |
556 { | 556 { |
557 /* The item we're removing could be either the least recently used item, | 557 /* The item we're removing could be either the least recently used item, |
558 * or it could be an item that couldn't get updated with newer status info | 558 * or it could be an item that couldn't get updated with newer status info |
559 * because of an allocation failure, or it could get removed because we're | 559 * because of an allocation failure, or it could get removed because we're |
560 * cleaning up. | 560 * cleaning up. |
561 */ | 561 */ |
562 PRBool couldRemoveFromHashTable; | |
563 OCSP_TRACE(("OCSP ocsp_RemoveCacheItem, THREADID %p\n", PR_GetCurrentThread(
))); | 562 OCSP_TRACE(("OCSP ocsp_RemoveCacheItem, THREADID %p\n", PR_GetCurrentThread(
))); |
564 PR_EnterMonitor(OCSP_Global.monitor); | 563 PR_EnterMonitor(OCSP_Global.monitor); |
565 | 564 |
566 ocsp_RemoveCacheItemFromLinkedList(cache, item); | 565 ocsp_RemoveCacheItemFromLinkedList(cache, item); |
567 couldRemoveFromHashTable = PL_HashTableRemove(cache->entries, | 566 #ifdef DEBUG |
568 item->certID); | 567 { |
569 PORT_Assert(couldRemoveFromHashTable); | 568 PRBool couldRemoveFromHashTable = PL_HashTableRemove(cache->entries, |
| 569 item->certID); |
| 570 PORT_Assert(couldRemoveFromHashTable); |
| 571 } |
| 572 #else |
| 573 PL_HashTableRemove(cache->entries, item->certID); |
| 574 #endif |
570 --cache->numberOfEntries; | 575 --cache->numberOfEntries; |
571 ocsp_FreeCacheItem(item); | 576 ocsp_FreeCacheItem(item); |
572 PR_ExitMonitor(OCSP_Global.monitor); | 577 PR_ExitMonitor(OCSP_Global.monitor); |
573 } | 578 } |
574 | 579 |
575 static void | 580 static void |
576 ocsp_CheckCacheSize(OCSPCacheData *cache) | 581 ocsp_CheckCacheSize(OCSPCacheData *cache) |
577 { | 582 { |
578 OCSP_TRACE(("OCSP ocsp_CheckCacheSize\n")); | 583 OCSP_TRACE(("OCSP ocsp_CheckCacheSize\n")); |
579 PR_EnterMonitor(OCSP_Global.monitor); | 584 PR_EnterMonitor(OCSP_Global.monitor); |
(...skipping 5593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6173 case ocspResponse_unauthorized: | 6178 case ocspResponse_unauthorized: |
6174 PORT_SetError(SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST); | 6179 PORT_SetError(SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST); |
6175 break; | 6180 break; |
6176 case ocspResponse_unused: | 6181 case ocspResponse_unused: |
6177 default: | 6182 default: |
6178 PORT_SetError(SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS); | 6183 PORT_SetError(SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS); |
6179 break; | 6184 break; |
6180 } | 6185 } |
6181 return SECFailure; | 6186 return SECFailure; |
6182 } | 6187 } |
OLD | NEW |