| 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 * pkix_pl_aiamgr.c | 5 * pkix_pl_aiamgr.c |
| 6 * | 6 * |
| 7 * AIAMgr Object Definitions | 7 * AIAMgr Object Definitions |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "pkix_pl_aiamgr.h" | 11 #include "pkix_pl_aiamgr.h" |
| 12 extern PKIX_PL_HashTable *aiaConnectionCache; | 12 extern PKIX_PL_HashTable *aiaConnectionCache; |
| 13 | 13 |
| 14 #ifndef NSS_PKIX_NO_LDAP |
| 14 /* --Virtual-LdapClient-Functions------------------------------------ */ | 15 /* --Virtual-LdapClient-Functions------------------------------------ */ |
| 15 | 16 |
| 16 PKIX_Error * | 17 PKIX_Error * |
| 17 PKIX_PL_LdapClient_InitiateRequest( | 18 PKIX_PL_LdapClient_InitiateRequest( |
| 18 PKIX_PL_LdapClient *client, | 19 PKIX_PL_LdapClient *client, |
| 19 LDAPRequestParams *requestParams, | 20 LDAPRequestParams *requestParams, |
| 20 void **pNBIO, | 21 void **pNBIO, |
| 21 PKIX_List **pResponse, | 22 PKIX_List **pResponse, |
| 22 void *plContext) | 23 void *plContext) |
| 23 { | 24 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 PKIX_NULLCHECK_TWO(client, client->resumeFcn); | 45 PKIX_NULLCHECK_TWO(client, client->resumeFcn); |
| 45 | 46 |
| 46 PKIX_CHECK(client->resumeFcn | 47 PKIX_CHECK(client->resumeFcn |
| 47 (client, pNBIO, pResponse, plContext), | 48 (client, pNBIO, pResponse, plContext), |
| 48 PKIX_LDAPCLIENTRESUMEREQUESTFAILED); | 49 PKIX_LDAPCLIENTRESUMEREQUESTFAILED); |
| 49 cleanup: | 50 cleanup: |
| 50 | 51 |
| 51 PKIX_RETURN(LDAPCLIENT); | 52 PKIX_RETURN(LDAPCLIENT); |
| 52 | 53 |
| 53 } | 54 } |
| 55 #endif /* !NSS_PKIX_NO_LDAP */ |
| 54 | 56 |
| 55 /* --Private-AIAMgr-Functions----------------------------------*/ | 57 /* --Private-AIAMgr-Functions----------------------------------*/ |
| 56 | 58 |
| 57 /* | 59 /* |
| 58 * FUNCTION: pkix_pl_AIAMgr_Destroy | 60 * FUNCTION: pkix_pl_AIAMgr_Destroy |
| 59 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_pki.h) | 61 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_pki.h) |
| 60 */ | 62 */ |
| 61 static PKIX_Error * | 63 static PKIX_Error * |
| 62 pkix_pl_AIAMgr_Destroy( | 64 pkix_pl_AIAMgr_Destroy( |
| 63 PKIX_PL_Object *object, | 65 PKIX_PL_Object *object, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 74 aiaMgr = (PKIX_PL_AIAMgr *)object; | 76 aiaMgr = (PKIX_PL_AIAMgr *)object; |
| 75 | 77 |
| 76 /* pointer to cert cache */ | 78 /* pointer to cert cache */ |
| 77 /* pointer to crl cache */ | 79 /* pointer to crl cache */ |
| 78 aiaMgr->method = 0; | 80 aiaMgr->method = 0; |
| 79 aiaMgr->aiaIndex = 0; | 81 aiaMgr->aiaIndex = 0; |
| 80 aiaMgr->numAias = 0; | 82 aiaMgr->numAias = 0; |
| 81 PKIX_DECREF(aiaMgr->aia); | 83 PKIX_DECREF(aiaMgr->aia); |
| 82 PKIX_DECREF(aiaMgr->location); | 84 PKIX_DECREF(aiaMgr->location); |
| 83 PKIX_DECREF(aiaMgr->results); | 85 PKIX_DECREF(aiaMgr->results); |
| 86 #ifndef NSS_PKIX_NO_LDAP |
| 84 PKIX_DECREF(aiaMgr->client.ldapClient); | 87 PKIX_DECREF(aiaMgr->client.ldapClient); |
| 88 #endif |
| 85 | 89 |
| 86 cleanup: | 90 cleanup: |
| 87 | 91 |
| 88 PKIX_RETURN(AIAMGR); | 92 PKIX_RETURN(AIAMGR); |
| 89 } | 93 } |
| 90 | 94 |
| 91 /* | 95 /* |
| 92 * FUNCTION: pkix_pl_AIAMgr_RegisterSelf | 96 * FUNCTION: pkix_pl_AIAMgr_RegisterSelf |
| 93 * DESCRIPTION: | 97 * DESCRIPTION: |
| 94 * Registers PKIX_AIAMGR_TYPE and its related functions with systemClasses[] | 98 * Registers PKIX_AIAMGR_TYPE and its related functions with systemClasses[] |
| (...skipping 12 matching lines...) Expand all Loading... |
| 107 | 111 |
| 108 PKIX_ENTER(AIAMGR, "pkix_pl_AIAMgr_RegisterSelf"); | 112 PKIX_ENTER(AIAMGR, "pkix_pl_AIAMgr_RegisterSelf"); |
| 109 | 113 |
| 110 entry->description = "AIAMgr"; | 114 entry->description = "AIAMgr"; |
| 111 entry->typeObjectSize = sizeof(PKIX_PL_AIAMgr); | 115 entry->typeObjectSize = sizeof(PKIX_PL_AIAMgr); |
| 112 entry->destructor = pkix_pl_AIAMgr_Destroy; | 116 entry->destructor = pkix_pl_AIAMgr_Destroy; |
| 113 | 117 |
| 114 PKIX_RETURN(AIAMGR); | 118 PKIX_RETURN(AIAMGR); |
| 115 } | 119 } |
| 116 | 120 |
| 121 #ifndef NSS_PKIX_NO_LDAP |
| 117 /* | 122 /* |
| 118 * FUNCTION: pkix_pl_AiaMgr_FindLDAPClient | 123 * FUNCTION: pkix_pl_AiaMgr_FindLDAPClient |
| 119 * DESCRIPTION: | 124 * DESCRIPTION: |
| 120 * | 125 * |
| 121 * This function checks the collection of LDAPClient connections held by the | 126 * This function checks the collection of LDAPClient connections held by the |
| 122 * AIAMgr pointed to by "aiaMgr" for one matching the domain name given by | 127 * AIAMgr pointed to by "aiaMgr" for one matching the domain name given by |
| 123 * "domainName". The string may include a port number: e.g., "betty.nist.gov" | 128 * "domainName". The string may include a port number: e.g., "betty.nist.gov" |
| 124 * or "nss.red.iplanet.com:1389". If a match is found, that LDAPClient is | 129 * or "nss.red.iplanet.com:1389". If a match is found, that LDAPClient is |
| 125 * stored at "pClient". Otherwise, an LDAPClient is created and added to the | 130 * stored at "pClient". Otherwise, an LDAPClient is created and added to the |
| 126 * collection, and then stored at "pClient". | 131 * collection, and then stored at "pClient". |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 197 } |
| 193 | 198 |
| 194 *pClient = (PKIX_PL_LdapClient *)client; | 199 *pClient = (PKIX_PL_LdapClient *)client; |
| 195 | 200 |
| 196 cleanup: | 201 cleanup: |
| 197 | 202 |
| 198 PKIX_DECREF(domainString); | 203 PKIX_DECREF(domainString); |
| 199 | 204 |
| 200 PKIX_RETURN(AIAMGR); | 205 PKIX_RETURN(AIAMGR); |
| 201 } | 206 } |
| 207 #endif /* !NSS_PKIX_NO_LDAP */ |
| 202 | 208 |
| 203 PKIX_Error * | 209 PKIX_Error * |
| 204 pkix_pl_AIAMgr_GetHTTPCerts( | 210 pkix_pl_AIAMgr_GetHTTPCerts( |
| 205 PKIX_PL_AIAMgr *aiaMgr, | 211 PKIX_PL_AIAMgr *aiaMgr, |
| 206 PKIX_PL_InfoAccess *ia, | 212 PKIX_PL_InfoAccess *ia, |
| 207 void **pNBIOContext, | 213 void **pNBIOContext, |
| 208 PKIX_List **pCerts, | 214 PKIX_List **pCerts, |
| 209 void *plContext) | 215 void *plContext) |
| 210 { | 216 { |
| 211 PKIX_PL_GeneralName *location = NULL; | 217 PKIX_PL_GeneralName *location = NULL; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (hostname) { | 374 if (hostname) { |
| 369 PORT_Free(hostname); | 375 PORT_Free(hostname); |
| 370 } | 376 } |
| 371 if (path) { | 377 if (path) { |
| 372 PORT_Free(path); | 378 PORT_Free(path); |
| 373 } | 379 } |
| 374 | 380 |
| 375 PKIX_RETURN(AIAMGR); | 381 PKIX_RETURN(AIAMGR); |
| 376 } | 382 } |
| 377 | 383 |
| 384 #ifndef NSS_PKIX_NO_LDAP |
| 378 PKIX_Error * | 385 PKIX_Error * |
| 379 pkix_pl_AIAMgr_GetLDAPCerts( | 386 pkix_pl_AIAMgr_GetLDAPCerts( |
| 380 PKIX_PL_AIAMgr *aiaMgr, | 387 PKIX_PL_AIAMgr *aiaMgr, |
| 381 PKIX_PL_InfoAccess *ia, | 388 PKIX_PL_InfoAccess *ia, |
| 382 void **pNBIOContext, | 389 void **pNBIOContext, |
| 383 PKIX_List **pCerts, | 390 PKIX_List **pCerts, |
| 384 void *plContext) | 391 void *plContext) |
| 385 { | 392 { |
| 386 PKIX_List *result = NULL; | 393 PKIX_List *result = NULL; |
| 387 PKIX_PL_GeneralName *location = NULL; | 394 PKIX_PL_GeneralName *location = NULL; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 483 } |
| 477 | 484 |
| 478 if (PKIX_ERROR_RECEIVED) { | 485 if (PKIX_ERROR_RECEIVED) { |
| 479 PKIX_DECREF(aiaMgr->client.ldapClient); | 486 PKIX_DECREF(aiaMgr->client.ldapClient); |
| 480 } | 487 } |
| 481 | 488 |
| 482 PKIX_DECREF(location); | 489 PKIX_DECREF(location); |
| 483 | 490 |
| 484 PKIX_RETURN(AIAMGR); | 491 PKIX_RETURN(AIAMGR); |
| 485 } | 492 } |
| 493 #endif /* !NSS_PKIX_NO_LDAP */ |
| 486 | 494 |
| 487 /* | 495 /* |
| 488 * FUNCTION: PKIX_PL_AIAMgr_Create | 496 * FUNCTION: PKIX_PL_AIAMgr_Create |
| 489 * DESCRIPTION: | 497 * DESCRIPTION: |
| 490 * | 498 * |
| 491 * This function creates an AIAMgr, storing the result at "pAIAMgr". | 499 * This function creates an AIAMgr, storing the result at "pAIAMgr". |
| 492 * | 500 * |
| 493 * PARAMETERS: | 501 * PARAMETERS: |
| 494 * "pAIAMGR" | 502 * "pAIAMGR" |
| 495 * Address at which the returned AIAMgr is stored. Must be non-NULL. | 503 * Address at which the returned AIAMgr is stored. Must be non-NULL. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 620 } |
| 613 | 621 |
| 614 PKIX_CHECK(PKIX_PL_InfoAccess_GetLocationType | 622 PKIX_CHECK(PKIX_PL_InfoAccess_GetLocationType |
| 615 (ia, &iaType, plContext), | 623 (ia, &iaType, plContext), |
| 616 PKIX_INFOACCESSGETLOCATIONTYPEFAILED); | 624 PKIX_INFOACCESSGETLOCATIONTYPEFAILED); |
| 617 | 625 |
| 618 if (iaType == PKIX_INFOACCESS_LOCATION_HTTP) { | 626 if (iaType == PKIX_INFOACCESS_LOCATION_HTTP) { |
| 619 PKIX_CHECK(pkix_pl_AIAMgr_GetHTTPCerts | 627 PKIX_CHECK(pkix_pl_AIAMgr_GetHTTPCerts |
| 620 (aiaMgr, ia, &nbio, &certs, plContext), | 628 (aiaMgr, ia, &nbio, &certs, plContext), |
| 621 PKIX_AIAMGRGETHTTPCERTSFAILED); | 629 PKIX_AIAMGRGETHTTPCERTSFAILED); |
| 630 #ifndef NSS_PKIX_NO_LDAP |
| 622 } else if (iaType == PKIX_INFOACCESS_LOCATION_LDAP) { | 631 } else if (iaType == PKIX_INFOACCESS_LOCATION_LDAP) { |
| 623 PKIX_CHECK(pkix_pl_AIAMgr_GetLDAPCerts | 632 PKIX_CHECK(pkix_pl_AIAMgr_GetLDAPCerts |
| 624 (aiaMgr, ia, &nbio, &certs, plContext), | 633 (aiaMgr, ia, &nbio, &certs, plContext), |
| 625 PKIX_AIAMGRGETLDAPCERTSFAILED); | 634 PKIX_AIAMGRGETLDAPCERTSFAILED); |
| 635 #endif |
| 626 } else { | 636 } else { |
| 627 /* We only support http and ldap requests. */ | 637 /* We only support http and ldap requests. */ |
| 628 PKIX_DECREF(ia); | 638 PKIX_DECREF(ia); |
| 629 continue; | 639 continue; |
| 630 } | 640 } |
| 631 | 641 |
| 632 if (nbio != NULL) { /* WOULDBLOCK */ | 642 if (nbio != NULL) { /* WOULDBLOCK */ |
| 633 aiaMgr->aiaIndex = aiaIndex; | 643 aiaMgr->aiaIndex = aiaIndex; |
| 634 *pNBIOContext = nbio; | 644 *pNBIOContext = nbio; |
| 635 *pCerts = NULL; | 645 *pCerts = NULL; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 657 | 667 |
| 658 *pNBIOContext = NULL; | 668 *pNBIOContext = NULL; |
| 659 *pCerts = aiaMgr->results; | 669 *pCerts = aiaMgr->results; |
| 660 aiaMgr->results = NULL; | 670 aiaMgr->results = NULL; |
| 661 | 671 |
| 662 cleanup: | 672 cleanup: |
| 663 | 673 |
| 664 if (PKIX_ERROR_RECEIVED) { | 674 if (PKIX_ERROR_RECEIVED) { |
| 665 PKIX_DECREF(aiaMgr->aia); | 675 PKIX_DECREF(aiaMgr->aia); |
| 666 PKIX_DECREF(aiaMgr->results); | 676 PKIX_DECREF(aiaMgr->results); |
| 677 #ifndef NSS_PKIX_NO_LDAP |
| 667 PKIX_DECREF(aiaMgr->client.ldapClient); | 678 PKIX_DECREF(aiaMgr->client.ldapClient); |
| 679 #endif |
| 668 } | 680 } |
| 669 | 681 |
| 670 PKIX_DECREF(certs); | 682 PKIX_DECREF(certs); |
| 671 PKIX_DECREF(ia); | 683 PKIX_DECREF(ia); |
| 672 | 684 |
| 673 PKIX_RETURN(AIAMGR); | 685 PKIX_RETURN(AIAMGR); |
| 674 } | 686 } |
| OLD | NEW |