ReactOS 0.4.15-dev-8145-ga541a46
init.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/winternl.h"
#include "winldap_private.h"
#include "wldap32.h"
#include "wine/debug.h"
Include dependency graph for init.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wldap32)
 
WLDAP32_LDAP *CDECL cldap_openA (PCHAR hostname, ULONG portnumber)
 
WLDAP32_LDAP *CDECL cldap_openW (PWCHAR hostname, ULONG portnumber)
 
ULONG CDECL ldap_connect (WLDAP32_LDAP *ld, struct l_timeval *timeout)
 
WLDAP32_LDAP *CDECL ldap_initA (const PCHAR hostname, ULONG portnumber)
 
WLDAP32_LDAP *CDECL ldap_initW (const PWCHAR hostname, ULONG portnumber)
 
WLDAP32_LDAP *CDECL ldap_openA (PCHAR hostname, ULONG portnumber)
 
WLDAP32_LDAP *CDECL ldap_openW (PWCHAR hostname, ULONG portnumber)
 
WLDAP32_LDAP *CDECL ldap_sslinitA (PCHAR hostname, ULONG portnumber, int secure)
 
WLDAP32_LDAP *CDECL ldap_sslinitW (PWCHAR hostname, ULONG portnumber, int secure)
 
ULONG CDECL ldap_start_tls_sA (WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls)
 
ULONG CDECL ldap_start_tls_sW (WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls)
 
ULONG CDECL ldap_startup (PLDAP_VERSION_INFO version, HANDLE *instance)
 
BOOLEAN CDECL ldap_stop_tls_s (WLDAP32_LDAP *ld)
 

Function Documentation

◆ cldap_openA()

WLDAP32_LDAP *CDECL cldap_openA ( PCHAR  hostname,
ULONG  portnumber 
)

Definition at line 223 of file init.c.

224{
225#ifdef HAVE_LDAP
226 WLDAP32_LDAP *ld = NULL;
227 WCHAR *hostnameW = NULL;
228
229 TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
230
231 if (hostname) {
232 hostnameW = strAtoW( hostname );
233 if (!hostnameW) goto exit;
234 }
235
236 ld = cldap_openW( hostnameW, portnumber );
237
238exit:
239 strfreeW( hostnameW );
240 return ld;
241
242#else
243 return NULL;
244#endif
245}
char * hostname
Definition: ftp.c:88
#define NULL
Definition: types.h:112
WLDAP32_LDAP *CDECL cldap_openW(PWCHAR hostname, ULONG portnumber)
Definition: init.c:268
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
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ cldap_openW()

WLDAP32_LDAP *CDECL cldap_openW ( PWCHAR  hostname,
ULONG  portnumber 
)

Definition at line 268 of file init.c.

269{
270#ifdef HAVE_LDAP
271 LDAP *ld = NULL;
272 char *hostnameU = NULL, *url = NULL;
273
274 TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
275
276 if (hostname) {
277 hostnameU = strWtoU( hostname );
278 if (!hostnameU) goto exit;
279 }
280 else {
281 hostnameU = strWtoU( defaulthost );
282 if (!hostnameU) goto exit;
283 }
284
285 url = urlify_hostnames( "cldap://", hostnameU, portnumber );
286 if (!url) goto exit;
287
288 ld = create_context( url );
289
290exit:
291 strfreeU( hostnameU );
292 strfreeU( url );
293 return ld;
294
295#else
296 return NULL;
297#endif
298}
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR url[]
Definition: encode.c:1432
static void strfreeU(char *str)
Definition: wldap32.h:108
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74

Referenced by cldap_openA().

◆ ldap_connect()

ULONG CDECL ldap_connect ( WLDAP32_LDAP ld,
struct l_timeval timeout 
)

Definition at line 318 of file init.c.

319{
320 TRACE( "(%p, %p)\n", ld, timeout );
321
322 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
323 return WLDAP32_LDAP_SUCCESS; /* FIXME: do something, e.g. ping the host */
324}
Definition: dhcpd.h:245
@ WLDAP32_LDAP_PARAM_ERROR
@ WLDAP32_LDAP_SUCCESS

◆ ldap_initA()

WLDAP32_LDAP *CDECL ldap_initA ( const PCHAR  hostname,
ULONG  portnumber 
)

Definition at line 331 of file init.c.

332{
333#ifdef HAVE_LDAP
334 WLDAP32_LDAP *ld = NULL;
335 WCHAR *hostnameW = NULL;
336
337 TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
338
339 if (hostname) {
340 hostnameW = strAtoW( hostname );
341 if (!hostnameW) goto exit;
342 }
343
344 ld = ldap_initW( hostnameW, portnumber );
345
346exit:
347 strfreeW( hostnameW );
348 return ld;
349
350#else
351 return NULL;
352#endif
353}
WLDAP32_LDAP *CDECL ldap_initW(const PWCHAR hostname, ULONG portnumber)
Definition: init.c:377

Referenced by START_TEST().

◆ ldap_initW()

WLDAP32_LDAP *CDECL ldap_initW ( const PWCHAR  hostname,
ULONG  portnumber 
)

Definition at line 377 of file init.c.

378{
379#ifdef HAVE_LDAP
380 LDAP *ld = NULL;
381 char *hostnameU = NULL, *url = NULL;
382
383 TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
384
385 if (hostname) {
386 hostnameU = strWtoU( hostname );
387 if (!hostnameU) goto exit;
388 }
389 else {
390 hostnameU = strWtoU( defaulthost );
391 if (!hostnameU) goto exit;
392 }
393
394 url = urlify_hostnames( "ldap://", hostnameU, portnumber );
395 if (!url) goto exit;
396
397 ld = create_context( url );
398
399exit:
400 strfreeU( hostnameU );
401 strfreeU( url );
402 return ld;
403
404#else
405 return NULL;
406#endif
407}

Referenced by ldap_initA().

◆ ldap_openA()

WLDAP32_LDAP *CDECL ldap_openA ( PCHAR  hostname,
ULONG  portnumber 
)

Definition at line 414 of file init.c.

415{
416#ifdef HAVE_LDAP
417 WLDAP32_LDAP *ld = NULL;
418 WCHAR *hostnameW = NULL;
419
420 TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
421
422 if (hostname) {
423 hostnameW = strAtoW( hostname );
424 if (!hostnameW) goto exit;
425 }
426
427 ld = ldap_openW( hostnameW, portnumber );
428
429exit:
430 strfreeW( hostnameW );
431 return ld;
432
433#else
434 return NULL;
435#endif
436}
WLDAP32_LDAP *CDECL ldap_openW(PWCHAR hostname, ULONG portnumber)
Definition: init.c:459

◆ ldap_openW()

WLDAP32_LDAP *CDECL ldap_openW ( PWCHAR  hostname,
ULONG  portnumber 
)

Definition at line 459 of file init.c.

460{
461#ifdef HAVE_LDAP
462 LDAP *ld = NULL;
463 char *hostnameU = NULL, *url = NULL;
464
465 TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
466
467 if (hostname) {
468 hostnameU = strWtoU( hostname );
469 if (!hostnameU) goto exit;
470 }
471 else {
472 hostnameU = strWtoU( defaulthost );
473 if (!hostnameU) goto exit;
474 }
475
476 url = urlify_hostnames( "ldap://", hostnameU, portnumber );
477 if (!url) goto exit;
478
479 ld = create_context( url );
480
481exit:
482 strfreeU( hostnameU );
483 strfreeU( url );
484 return ld;
485
486#else
487 return NULL;
488#endif
489}

Referenced by ldap_openA().

◆ ldap_sslinitA()

WLDAP32_LDAP *CDECL ldap_sslinitA ( PCHAR  hostname,
ULONG  portnumber,
int  secure 
)

Definition at line 496 of file init.c.

497{
498#ifdef HAVE_LDAP
499 WLDAP32_LDAP *ld;
500 WCHAR *hostnameW = NULL;
501
502 TRACE( "(%s, %d, 0x%08x)\n", debugstr_a(hostname), portnumber, secure );
503
504 if (hostname) {
505 hostnameW = strAtoW( hostname );
506 if (!hostnameW) return NULL;
507 }
508
509 ld = ldap_sslinitW( hostnameW, portnumber, secure );
510
511 strfreeW( hostnameW );
512 return ld;
513
514#else
515 return NULL;
516#endif
517}
WLDAP32_LDAP *CDECL ldap_sslinitW(PWCHAR hostname, ULONG portnumber, int secure)
Definition: init.c:542
static int secure
Definition: server.c:138

◆ ldap_sslinitW()

WLDAP32_LDAP *CDECL ldap_sslinitW ( PWCHAR  hostname,
ULONG  portnumber,
int  secure 
)

Definition at line 542 of file init.c.

543{
544#ifdef HAVE_LDAP
545 WLDAP32_LDAP *ld = NULL;
546 char *hostnameU = NULL, *url = NULL;
547
548 TRACE( "(%s, %d, 0x%08x)\n", debugstr_w(hostname), portnumber, secure );
549
550 if (hostname) {
551 hostnameU = strWtoU( hostname );
552 if (!hostnameU) goto exit;
553 }
554 else {
555 hostnameU = strWtoU( defaulthost );
556 if (!hostnameU) goto exit;
557 }
558
559 if (secure)
560 url = urlify_hostnames( "ldaps://", hostnameU, portnumber );
561 else
562 url = urlify_hostnames( "ldap://", hostnameU, portnumber );
563
564 if (!url) goto exit;
565 ldap_initialize( &ld, url );
566
567exit:
568 strfreeU( hostnameU );
569 strfreeU( url );
570 return ld;
571
572#else
573 return NULL;
574#endif
575}

Referenced by ldap_sslinitA().

◆ ldap_start_tls_sA()

ULONG CDECL ldap_start_tls_sA ( WLDAP32_LDAP ld,
PULONG  retval,
WLDAP32_LDAPMessage **  result,
PLDAPControlA serverctrls,
PLDAPControlA clientctrls 
)

Definition at line 582 of file init.c.

584{
586#ifdef HAVE_LDAP
587 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
588
590
591 TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
592
593 if (!ld) return ~0u;
594
595 if (serverctrls) {
596 serverctrlsW = controlarrayAtoW( serverctrls );
597 if (!serverctrlsW) goto exit;
598 }
599 if (clientctrls) {
600 clientctrlsW = controlarrayAtoW( clientctrls );
601 if (!clientctrlsW) goto exit;
602 }
603
604 ret = ldap_start_tls_sW( ld, retval, result, serverctrlsW, clientctrlsW );
605
606exit:
607 controlarrayfreeW( serverctrlsW );
608 controlarrayfreeW( clientctrlsW );
609
610#endif
611 return ret;
612}
ULONG CDECL ldap_start_tls_sW(WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls)
Definition: init.c:633
GLuint64EXT * result
Definition: glext.h:11304
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
uint32_t ULONG
Definition: typedefs.h:59
int ret
@ WLDAP32_LDAP_NOT_SUPPORTED
@ WLDAP32_LDAP_NO_MEMORY

◆ ldap_start_tls_sW()

ULONG CDECL ldap_start_tls_sW ( WLDAP32_LDAP ld,
PULONG  retval,
WLDAP32_LDAPMessage **  result,
PLDAPControlW serverctrls,
PLDAPControlW clientctrls 
)

Definition at line 633 of file init.c.

635{
637#ifdef HAVE_LDAP
638 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
639
641
642 TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
643
644 if (!ld) return ~0u;
645
646 if (serverctrls) {
647 serverctrlsU = controlarrayWtoU( serverctrls );
648 if (!serverctrlsU) goto exit;
649 }
650 if (clientctrls) {
651 clientctrlsU = controlarrayWtoU( clientctrls );
652 if (!clientctrlsU) goto exit;
653 }
654
655 ret = map_error( ldap_start_tls_s( ld, serverctrlsU, clientctrlsU ));
656
657exit:
658 controlarrayfreeU( serverctrlsU );
659 controlarrayfreeU( clientctrlsU );
660
661#endif
662 return ret;
663}
static UINT map_error(DWORD error)
Definition: service.c:35
#define LDAPControl
Definition: winldap.h:620
#define ldap_start_tls_s
Definition: winldap.h:642

Referenced by ldap_start_tls_sA().

◆ ldap_startup()

ULONG CDECL ldap_startup ( PLDAP_VERSION_INFO  version,
HANDLE instance 
)

Definition at line 668 of file init.c.

669{
670 TRACE( "(%p, %p)\n", version, instance );
672}
static HINSTANCE instance
Definition: main.c:40
static const WCHAR version[]
Definition: asmname.c:66

◆ ldap_stop_tls_s()

BOOLEAN CDECL ldap_stop_tls_s ( WLDAP32_LDAP ld)

Definition at line 686 of file init.c.

687{
688 TRACE( "(%p)\n", ld );
689 return TRUE; /* FIXME: find a way to stop tls on a connection */
690}
#define TRUE
Definition: types.h:120

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )