ReactOS 0.4.15-dev-7674-gc0b4db1
parse.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap_private.h"
#include "wldap32.h"
#include "wine/debug.h"
Include dependency graph for parse.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
ULONG CDECL ldap_parse_extended_resultA (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, PCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free)
 
ULONG CDECL ldap_parse_extended_resultW (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, PWCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free)
 
ULONG CDECL ldap_parse_referenceA (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, PCHAR **referrals)
 
ULONG CDECL ldap_parse_referenceW (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, PWCHAR **referrals)
 
ULONG CDECL ldap_parse_resultA (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, PCHAR *matched, PCHAR *error, PCHAR **referrals, PLDAPControlA **serverctrls, BOOLEAN free)
 
ULONG CDECL ldap_parse_resultW (WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, PWCHAR *matched, PWCHAR *error, PWCHAR **referrals, PLDAPControlW **serverctrls, BOOLEAN free)
 
ULONG CDECL ldap_parse_sort_controlA (WLDAP32_LDAP *ld, PLDAPControlA *control, ULONG *result, PCHAR *attr)
 
ULONG CDECL ldap_parse_sort_controlW (WLDAP32_LDAP *ld, PLDAPControlW *control, ULONG *result, PWCHAR *attr)
 
INT CDECL ldap_parse_vlv_controlA (WLDAP32_LDAP *ld, PLDAPControlA *control, PULONG targetpos, PULONG listcount, struct WLDAP32_berval **context, PINT errcode)
 
INT CDECL ldap_parse_vlv_controlW (WLDAP32_LDAP *ld, PLDAPControlW *control, PULONG targetpos, PULONG listcount, struct WLDAP32_berval **context, PINT errcode)
 

Function Documentation

◆ ldap_parse_extended_resultA()

ULONG CDECL ldap_parse_extended_resultA ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage result,
PCHAR oid,
struct WLDAP32_berval **  data,
BOOLEAN  free 
)

Definition at line 44 of file parse.c.

46{
48#ifdef HAVE_LDAP
49 WCHAR *oidW = NULL;
50
51 TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
52
53 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
55
57
58 if (oid) {
59 *oid = strWtoA( oidW );
60 if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
61 ldap_memfreeW( oidW );
62 }
63
64#endif
65 return ret;
66}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
void CDECL ldap_memfreeW(PWCHAR block)
Definition: misc.c:421
ULONG CDECL ldap_parse_extended_resultW(WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, PWCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free)
Definition: parse.c:88
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint64EXT * result
Definition: glext.h:11304
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59
int ret
@ WLDAP32_LDAP_PARAM_ERROR
@ WLDAP32_LDAP_NOT_SUPPORTED
@ WLDAP32_LDAP_NO_RESULTS_RETURNED
@ WLDAP32_LDAP_NO_MEMORY
static LPSTR strWtoA(LPCWSTR str)
Definition: wldap32.h:62
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ldap_parse_extended_resultW()

ULONG CDECL ldap_parse_extended_resultW ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage result,
PWCHAR oid,
struct WLDAP32_berval **  data,
BOOLEAN  free 
)

Definition at line 88 of file parse.c.

90{
92#ifdef HAVE_LDAP
93 char *oidU = NULL;
94
95 TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
96
97 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
99
100 ret = map_error( ldap_parse_extended_result( ld, result, &oidU, (struct berval **)data, free ) );
101
102 if (oid) {
103 *oid = strUtoW( oidU );
104 if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
105 ldap_memfree( oidU );
106 }
107
108#endif
109 return ret;
110}
static UINT map_error(DWORD error)
Definition: service.c:35
Definition: winber.h:32
#define ldap_parse_extended_result
Definition: winldap.h:672
#define ldap_memfree
Definition: winldap.h:688
static LPWSTR strUtoW(char *str)
Definition: wldap32.h:86

Referenced by ldap_parse_extended_resultA().

◆ ldap_parse_referenceA()

ULONG CDECL ldap_parse_referenceA ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage message,
PCHAR **  referrals 
)

Definition at line 117 of file parse.c.

119{
121#ifdef HAVE_LDAP
122 WCHAR **referralsW = NULL;
123
124 TRACE( "(%p, %p, %p)\n", ld, message, referrals );
125
126 if (!ld) return ~0u;
127
128 ret = ldap_parse_referenceW( ld, message, &referralsW );
129
130 *referrals = strarrayWtoA( referralsW );
131 ldap_value_freeW( referralsW );
132
133#endif
134 return ret;
135}
ULONG CDECL ldap_parse_referenceW(WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, PWCHAR **referrals)
Definition: parse.c:154
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
Definition: tftpd.h:60
ULONG CDECL ldap_value_freeW(PWCHAR *vals)
Definition: value.c:364
static LPSTR * strarrayWtoA(LPWSTR *strarray)
Definition: wldap32.h:154

◆ ldap_parse_referenceW()

ULONG CDECL ldap_parse_referenceW ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage message,
PWCHAR **  referrals 
)

