| 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 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 * 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 |
| 130 * 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 |
| 131 * collection, and then stored at "pClient". | 131 * collection, and then stored at "pClient". |
| 132 * | 132 * |
| 133 * PARAMETERS: | 133 * PARAMETERS: |
| 134 * "aiaMgr" | 134 * "aiaMgr" |
| 135 * The AIAMgr whose LDAPClient connected are to be managed. Must be | 135 * The AIAMgr whose LDAPClient connected are to be managed. Must be |
| 136 * non-NULL. | 136 * non-NULL. |
| 137 * "domainName" | 137 * "domainName" |
| 138 * Address of a string pointing to a server name. Must be non-NULL. | 138 * Address of a string pointing to a server name. Must be non-NULL. |
| 139 * An empty string (which means no <host> is given in the LDAP URL) is |
| 140 * not supported. |
| 139 * "pClient" | 141 * "pClient" |
| 140 * Address at which the returned LDAPClient is stored. Must be non-NULL. | 142 * Address at which the returned LDAPClient is stored. Must be non-NULL. |
| 141 * "plContext" | 143 * "plContext" |
| 142 * Platform-specific context pointer. | 144 * Platform-specific context pointer. |
| 143 * THREAD SAFETY: | 145 * THREAD SAFETY: |
| 144 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) | 146 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
| 145 * RETURNS: | 147 * RETURNS: |
| 146 * Returns NULL if the function succeeds. | 148 * Returns NULL if the function succeeds. |
| 147 * Returns an AIAMgr Error if the function fails in a non-fatal way | 149 * Returns an AIAMgr Error if the function fails in a non-fatal way |
| 148 * Returns a Fatal Error if the function fails in an unrecoverable way. | 150 * Returns a Fatal Error if the function fails in an unrecoverable way. |
| 149 */ | 151 */ |
| 150 static PKIX_Error * | 152 static PKIX_Error * |
| 151 pkix_pl_AiaMgr_FindLDAPClient( | 153 pkix_pl_AiaMgr_FindLDAPClient( |
| 152 PKIX_PL_AIAMgr *aiaMgr, | 154 PKIX_PL_AIAMgr *aiaMgr, |
| 153 char *domainName, | 155 char *domainName, |
| 154 PKIX_PL_LdapClient **pClient, | 156 PKIX_PL_LdapClient **pClient, |
| 155 void *plContext) | 157 void *plContext) |
| 156 { | 158 { |
| 157 PKIX_PL_String *domainString = NULL; | 159 PKIX_PL_String *domainString = NULL; |
| 158 PKIX_PL_LdapDefaultClient *client = NULL; | 160 PKIX_PL_LdapDefaultClient *client = NULL; |
| 159 | 161 |
| 160 PKIX_ENTER(AIAMGR, "pkix_pl_AiaMgr_FindLDAPClient"); | 162 PKIX_ENTER(AIAMGR, "pkix_pl_AiaMgr_FindLDAPClient"); |
| 161 PKIX_NULLCHECK_THREE(aiaMgr, domainName, pClient); | 163 PKIX_NULLCHECK_THREE(aiaMgr, domainName, pClient); |
| 162 | 164 |
| 165 /* |
| 166 * An LDAP URL may not have a <host> part, for example, |
| 167 * ldap:///o=University%20of%20Michigan,c=US |
| 168 * PKIX_PL_LdapDefaultClient doesn't know how to discover the default |
| 169 * LDAP server, so we don't support this kind of LDAP URL. |
| 170 */ |
| 171 if (*domainName == '\0') { |
| 172 /* Simulate a PKIX_PL_LdapDefaultClient_CreateByName failure. */ |
| 173 PKIX_ERROR(PKIX_LDAPDEFAULTCLIENTCREATEBYNAMEFAILED); |
| 174 } |
| 175 |
| 163 /* create PKIX_PL_String from domain name */ | 176 /* create PKIX_PL_String from domain name */ |
| 164 PKIX_CHECK(PKIX_PL_String_Create | 177 PKIX_CHECK(PKIX_PL_String_Create |
| 165 (PKIX_ESCASCII, domainName, 0, &domainString, plContext), | 178 (PKIX_ESCASCII, domainName, 0, &domainString, plContext), |
| 166 PKIX_STRINGCREATEFAILED); | 179 PKIX_STRINGCREATEFAILED); |
| 167 | 180 |
| 168 /* Is this domainName already in cache? */ | 181 /* Is this domainName already in cache? */ |
| 169 PKIX_CHECK(PKIX_PL_HashTable_Lookup | 182 PKIX_CHECK(PKIX_PL_HashTable_Lookup |
| 170 (aiaConnectionCache, | 183 (aiaConnectionCache, |
| 171 (PKIX_PL_Object *)domainString, | 184 (PKIX_PL_Object *)domainString, |
| 172 (PKIX_PL_Object **)&client, | 185 (PKIX_PL_Object **)&client, |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 #ifndef NSS_PKIX_NO_LDAP | 690 #ifndef NSS_PKIX_NO_LDAP |
| 678 PKIX_DECREF(aiaMgr->client.ldapClient); | 691 PKIX_DECREF(aiaMgr->client.ldapClient); |
| 679 #endif | 692 #endif |
| 680 } | 693 } |
| 681 | 694 |
| 682 PKIX_DECREF(certs); | 695 PKIX_DECREF(certs); |
| 683 PKIX_DECREF(ia); | 696 PKIX_DECREF(ia); |
| 684 | 697 |
| 685 PKIX_RETURN(AIAMGR); | 698 PKIX_RETURN(AIAMGR); |
| 686 } | 699 } |
| OLD | NEW |