Implement ldap_init* and ldap_open* functions.

This commit is contained in:
Hans Leidekker 2005-07-21 11:02:11 +00:00 committed by Alexandre Julliard
parent a0edd25e43
commit d8ad2d3916
4 changed files with 133 additions and 3 deletions

View File

@ -10,6 +10,7 @@ EXTRALIBS = @LDAPLIBS@
C_SRCS = \
ber.c \
bind.c \
init.c \
main.c
@MAKE_DLL_RULES@

122
dlls/wldap32/init.c Normal file
View File

@ -0,0 +1,122 @@
/*
* WLDAP32 - LDAP support for Wine
*
* Copyright 2005 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#ifdef HAVE_LDAP
#include <ldap.h>
#else
#define LDAP_SUCCESS 0x00
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
WLDAP32_LDAP *ldap_initA( PCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld;
WCHAR *hostnameW;
TRACE( "(%s, %ld)\n", debugstr_a(hostname), portnumber );
hostnameW = strAtoW( hostname );
if (!hostnameW) return NULL;
ld = ldap_initW( hostnameW, portnumber );
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
WLDAP32_LDAP *ldap_initW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
LDAP *ld;
char *hostnameU;
TRACE( "(%s, %ld)\n", debugstr_w(hostname), portnumber );
hostnameU = strWtoU( hostname );
if (!hostnameU) return NULL;
ld = ldap_init( hostnameU, portnumber );
strfreeU( hostnameU );
return ld;
#endif
return NULL;
}
WLDAP32_LDAP *ldap_openA( PCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld;
WCHAR *hostnameW;
TRACE( "(%s, %ld)\n", debugstr_a(hostname), portnumber );
hostnameW = strAtoW( hostname );
if (!hostnameW) return NULL;
ld = ldap_openW( hostnameW, portnumber );
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
WLDAP32_LDAP *ldap_openW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
LDAP *ld;
char *hostnameU;
TRACE( "(%s, %ld)\n", debugstr_w(hostname), portnumber );
hostnameU = strWtoU( hostname );
if (!hostnameU) return NULL;
ld = ldap_open( hostnameU, portnumber );
strfreeU( hostnameU );
return ld;
#endif
return NULL;
}

View File

@ -53,6 +53,10 @@ ULONG ldap_bindA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG);
ULONG ldap_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG);
ULONG ldap_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG);
ULONG ldap_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG);
WLDAP32_LDAP *ldap_initA(const PCHAR,ULONG);
WLDAP32_LDAP *ldap_initW(const PWCHAR,ULONG);
WLDAP32_LDAP *ldap_openA(PCHAR,ULONG);
WLDAP32_LDAP *ldap_openW(PWCHAR,ULONG);
ULONG ldap_simple_bindA(WLDAP32_LDAP*,PCHAR,PCHAR);
ULONG ldap_simple_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
ULONG ldap_simple_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR);

View File

@ -19,9 +19,12 @@
@ cdecl ldap_bind_s(ptr str str long) ldap_bind_sA
@ cdecl ldap_bind_sA(ptr str str long)
@ cdecl ldap_bind_sW(ptr wstr wstr long)
@ stub ldap_open
@ stub ldap_openA
@ stub ldap_openW
@ cdecl ldap_init(str long) ldap_initA
@ cdecl ldap_initA(str long)
@ cdecl ldap_initW(wstr long)
@ cdecl ldap_open(str long) ldap_openA
@ cdecl ldap_openA(str long)
@ cdecl ldap_openW(wstr long)
@ cdecl ldap_simple_bind(ptr str str) ldap_simple_bindA
@ cdecl ldap_simple_bindA(ptr str str)
@ cdecl ldap_simple_bindW(ptr wstr wstr)