ReactOS 0.4.15-dev-8138-g1e75ea8
compare.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 compare.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
ULONG CDECL ldap_compareA (WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value)
 
ULONG CDECL ldap_compareW (WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value)
 
ULONG CDECL ldap_compare_extA (WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value, struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message)
 
ULONG CDECL ldap_compare_extW (WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message)
 
ULONG CDECL ldap_compare_ext_sA (WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value, struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls)
 
ULONG CDECL ldap_compare_ext_sW (WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls)
 
ULONG CDECL ldap_compare_sA (WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value)
 
ULONG CDECL ldap_compare_sW (WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value)
 

Function Documentation

◆ ldap_compare_ext_sA()

ULONG CDECL ldap_compare_ext_sA ( WLDAP32_LDAP ld,
PCHAR  dn,
PCHAR  attr,
PCHAR  value,
struct WLDAP32_berval data,
PLDAPControlA serverctrls,
PLDAPControlA clientctrls 
)

Definition at line 288 of file compare.c.

290{
292#ifdef HAVE_LDAP
293 WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
294 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
295
297
298 TRACE( "(%p, %s, %s, %s, %p, %p, %p)\n", ld, debugstr_a(dn),
299 debugstr_a(attr), debugstr_a(value), data, serverctrls,
300 clientctrls );
301
302 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
303
304 if (dn) {
305 dnW = strAtoW( dn );
306 if (!dnW) goto exit;
307 }
308 if (attr) {
309 attrW = strAtoW( attr );
310 if (!attrW) goto exit;
311 }
312 if (value) {
313 valueW = strAtoW( value );
314 if (!valueW) goto exit;
315 }
316 if (serverctrls) {
317 serverctrlsW = controlarrayAtoW( serverctrls );
318 if (!serverctrlsW) goto exit;
319 }
320 if (clientctrls) {
321 clientctrlsW = controlarrayAtoW( clientctrls );
322 if (!clientctrlsW) goto exit;
323 }
324
325 ret = ldap_compare_ext_sW( ld, dnW, attrW, valueW, data, serverctrlsW,
326 clientctrlsW );
327
328exit:
329 strfreeW( dnW );
330 strfreeW( attrW );
331 strfreeW( valueW );
332 controlarrayfreeW( serverctrlsW );
333 controlarrayfreeW( clientctrlsW );
334
335#endif
336 return ret;
337}
ULONG CDECL ldap_compare_ext_sW(WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls)
Definition: compare.c:362
#define NULL
Definition: types.h:112
static const WCHAR valueW[]
Definition: object.c:48
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static LPWSTR strAtoW(const char *str)
#define debugstr_a
Definition: kernel32.h:31
#define exit(n)
Definition: config.h:202
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cookie.c:202
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
int ret
@ WLDAP32_LDAP_PARAM_ERROR
@ WLDAP32_LDAP_NOT_SUPPORTED
@ WLDAP32_LDAP_NO_MEMORY
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ldap_compare_ext_sW()

ULONG CDECL ldap_compare_ext_sW ( WLDAP32_LDAP ld,
PWCHAR  dn,
PWCHAR  attr,
PWCHAR  value,
struct WLDAP32_berval data,
PLDAPControlW serverctrls,
PLDAPControlW clientctrls 
)

Definition at line 362 of file compare.c.

364{
366#ifdef HAVE_LDAP
367 char *dnU = NULL, *attrU = NULL, *valueU = NULL;
368 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
369 struct berval val = { 0, NULL };
370
372
373 TRACE( "(%p, %s, %s, %s, %p, %p, %p)\n", ld, debugstr_w(dn),
374 debugstr_w(attr), debugstr_w(value), data, serverctrls,
375 clientctrls );
376
377 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
378
379 if (dn) {
380 dnU = strWtoU( dn );
381 if (!dnU) goto exit;
382 }
383 if (attr) {
384 attrU = strWtoU( attr );
385 if (!attrU) goto exit;
386 }
387 if (!data) {
388 if (value) {
389 valueU = strWtoU( value );
390 if (!valueU) goto exit;
391
392 val.bv_len = strlen( valueU );
393 val.bv_val = valueU;
394 }
395 }
396 if (serverctrls) {
397 serverctrlsU = controlarrayWtoU( serverctrls );
398 if (!serverctrlsU) goto exit;
399 }
400 if (clientctrls) {
401 clientctrlsU = controlarrayWtoU( clientctrls );
402 if (!clientctrlsU) goto exit;
403 }
404
405 ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "",
406 data ? (struct berval *)data : &val,
407 serverctrlsU, clientctrlsU ));
408
409exit:
410 strfreeU( dnU );
411 strfreeU( attrU );
412 strfreeU( valueU );
413 controlarrayfreeU( serverctrlsU );
414 controlarrayfreeU( clientctrlsU );
415
416#endif
417 return ret;
418}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static UINT map_error(DWORD error)
Definition: service.c:35
GLuint GLfloat * val
Definition: glext.h:7180
#define debugstr_w
Definition: kernel32.h:32
Definition: winber.h:32
#define LDAPControl
Definition: winldap.h:620
#define ldap_compare_ext_s
Definition: winldap.h:650
static void strfreeU(char *str)
Definition: wldap32.h:108
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74

