Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_ldapdefaultclient.c

Issue 16132005: Allow NSS to be built with NO_NSPR_10_SUPPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_ldapdefaultclient.c 5 * pkix_pl_ldapdefaultclient.c
6 * 6 *
7 * LDAPDefaultClient Function Definitions 7 * LDAPDefaultClient Function Definitions
8 * 8 *
9 */ 9 */
10 10
(...skipping 14 matching lines...) Expand all
25 * "msgNum", and stores a pointer to the encoded string at "pBindMsg". 25 * "msgNum", and stores a pointer to the encoded string at "pBindMsg".
26 * 26 *
27 * See pkix_pl_ldaptemplates.c for the ASN.1 description of a Bind message. 27 * See pkix_pl_ldaptemplates.c for the ASN.1 description of a Bind message.
28 * 28 *
29 * This code is not used if the DefaultClient was created with a NULL pointer 29 * This code is not used if the DefaultClient was created with a NULL pointer
30 * supplied for the LDAPBindAPI structure. (Bind and Unbind do not seem to be 30 * supplied for the LDAPBindAPI structure. (Bind and Unbind do not seem to be
31 * expected for anonymous Search requests.) 31 * expected for anonymous Search requests.)
32 * 32 *
33 * PARAMETERS: 33 * PARAMETERS:
34 * "arena" 34 * "arena"
35 * The address of the PRArenaPool used in encoding the message. Must be 35 * The address of the PLArenaPool used in encoding the message. Must be
36 * non-NULL. 36 * non-NULL.
37 * "versionData" 37 * "versionData"
38 * The Int32 containing the version number to be encoded in the Bind 38 * The Int32 containing the version number to be encoded in the Bind
39 * message. 39 * message.
40 * "bindAPI" 40 * "bindAPI"
41 * The address of the LDAPBindAPI to be encoded in the Bind message. Must 41 * The address of the LDAPBindAPI to be encoded in the Bind message. Must
42 * be non-NULL. 42 * be non-NULL.
43 * "msgNum" 43 * "msgNum"
44 * The Int32 containing the MessageID to be encoded in the Bind message. 44 * The Int32 containing the MessageID to be encoded in the Bind message.
45 * "pBindMsg" 45 * "pBindMsg"
46 * The address at which the encoded Bind message will be stored. Must be 46 * The address at which the encoded Bind message will be stored. Must be
47 * non-NULL. 47 * non-NULL.
48 * "plContext" 48 * "plContext"
49 * Platform-specific context pointer. 49 * Platform-specific context pointer.
50 * THREAD SAFETY: 50 * THREAD SAFETY:
51 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) 51 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
52 * RETURNS: 52 * RETURNS:
53 * Returns NULL if the function succeeds. 53 * Returns NULL if the function succeeds.
54 * Returns a LdapDefaultClient Error if the function fails in a 54 * Returns a LdapDefaultClient Error if the function fails in a
55 * non-fatal way. 55 * non-fatal way.
56 * Returns a Fatal Error if the function fails in an unrecoverable way. 56 * Returns a Fatal Error if the function fails in an unrecoverable way.
57 */ 57 */
58 static PKIX_Error * 58 static PKIX_Error *
59 pkix_pl_LdapDefaultClient_MakeBind( 59 pkix_pl_LdapDefaultClient_MakeBind(
60 PRArenaPool *arena, 60 PLArenaPool *arena,
61 PKIX_Int32 versionData, 61 PKIX_Int32 versionData,
62 LDAPBindAPI *bindAPI, 62 LDAPBindAPI *bindAPI,
63 PKIX_UInt32 msgNum, 63 PKIX_UInt32 msgNum,
64 SECItem **pBindMsg, 64 SECItem **pBindMsg,
65 void *plContext) 65 void *plContext)
66 { 66 {
67 LDAPMessage msg; 67 LDAPMessage msg;
68 char version = '\0'; 68 char version = '\0';
69 SECItem *encoded = NULL; 69 SECItem *encoded = NULL;
70 PKIX_UInt32 len = 0; 70 PKIX_UInt32 len = 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * to the encoded string at "pUnbindMsg". 128 * to the encoded string at "pUnbindMsg".
129 * 129 *
130 * See pkix_pl_ldaptemplates.c for the ASN.1 description of an Unbind message. 130 * See pkix_pl_ldaptemplates.c for the ASN.1 description of an Unbind message.
131 * 131 *
132 * This code is not used if the DefaultClient was created with a NULL pointer 132 * This code is not used if the DefaultClient was created with a NULL pointer
133 * supplied for the LDAPBindAPI structure. (Bind and Unbind do not seem to be 133 * supplied for the LDAPBindAPI structure. (Bind and Unbind do not seem to be
134 * expected for anonymous Search requests.) 134 * expected for anonymous Search requests.)
135 * 135 *
136 * PARAMETERS: 136 * PARAMETERS:
137 * "arena" 137 * "arena"
138 * The address of the PRArenaPool used in encoding the message. Must be 138 * The address of the PLArenaPool used in encoding the message. Must be
139 * non-NULL. 139 * non-NULL.
140 * "msgNum" 140 * "msgNum"
141 * The Int32 containing the MessageID to be encoded in the Unbind message. 141 * The Int32 containing the MessageID to be encoded in the Unbind message.
142 * "pUnbindMsg" 142 * "pUnbindMsg"
143 * The address at which the encoded Unbind message will be stored. Must 143 * The address at which the encoded Unbind message will be stored. Must
144 * be non-NULL. 144 * be non-NULL.
145 * "plContext" 145 * "plContext"
146 * Platform-specific context pointer. 146 * Platform-specific context pointer.
147 * THREAD SAFETY: 147 * THREAD SAFETY:
148 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) 148 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
149 * RETURNS: 149 * RETURNS:
150 * Returns NULL if the function succeeds. 150 * Returns NULL if the function succeeds.
151 * Returns a LdapDefaultClient Error if the function fails in a 151 * Returns a LdapDefaultClient Error if the function fails in a
152 * non-fatal way. 152 * non-fatal way.
153 * Returns a Fatal Error if the function fails in an unrecoverable way. 153 * Returns a Fatal Error if the function fails in an unrecoverable way.
154 */ 154 */
155 static PKIX_Error * 155 static PKIX_Error *
156 pkix_pl_LdapDefaultClient_MakeUnbind( 156 pkix_pl_LdapDefaultClient_MakeUnbind(
157 PRArenaPool *arena, 157 PLArenaPool *arena,
158 PKIX_UInt32 msgNum, 158 PKIX_UInt32 msgNum,
159 SECItem **pUnbindMsg, 159 SECItem **pUnbindMsg,
160 void *plContext) 160 void *plContext)
161 { 161 {
162 LDAPMessage msg; 162 LDAPMessage msg;
163 SECItem *encoded = NULL; 163 SECItem *encoded = NULL;
164 164
165 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_MakeUnbind"); 165 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_MakeUnbind");
166 PKIX_NULLCHECK_TWO(arena, pUnbindMsg); 166 PKIX_NULLCHECK_TWO(arena, pUnbindMsg);
167 167
(...skipping 27 matching lines...) Expand all
195 * DESCRIPTION: 195 * DESCRIPTION:
196 * 196 *
197 * This function creates and encodes a Abandon message, using the arena pointed 197 * This function creates and encodes a Abandon message, using the arena pointed
198 * to by "arena" and the messageID contained in "msgNum", and stores a pointer 198 * to by "arena" and the messageID contained in "msgNum", and stores a pointer
199 * to the encoded string at "pAbandonMsg". 199 * to the encoded string at "pAbandonMsg".
200 * 200 *
201 * See pkix_pl_ldaptemplates.c for the ASN.1 description of an Abandon message. 201 * See pkix_pl_ldaptemplates.c for the ASN.1 description of an Abandon message.
202 * 202 *
203 * PARAMETERS: 203 * PARAMETERS:
204 * "arena" 204 * "arena"
205 * The address of the PRArenaPool used in encoding the message. Must be 205 * The address of the PLArenaPool used in encoding the message. Must be
206 * non-NULL. 206 * non-NULL.
207 * "msgNum" 207 * "msgNum"
208 * The Int32 containing the MessageID to be encoded in the Abandon message. 208 * The Int32 containing the MessageID to be encoded in the Abandon message.
209 * "pAbandonMsg" 209 * "pAbandonMsg"
210 * The address at which the encoded Abandon message will be stored. Must 210 * The address at which the encoded Abandon message will be stored. Must
211 * be non-NULL. 211 * be non-NULL.
212 * "plContext" 212 * "plContext"
213 * Platform-specific context pointer. 213 * Platform-specific context pointer.
214 * THREAD SAFETY: 214 * THREAD SAFETY:
215 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) 215 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
216 * RETURNS: 216 * RETURNS:
217 * Returns NULL if the function succeeds. 217 * Returns NULL if the function succeeds.
218 * Returns a LdapDefaultClient Error if the function fails in a 218 * Returns a LdapDefaultClient Error if the function fails in a
219 * non-fatal way. 219 * non-fatal way.
220 * Returns a Fatal Error if the function fails in an unrecoverable way. 220 * Returns a Fatal Error if the function fails in an unrecoverable way.
221 */ 221 */
222 static PKIX_Error * 222 static PKIX_Error *
223 pkix_pl_LdapDefaultClient_MakeAbandon( 223 pkix_pl_LdapDefaultClient_MakeAbandon(
224 PRArenaPool *arena, 224 PLArenaPool *arena,
225 PKIX_UInt32 msgNum, 225 PKIX_UInt32 msgNum,
226 SECItem **pAbandonMsg, 226 SECItem **pAbandonMsg,
227 void *plContext) 227 void *plContext)
228 { 228 {
229 LDAPMessage msg; 229 LDAPMessage msg;
230 SECItem *encoded = NULL; 230 SECItem *encoded = NULL;
231 231
232 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_MakeAbandon"); 232 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_MakeAbandon");
233 PKIX_NULLCHECK_TWO(arena, pAbandonMsg); 233 PKIX_NULLCHECK_TWO(arena, pAbandonMsg);
234 234
(...skipping 25 matching lines...) Expand all
260 /* 260 /*
261 * FUNCTION: pkix_pl_LdapDefaultClient_DecodeBindResponse 261 * FUNCTION: pkix_pl_LdapDefaultClient_DecodeBindResponse
262 * DESCRIPTION: 262 * DESCRIPTION:
263 * 263 *
264 * This function decodes the encoded data pointed to by "src", using the arena 264 * This function decodes the encoded data pointed to by "src", using the arena
265 * pointed to by "arena", storing the decoded LDAPMessage at "pBindResponse" 265 * pointed to by "arena", storing the decoded LDAPMessage at "pBindResponse"
266 * and the decoding status at "pStatus". 266 * and the decoding status at "pStatus".
267 * 267 *
268 * PARAMETERS: 268 * PARAMETERS:
269 * "arena" 269 * "arena"
270 * The address of the PRArenaPool to be used in decoding the message. Must 270 * The address of the PLArenaPool to be used in decoding the message. Must
271 * be non-NULL. 271 * be non-NULL.
272 * "src" 272 * "src"
273 * The address of the SECItem containing the DER- (or BER-)encoded string. 273 * The address of the SECItem containing the DER- (or BER-)encoded string.
274 * Must be non-NULL. 274 * Must be non-NULL.
275 * "pBindResponse" 275 * "pBindResponse"
276 * The address at which the LDAPMessage is stored, if the decoding is 276 * The address at which the LDAPMessage is stored, if the decoding is
277 * successful (the returned status is SECSuccess). Must be non-NULL. 277 * successful (the returned status is SECSuccess). Must be non-NULL.
278 * "pStatus" 278 * "pStatus"
279 * The address at which the decoding status is stored. Must be non-NULL. 279 * The address at which the decoding status is stored. Must be non-NULL.
280 * "plContext" 280 * "plContext"
281 * Platform-specific context pointer. 281 * Platform-specific context pointer.
282 * THREAD SAFETY: 282 * THREAD SAFETY:
283 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) 283 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
284 * RETURNS: 284 * RETURNS:
285 * Returns NULL if the function succeeds. 285 * Returns NULL if the function succeeds.
286 * Returns a LdapDefaultClient Error if the function fails in a 286 * Returns a LdapDefaultClient Error if the function fails in a
287 * non-fatal way. 287 * non-fatal way.
288 * Returns a Fatal Error if the function fails in an unrecoverable way. 288 * Returns a Fatal Error if the function fails in an unrecoverable way.
289 */ 289 */
290 static PKIX_Error * 290 static PKIX_Error *
291 pkix_pl_LdapDefaultClient_DecodeBindResponse( 291 pkix_pl_LdapDefaultClient_DecodeBindResponse(
292 PRArenaPool *arena, 292 PLArenaPool *arena,
293 SECItem *src, 293 SECItem *src,
294 LDAPMessage *pBindResponse, 294 LDAPMessage *pBindResponse,
295 SECStatus *pStatus, 295 SECStatus *pStatus,
296 void *plContext) 296 void *plContext)
297 { 297 {
298 SECStatus rv = SECFailure; 298 SECStatus rv = SECFailure;
299 LDAPMessage response; 299 LDAPMessage response;
300 300
301 PKIX_ENTER 301 PKIX_ENTER
302 (LDAPDEFAULTCLIENT, 302 (LDAPDEFAULTCLIENT,
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 pkix_pl_LdapDefaultClient_CreateHelper( 569 pkix_pl_LdapDefaultClient_CreateHelper(
570 PKIX_PL_Socket *socket, 570 PKIX_PL_Socket *socket,
571 LDAPBindAPI *bindAPI, 571 LDAPBindAPI *bindAPI,
572 PKIX_PL_LdapDefaultClient **pClient, 572 PKIX_PL_LdapDefaultClient **pClient,
573 void *plContext) 573 void *plContext)
574 { 574 {
575 PKIX_PL_HashTable *ht; 575 PKIX_PL_HashTable *ht;
576 PKIX_PL_LdapDefaultClient *ldapDefaultClient = NULL; 576 PKIX_PL_LdapDefaultClient *ldapDefaultClient = NULL;
577 PKIX_PL_Socket_Callback *callbackList; 577 PKIX_PL_Socket_Callback *callbackList;
578 PRFileDesc *fileDesc = NULL; 578 PRFileDesc *fileDesc = NULL;
579 PRArenaPool *arena = NULL; 579 PLArenaPool *arena = NULL;
580 580
581 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_CreateHelper"); 581 PKIX_ENTER(LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_CreateHelper");
582 PKIX_NULLCHECK_TWO(socket, pClient); 582 PKIX_NULLCHECK_TWO(socket, pClient);
583 583
584 PKIX_CHECK(PKIX_PL_Object_Alloc 584 PKIX_CHECK(PKIX_PL_Object_Alloc
585 (PKIX_LDAPDEFAULTCLIENT_TYPE, 585 (PKIX_LDAPDEFAULTCLIENT_TYPE,
586 sizeof (PKIX_PL_LdapDefaultClient), 586 sizeof (PKIX_PL_LdapDefaultClient),
587 (PKIX_PL_Object **)&ldapDefaultClient, 587 (PKIX_PL_Object **)&ldapDefaultClient,
588 plContext), 588 plContext),
589 PKIX_COULDNOTCREATELDAPDEFAULTCLIENTOBJECT); 589 PKIX_COULDNOTCREATELDAPDEFAULTCLIENTOBJECT);
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 /* 2142 /*
2143 * FUNCTION: pkix_pl_LdapDefaultClient_MakeAndFilter 2143 * FUNCTION: pkix_pl_LdapDefaultClient_MakeAndFilter
2144 * DESCRIPTION: 2144 * DESCRIPTION:
2145 * 2145 *
2146 * This function allocates space from the arena pointed to by "arena" to 2146 * This function allocates space from the arena pointed to by "arena" to
2147 * construct a filter that will match components of the X500Name pointed to by 2147 * construct a filter that will match components of the X500Name pointed to by
2148 * XXX... 2148 * XXX...
2149 * 2149 *
2150 * PARAMETERS: 2150 * PARAMETERS:
2151 * "arena" 2151 * "arena"
2152 * The address of the PRArenaPool used in creating the filter. Must be 2152 * The address of the PLArenaPool used in creating the filter. Must be
2153 * non-NULL. 2153 * non-NULL.
2154 * "nameComponent" 2154 * "nameComponent"
2155 * The address of a NULL-terminated list of LDAPNameComponents 2155 * The address of a NULL-terminated list of LDAPNameComponents
2156 * Must be non-NULL. 2156 * Must be non-NULL.
2157 * "pFilter" 2157 * "pFilter"
2158 * The address at which the result is stored. 2158 * The address at which the result is stored.
2159 * "plContext" 2159 * "plContext"
2160 * Platform-specific context pointer 2160 * Platform-specific context pointer
2161 * THREAD SAFETY: 2161 * THREAD SAFETY:
2162 * Thread Safe (see Thread Safety Definitions in Programmer's Guide) 2162 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
2163 * RETURNS: 2163 * RETURNS:
2164 * Returns NULL if the function succeeds. 2164 * Returns NULL if the function succeeds.
2165 * Returns a CertStore Error if the function fails in a non-fatal way. 2165 * Returns a CertStore Error if the function fails in a non-fatal way.
2166 * Returns a Fatal Error if the function fails in an unrecoverable way. 2166 * Returns a Fatal Error if the function fails in an unrecoverable way.
2167 */ 2167 */
2168 static PKIX_Error * 2168 static PKIX_Error *
2169 pkix_pl_LdapDefaultClient_MakeAndFilter( 2169 pkix_pl_LdapDefaultClient_MakeAndFilter(
2170 PRArenaPool *arena, 2170 PLArenaPool *arena,
2171 LDAPNameComponent **nameComponents, 2171 LDAPNameComponent **nameComponents,
2172 LDAPFilter **pFilter, 2172 LDAPFilter **pFilter,
2173 void *plContext) 2173 void *plContext)
2174 { 2174 {
2175 LDAPFilter **setOfFilter; 2175 LDAPFilter **setOfFilter;
2176 LDAPFilter *andFilter = NULL; 2176 LDAPFilter *andFilter = NULL;
2177 LDAPFilter *currentFilter = NULL; 2177 LDAPFilter *currentFilter = NULL;
2178 PKIX_UInt32 componentsPresent = 0; 2178 PKIX_UInt32 componentsPresent = 0;
2179 void *v = NULL; 2179 void *v = NULL;
2180 unsigned char *component = NULL; 2180 unsigned char *component = NULL;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 PKIX_DECREF(client->entriesFound); 2484 PKIX_DECREF(client->entriesFound);
2485 PKIX_DECREF(client->currentRequest); 2485 PKIX_DECREF(client->currentRequest);
2486 PKIX_DECREF(client->currentResponse); 2486 PKIX_DECREF(client->currentResponse);
2487 2487
2488 cleanup: 2488 cleanup:
2489 2489
2490 PKIX_DECREF(client); 2490 PKIX_DECREF(client);
2491 2491
2492 PKIX_RETURN(CERTSTORE); 2492 PKIX_RETURN(CERTSTORE);
2493 } 2493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698