Definition at line 154 of file parse.c.

156{
158#ifdef HAVE_LDAP_PARSE_REFERENCE
159 char **referralsU = NULL;
160
161 TRACE( "(%p, %p, %p)\n", ld, message, referrals );
162
163 if (!ld) return ~0u;
164
165 ret = map_error( ldap_parse_reference( ld, message, &referralsU, NULL, 0 ));
166
167 *referrals = strarrayUtoW( referralsU );
168 ldap_memfree( referralsU );
169
170#endif
171 return ret;
172}
#define ldap_parse_reference
Definition: winldap.h:674
static LPWSTR * strarrayUtoW(char **strarray)
Definition: wldap32.h:194

Referenced by ldap_parse_referenceA().

◆ ldap_parse_resultA()

ULONG CDECL ldap_parse_resultA ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage result,
ULONG retcode,
PCHAR matched,
PCHAR error,
PCHAR **  referrals,
PLDAPControlA **  serverctrls,
BOOLEAN  free 
)

Definition at line 179 of file parse.c.

182{
184#ifdef HAVE_LDAP
185 WCHAR *matchedW = NULL, *errorW = NULL, **referralsW = NULL;
186 LDAPControlW **serverctrlsW = NULL;
187
188 TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
189 matched, error, referrals, serverctrls, free );
190
191 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
192
193 ret = ldap_parse_resultW( ld, result, retcode, &matchedW, &errorW,
194 &referralsW, &serverctrlsW, free );
195
196 if (matched) *matched = strWtoA( matchedW );
197 if (error) *error = strWtoA( errorW );
198
199 if (referrals) *referrals = strarrayWtoA( referralsW );
200 if (serverctrls) *serverctrls = controlarrayWtoA( serverctrlsW );
201
202 ldap_memfreeW( matchedW );
204 ldap_value_freeW( referralsW );
205 ldap_controls_freeW( serverctrlsW );
206
207#endif
208 return ret;
209}
ULONG CDECL ldap_controls_freeW(LDAPControlW **controls)
Definition: control.c:107
ULONG CDECL ldap_parse_resultW(WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result, ULONG *retcode, PWCHAR *matched, PWCHAR *error, PWCHAR **referrals, PLDAPControlW **serverctrls, BOOLEAN free)
Definition: parse.c:236
static const WCHAR errorW[]
Definition: htmlevent.c:61
#define error(str)
Definition: mkdosfs.c:1605

Referenced by test_ldap_parse_sort_control().

◆ ldap_parse_resultW()

ULONG CDECL ldap_parse_resultW ( WLDAP32_LDAP ld,
WLDAP32_LDAPMessage result,
ULONG retcode,
PWCHAR matched,
PWCHAR error,
PWCHAR **  referrals,
PLDAPControlW **  serverctrls,
BOOLEAN  free 
)

Definition at line 236 of file parse.c.

239{
241#ifdef HAVE_LDAP
242 char *matchedU = NULL, *errorU = NULL, **referralsU = NULL;
243 LDAPControl **serverctrlsU = NULL;
244
245 TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
246 matched, error, referrals, serverctrls, free );
247
248 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
249
250 ret = map_error( ldap_parse_result( ld, result, (int *)retcode, &matchedU, &errorU,
251 &referralsU, &serverctrlsU, free ));
252
253 if (matched) *matched = strUtoW( matchedU );
254 if (error) *error = strUtoW( errorU );
255
256 if (referrals) *referrals = strarrayUtoW( referralsU );
257 if (serverctrls) *serverctrls = controlarrayUtoW( serverctrlsU );
258
259 ldap_memfree( matchedU );
260 ldap_memfree( errorU );
261 ldap_memvfree( (void **)referralsU );
262 ldap_controls_free( serverctrlsU );
263
264#endif
265 return ret;
266}
#define LDAPControl
Definition: winldap.h:620
#define ldap_parse_result
Definition: winldap.h:675
#define ldap_controls_free
Definition: winldap.h:686

Referenced by ldap_parse_resultA().

◆ ldap_parse_sort_controlA()

ULONG CDECL ldap_parse_sort_controlA ( WLDAP32_LDAP ld,
PLDAPControlA control,
ULONG result,
PCHAR attr 
)

Definition at line 273 of file parse.c.

275{
277#ifdef HAVE_LDAP
278 WCHAR *attrW = NULL;
280
281 TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
282
283 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
284 if (!control) return WLDAP32_LDAP_CONTROL_NOT_FOUND;
285
286 controlW = controlarrayAtoW( control );
287 if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
288
290
291 *attr = strWtoA( attrW );
292 controlarrayfreeW( controlW );
293
294#endif
295 return ret;
296}
ULONG CDECL ldap_parse_sort_controlW(WLDAP32_LDAP *ld, PLDAPControlW *control, ULONG *result, PWCHAR *attr)
Definition: parse.c:316
static const WCHAR controlW[]
Definition: actctx.c:658
Definition: cookie.c:202
@ WLDAP32_LDAP_CONTROL_NOT_FOUND

Referenced by test_ldap_parse_sort_control().

◆ ldap_parse_sort_controlW()

ULONG CDECL ldap_parse_sort_controlW ( WLDAP32_LDAP ld,
PLDAPControlW control,
ULONG result,
PWCHAR attr 
)

Definition at line 316 of file parse.c.

318{
320#ifdef HAVE_LDAP
321 char *attrU = NULL;
322 LDAPControl **controlU = NULL;
323#ifdef HAVE_LDAP_PARSE_SORT_CONTROL
324 unsigned long res;
325#elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL)
327 LDAPControl *sortcontrol = NULL;
328 unsigned int i;
329#endif
330
331 TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
332
333 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
334 if (!control) return WLDAP32_LDAP_CONTROL_NOT_FOUND;
335
336 controlU = controlarrayWtoU( control );
337 if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
338
339#ifdef HAVE_LDAP_PARSE_SORT_CONTROL
340 if (!(ret = ldap_parse_sort_control( ld, controlU, &res, &attrU )))
341 {
342 *result = res;
343 *attr = strUtoW( attrU );
344 }
345#elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL)
346 for (i = 0; controlU[i]; i++)
347 {
348 if (!strcmp( LDAP_SERVER_RESP_SORT_OID, controlU[i]->ldctl_oid ))
349 sortcontrol = controlU[i];
350 }
351 if (!sortcontrol)
352 {
353 controlarrayfreeU( controlU );
355 }
356 if (!(ret = ldap_parse_sortresponse_control( ld, sortcontrol, &res, &attrU )))
357 {
358 *result = res;
359 *attr = strUtoW( attrU );
360 }
361#endif
362 controlarrayfreeU( controlU );
363
364#endif
365 return map_error( ret );
366}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
INT ber_int_t
Definition: winber.h:39
#define ldap_parse_sort_control
Definition: winldap.h:676
#define LDAP_SERVER_RESP_SORT_OID

Referenced by ldap_parse_sort_controlA().

◆ ldap_parse_vlv_controlA()

INT CDECL ldap_parse_vlv_controlA ( WLDAP32_LDAP ld,
PLDAPControlA control,
PULONG  targetpos,
PULONG  listcount,
struct WLDAP32_berval **  context,
PINT  errcode 
)

Definition at line 373 of file parse.c.

376{
378#ifdef HAVE_LDAP
380
381 TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
382 listcount, context, errcode );
383
384 if (!ld) return ~0u;
385
386 if (control) {
387 controlW = controlarrayAtoW( control );
388 if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
389 }
390
391 ret = ldap_parse_vlv_controlW( ld, controlW, targetpos, listcount,
392 context, errcode );
393
394 controlarrayfreeW( controlW );
395
396#endif
397 return ret;
398}
int errcode
Definition: crtdefs.h:373
INT CDECL ldap_parse_vlv_controlW(WLDAP32_LDAP *ld, PLDAPControlW *control, PULONG targetpos, PULONG listcount, struct WLDAP32_berval **context, PINT errcode)
Definition: parse.c:420
Definition: http.c:7252

◆ ldap_parse_vlv_controlW()

INT CDECL ldap_parse_vlv_controlW ( WLDAP32_LDAP ld,
PLDAPControlW control,
PULONG  targetpos,
PULONG  listcount,
struct WLDAP32_berval **  context,
PINT  errcode 
)

Definition at line 420 of file parse.c.

423{
425#ifdef HAVE_LDAP
426 LDAPControl **controlU = NULL;
427#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
428 unsigned long pos, count;
429#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
431 LDAPControl *vlvcontrol = NULL;
432 unsigned int i;
433#endif
434
435 TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
436 listcount, context, errcode );
437
438 if (!ld || !control) return ~0u;
439
440 controlU = controlarrayWtoU( control );
441 if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
442
443#ifdef HAVE_LDAP_PARSE_VLV_CONTROL
444 if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count,
445 (struct berval **)context, errcode )))
446 {
447 *targetpos = pos;
448 *listcount = count;
449 }
450#elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL)
451 for (i = 0; controlU[i]; i++)
452 {
453 if (!strcmp( LDAP_CONTROL_VLVRESPONSE, controlU[i]->ldctl_oid ))
454 vlvcontrol = controlU[i];
455 }
456 if (!vlvcontrol)
457 {
458 controlarrayfreeU( controlU );
460 }
461 if (!(ret = ldap_parse_vlvresponse_control( ld, vlvcontrol, &pos, &count,
462 (struct berval **)context, errcode )))
463 {
464 *targetpos = pos;
465 *listcount = count;
466 }
467#endif
468 controlarrayfreeU( controlU );
469
470#endif
471 return map_error( ret );
472}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define ldap_parse_vlv_control
Definition: winldap.h:677
#define LDAP_CONTROL_VLVRESPONSE

Referenced by ldap_parse_vlv_controlA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )