ReactOS  0.4.14-dev-323-g6fe6a88
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 "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 222 of file init.c.

223 {
224 #ifdef HAVE_LDAP
225  WLDAP32_LDAP *ld = NULL;
226  WCHAR *hostnameW = NULL;
227 
228  TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
229 
230  if (hostname) {
231  hostnameW = strAtoW( hostname );
232  if (!hostnameW) goto exit;
233  }
234 
235  ld = cldap_openW( hostnameW, portnumber );
236 
237 exit:
238  strfreeW( hostnameW );
239  return ld;
240 
241 #else
242  return NULL;
243 #endif
244 }
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static LPWSTR strAtoW(const char *str)
WLDAP32_LDAP *CDECL cldap_openW(PWCHAR hostname, ULONG portnumber)
Definition: init.c:267
void exit(int exitcode)
Definition: _exit.c:33

◆ cldap_openW()

WLDAP32_LDAP* CDECL cldap_openW ( PWCHAR  hostname,
ULONG  portnumber 
)

Definition at line 267 of file init.c.

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

Referenced by cldap_openA().

◆ ldap_connect()

ULONG CDECL ldap_connect ( WLDAP32_LDAP ld,
struct l_timeval timeout 
)

Definition at line 317 of file init.c.

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

◆ ldap_initA()

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

Definition at line 330 of file init.c.

331 {
332 #ifdef HAVE_LDAP
333  WLDAP32_LDAP *ld = NULL;
334  WCHAR *hostnameW = NULL;
335 
336  TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
337 
338  if (hostname) {
339  hostnameW = strAtoW( hostname );
340  if (!hostnameW) goto exit;
341  }
342 
343  ld = ldap_initW( hostnameW, portnumber );
344 
345 exit:
346  strfreeW( hostnameW );
347  return ld;
348 
349 #else
350  return NULL;
351 #endif
352 }
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static LPWSTR strAtoW(const char *str)
WLDAP32_LDAP *CDECL ldap_initW(const PWCHAR hostname, ULONG portnumber)
Definition: init.c:376
void exit(int exitcode)
Definition: _exit.c:33

Referenced by START_TEST().

◆ ldap_initW()

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

Definition at line 376 of file init.c.

377 {
378 #ifdef HAVE_LDAP
379  LDAP *ld = NULL;
380  char *hostnameU = NULL, *url = NULL;
381 
382  TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
383 
384  if (hostname) {
385  hostnameU = strWtoU( hostname );
386  if (!hostnameU) goto exit;
387  }
388  else {
389  hostnameU = strWtoU( defaulthost );
390  if (!hostnameU) goto exit;
391  }
392 
393  url = urlify_hostnames( "ldap://", hostnameU, portnumber );
394  if (!url) goto exit;
395 
396  ld = create_context( url );
397 
398 exit:
399  strfreeU( hostnameU );
400  strfreeU( url );
401  return ld;
402 
403 #else
404  return NULL;
405 #endif
406 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
char * hostname
Definition: ftp.c:88
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR url[]
Definition: encode.c:1432
void exit(int exitcode)
Definition: _exit.c:33

Referenced by ldap_initA().

◆ ldap_openA()

WLDAP32_LDAP* CDECL ldap_openA ( PCHAR  hostname,
ULONG  portnumber 
)

Definition at line 413 of file init.c.

414 {
415 #ifdef HAVE_LDAP
416  WLDAP32_LDAP *ld = NULL;
417  WCHAR *hostnameW = NULL;
418 
419  TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
420 
421  if (hostname) {
422  hostnameW = strAtoW( hostname );
423  if (!hostnameW) goto exit;
424  }
425 
426  ld = ldap_openW( hostnameW, portnumber );
427 
428 exit:
429  strfreeW( hostnameW );
430  return ld;
431 
432 #else
433  return NULL;
434 #endif
435 }
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static LPWSTR strAtoW(const char *str)
WLDAP32_LDAP *CDECL ldap_openW(PWCHAR hostname, ULONG portnumber)
Definition: init.c:458
void exit(int exitcode)
Definition: _exit.c:33

◆ ldap_openW()

WLDAP32_LDAP* CDECL ldap_openW ( PWCHAR  hostname,
ULONG  portnumber 
)

Definition at line 458 of file init.c.

459 {
460 #ifdef HAVE_LDAP
461  LDAP *ld = NULL;
462  char *hostnameU = NULL, *url = NULL;
463 
464  TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
465 
466  if (hostname) {
467  hostnameU = strWtoU( hostname );
468  if (!hostnameU) goto exit;
469  }
470  else {
471  hostnameU = strWtoU( defaulthost );
472  if (!hostnameU) goto exit;
473  }
474 
475  url = urlify_hostnames( "ldap://", hostnameU, portnumber );
476  if (!url) goto exit;
477 
478  ld = create_context( url );
479 
480 exit:
481  strfreeU( hostnameU );
482  strfreeU( url );
483  return ld;
484 
485 #else
486  return NULL;
487 #endif
488 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
char * hostname
Definition: ftp.c:88
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR url[]
Definition: encode.c:1432
void exit(int exitcode)
Definition: _exit.c:33

Referenced by ldap_openA().

◆ ldap_sslinitA()

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

Definition at line 495 of file init.c.

496 {
497 #ifdef HAVE_LDAP
498  WLDAP32_LDAP *ld;
499  WCHAR *hostnameW = NULL;
500 
501  TRACE( "(%s, %d, 0x%08x)\n", debugstr_a(hostname), portnumber, secure );
502 
503  if (hostname) {
504  hostnameW = strAtoW( hostname );
505  if (!hostnameW) return NULL;
506  }
507 
508  ld = ldap_sslinitW( hostnameW, portnumber, secure );
509 
510  strfreeW( hostnameW );
511  return ld;
512 
513 #else
514  return NULL;
515 #endif
516 }
static void strfreeW(LPWSTR str)
Definition: wldap32.h:103
char * hostname
Definition: ftp.c:88
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
WLDAP32_LDAP *CDECL ldap_sslinitW(PWCHAR hostname, ULONG portnumber, int secure)
Definition: init.c:541
static LPWSTR strAtoW(const char *str)

◆ ldap_sslinitW()

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

Definition at line 541 of file init.c.

542 {
543 #ifdef HAVE_LDAP
544  WLDAP32_LDAP *ld = NULL;
545  char *hostnameU = NULL, *url = NULL;
546 
547  TRACE( "(%s, %d, 0x%08x)\n", debugstr_w(hostname), portnumber, secure );
548 
549  if (hostname) {
550  hostnameU = strWtoU( hostname );
551  if (!hostnameU) goto exit;
552  }
553  else {
554  hostnameU = strWtoU( defaulthost );
555  if (!hostnameU) goto exit;
556  }
557 
558  if (secure)
559  url = urlify_hostnames( "ldaps://", hostnameU, portnumber );
560  else
561  url = urlify_hostnames( "ldap://", hostnameU, portnumber );
562 
563  if (!url) goto exit;
564  ldap_initialize( &ld, url );
565 
566 exit:
567  strfreeU( hostnameU );
568  strfreeU( url );
569  return ld;
570 
571 #else
572  return NULL;
573 #endif
574 }
static char * strWtoU(LPCWSTR str)
Definition: wldap32.h:74
static void strfreeU(char *str)
Definition: wldap32.h:108
char * hostname
Definition: ftp.c:88
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR url[]
Definition: encode.c:1432
void exit(int exitcode)
Definition: _exit.c:33

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 581 of file init.c.

583 {
585 #ifdef HAVE_LDAP
586  LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
587 
589 
590  TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
591 
592  if (!ld) return ~0u;
593 
594  if (serverctrls) {
595  serverctrlsW = controlarrayAtoW( serverctrls );
596  if (!serverctrlsW) goto exit;
597  }
598  if (clientctrls) {
599  clientctrlsW = controlarrayAtoW( clientctrls );
600  if (!clientctrlsW) goto exit;
601  }
602 
603  ret = ldap_start_tls_sW( ld, retval, result, serverctrlsW, clientctrlsW );
604 
605 exit:
606  controlarrayfreeW( serverctrlsW );
607  controlarrayfreeW( clientctrlsW );
608 
609 #endif
610  return ret;
611 }
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
ULONG CDECL ldap_start_tls_sW(WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls)
Definition: init.c:632
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1
void exit(int exitcode)
Definition: _exit.c:33
GLuint64EXT * result
Definition: glext.h:11304

◆ 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 632 of file init.c.

634 {
636 #ifdef HAVE_LDAP
637  LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
638 
640 
641  TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
642 
643  if (!ld) return ~0u;
644 
645  if (serverctrls) {
646  serverctrlsU = controlarrayWtoU( serverctrls );
647  if (!serverctrlsU) goto exit;
648  }
649  if (clientctrls) {
650  clientctrlsU = controlarrayWtoU( clientctrls );
651  if (!clientctrlsU) goto exit;
652  }
653 
654  ret = map_error( ldap_start_tls_s( ld, serverctrlsU, clientctrlsU ));
655 
656 exit:
657  controlarrayfreeU( serverctrlsU );
658  controlarrayfreeU( clientctrlsU );
659 
660 #endif
661  return ret;
662 }
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
#define LDAPControl
Definition: winldap.h:620
#define ldap_start_tls_s
Definition: winldap.h:642
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
unsigned int ULONG
Definition: retypes.h:1
static UINT map_error(DWORD error)
Definition: service.c:36
void exit(int exitcode)
Definition: _exit.c:33
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ldap_start_tls_sA().

◆ ldap_startup()

ULONG CDECL ldap_startup ( PLDAP_VERSION_INFO  version,
HANDLE instance 
)

Definition at line 667 of file init.c.

668 {
669  TRACE( "(%p, %p)\n", version, instance );
670  return WLDAP32_LDAP_SUCCESS;
671 }
static const WCHAR version[]
Definition: asmname.c:66
#define TRACE(s)
Definition: solgame.cpp:4
static HINSTANCE instance
Definition: main.c:40

◆ ldap_stop_tls_s()

BOOLEAN CDECL ldap_stop_tls_s ( WLDAP32_LDAP ld)

Definition at line 685 of file init.c.

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wldap32  )