Referenced by ldap_compare_ext_sA().

◆ ldap_compare_extA()

ULONG CDECL ldap_compare_extA ( WLDAP32_LDAP ld,
PCHAR  dn,
PCHAR  attr,
PCHAR  value,
struct WLDAP32_berval data,
PLDAPControlA serverctrls,
PLDAPControlA clientctrls,
ULONG message 
)

Definition at line 148 of file compare.c.

151{
153#ifdef HAVE_LDAP
154 WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
155 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
156
158
159 TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
160 debugstr_a(attr), debugstr_a(value), data, serverctrls,
161 clientctrls, message );
162
163 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
164
165 if (dn) {
166 dnW = strAtoW( dn );
167 if (!dnW) goto exit;
168 }
169 if (attr) {
170 attrW = strAtoW( attr );
171 if (!attrW) goto exit;
172 }
173 if (value) {
174 valueW = strAtoW( value );
175 if (!valueW) goto exit;
176 }
177 if (serverctrls) {
178 serverctrlsW = controlarrayAtoW( serverctrls );
179 if (!serverctrlsW) goto exit;
180 }
181 if (clientctrls) {
182 clientctrlsW = controlarrayAtoW( clientctrls );
183 if (!clientctrlsW) goto exit;
184 }
185
186 ret = ldap_compare_extW( ld, dnW, attrW, valueW, data,
187 serverctrlsW, clientctrlsW, message );
188
189exit:
190 strfreeW( dnW );
191 strfreeW( attrW );
192 strfreeW( valueW );
193 controlarrayfreeW( serverctrlsW );
194 controlarrayfreeW( clientctrlsW );
195
196#endif
197 return ret;
198}
ULONG CDECL ldap_compare_extW(WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message)
Definition: compare.c:224
Definition: tftpd.h:60

◆ ldap_compare_extW()

ULONG CDECL ldap_compare_extW ( WLDAP32_LDAP ld,
PWCHAR  dn,
PWCHAR  attr,
PWCHAR  value,
struct WLDAP32_berval data,
PLDAPControlW serverctrls,
PLDAPControlW clientctrls,
ULONG message 
)

Definition at line 224 of file compare.c.

227{
229#ifdef HAVE_LDAP
230 char *dnU = NULL, *attrU = NULL, *valueU = NULL;
231 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
232 struct berval val = { 0, NULL };
233
235
236 TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
237 debugstr_w(attr), debugstr_w(value), data, serverctrls,
238 clientctrls, message );
239
240 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
241 if (!attr) return WLDAP32_LDAP_NO_MEMORY;
242
243 if (dn) {
244 dnU = strWtoU( dn );
245 if (!dnU) goto exit;
246 }
247
248 attrU = strWtoU( attr );
249 if (!attrU) goto exit;
250
251 if (!data) {
252 if (value) {
253 valueU = strWtoU( value );
254 if (!valueU) goto exit;
255
256 val.bv_len = strlen( valueU );
257 val.bv_val = valueU;
258 }
259 }
260 if (serverctrls) {
261 serverctrlsU = controlarrayWtoU( serverctrls );
262 if (!serverctrlsU) goto exit;
263 }
264 if (clientctrls) {
265 clientctrlsU = controlarrayWtoU( clientctrls );
266 if (!clientctrlsU) goto exit;
267 }
268
269 ret = map_error( ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
270 serverctrlsU, clientctrlsU, (int *)message ));
271
272exit:
273 strfreeU( dnU );
274 strfreeU( attrU );
275 strfreeU( valueU );
276 controlarrayfreeU( serverctrlsU );
277 controlarrayfreeU( clientctrlsU );
278
279#endif
280 return ret;
281}
#define ldap_compare_ext
Definition: winldap.h:648

Referenced by ldap_compare_extA().

◆ ldap_compare_sA()

ULONG CDECL ldap_compare_sA ( WLDAP32_LDAP ld,
PCHAR  dn,
PCHAR  attr,
PCHAR  value 
)

Definition at line 425 of file compare.c.

426{
428#ifdef HAVE_LDAP
429 WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
430
432
433 TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(attr),
434 debugstr_a(value) );
435
436 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
437
438 if (dn) {
439 dnW = strAtoW( dn );
440 if (!dnW) goto exit;
441 }
442 if (attr) {
443 attrW = strAtoW( attr );
444 if (!attrW) goto exit;
445 }
446 if (value) {
447 valueW = strAtoW( value );
448 if (!valueW) goto exit;
449 }
450
451 ret = ldap_compare_sW( ld, dnW, attrW, valueW );
452
453exit:
454 strfreeW( dnW );
455 strfreeW( attrW );
456 strfreeW( valueW );
457
458#endif
459 return ret;
460}
ULONG CDECL ldap_compare_sW(WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value)
Definition: compare.c:477

◆ ldap_compare_sW()

ULONG CDECL ldap_compare_sW ( WLDAP32_LDAP ld,
PWCHAR  dn,
PWCHAR  attr,
PWCHAR  value 
)

Definition at line 477 of file compare.c.

478{
480#ifdef HAVE_LDAP
481 char *dnU = NULL, *attrU = NULL, *valueU = NULL;
482 struct berval val = { 0, NULL };
483
485
486 TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(attr),
487 debugstr_w(value) );
488
489 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
490
491 if (dn) {
492 dnU = strWtoU( dn );
493 if (!dnU) goto exit;
494 }
495 if (attr) {
496 attrU = strWtoU( attr );
497 if (!attrU) goto exit;
498 }
499 if (value) {
500 valueU = strWtoU( value );
501 if (!valueU) goto exit;
502
503 val.bv_len = strlen( valueU );
504 val.bv_val = valueU;
505 }
506
507 ret = map_error( ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL ));
508
509exit:
510 strfreeU( dnU );
511 strfreeU( attrU );
512 strfreeU( valueU );
513
514#endif
515 return ret;
516}

Referenced by ldap_compare_sA().

◆ ldap_compareA()

ULONG CDECL ldap_compareA ( WLDAP32_LDAP ld,
PCHAR  dn,
PCHAR  attr,
PCHAR  value 
)

Definition at line 44 of file compare.c.

45{
47#ifdef HAVE_LDAP
48 WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
49
50 ret = ~0u;
51
52 TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(attr),
54
55 if (!ld || !attr) return ~0u;
56
57 if (dn) {
58 dnW = strAtoW( dn );
59 if (!dnW) goto exit;
60 }
61
62 attrW = strAtoW( attr );
63 if (!attrW) goto exit;
64
65 if (value) {
66 valueW = strAtoW( value );
67 if (!valueW) goto exit;
68 }
69
70 ret = ldap_compareW( ld, dnW, attrW, valueW );
71
72exit:
73 strfreeW( dnW );
74 strfreeW( attrW );
76
77#endif
78 return ret;
79}
ULONG CDECL ldap_compareW(WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value)
Definition: compare.c:96
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

◆ ldap_compareW()

ULONG CDECL ldap_compareW ( WLDAP32_LDAP ld,
PWCHAR  dn,
PWCHAR  attr,
PWCHAR  value 
)

Definition at line 96 of file compare.c.

97{
99#ifdef HAVE_LDAP
100 char *dnU = NULL, *attrU = NULL, *valueU = NULL;
101 struct berval val = { 0, NULL };
102 int msg;
103
104 ret = ~0u;
105
106 TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(attr),
107 debugstr_w(value) );
108
109 if (!ld || !attr) return ~0u;
110
111 if (dn) {
112 dnU = strWtoU( dn );
113 if (!dnU) goto exit;
114 }
115
116 attrU = strWtoU( attr );
117 if (!attrU) goto exit;
118
119 if (value) {
120 valueU = strWtoU( value );
121 if (!valueU) goto exit;
122
123 val.bv_len = strlen( valueU );
124 val.bv_val = valueU;
125 }
126
127 ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, &val, NULL, NULL, &msg );
128
129 if (ret == LDAP_SUCCESS)
130 ret = msg;
131 else
132 ret = ~0u;
133
134exit:
135 strfreeU( dnU );
136 strfreeU( attrU );
137 strfreeU( valueU );
138
139#endif
140 return ret;
141}
#define msg(x)
Definition: auth_time.c:54
#define LDAP_SUCCESS
Definition: winldap.h:59

Referenced by ldap_compareA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )