Copied remotely

svn path=/trunk/; revision=26411
This commit is contained in:
Christoph von Wittich 2007-04-18 23:49:02 +00:00
parent 196301c5c4
commit b67e2c97a8
34 changed files with 11320 additions and 0 deletions

View file

@ -0,0 +1,36 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wldap32.dll
IMPORTLIB = libwldap32.$(IMPLIBEXT)
IMPORTS = user32 kernel32
EXTRALIBS = @LDAPLIBS@
C_SRCS = \
add.c \
ber.c \
bind.c \
compare.c \
control.c \
delete.c \
dn.c \
error.c \
extended.c \
init.c \
main.c \
misc.c \
modify.c \
modrdn.c \
option.c \
page.c \
parse.c \
rename.c \
search.c \
value.c
RC_SRCS = wldap32.rc
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View file

@ -0,0 +1,463 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#endif
#ifndef LDAP_NOT_SUPPORTED
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
#ifdef HAVE_LDAP
static LDAPMod *nullattrs[] = { NULL };
#endif
/***********************************************************************
* ldap_addA (WLDAP32.@)
*
* See ldap_addW.
*/
ULONG CDECL ldap_addA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **attrsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), attrs );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attrs) {
attrsW = modarrayAtoW( attrs );
if (!attrsW) goto exit;
}
ret = ldap_addW( ld, dnW, attrsW );
exit:
strfreeW( dnW );
modarrayfreeW( attrsW );
#endif
return ret;
}
/***********************************************************************
* ldap_addW (WLDAP32.@)
*
* Add an entry to a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to add.
* attrs [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to add.
*
* RETURNS
* Success: Message ID of the add operation.
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_addW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **attrsU = NULL;
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), attrs );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attrs) {
attrsU = modarrayWtoU( attrs );
if (!attrsU) goto exit;
}
ret = ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
modarrayfreeU( attrsU );
#endif
return ret;
}
/***********************************************************************
* ldap_add_extA (WLDAP32.@)
*
* See ldap_add_extW.
*/
ULONG CDECL ldap_add_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[],
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **attrsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), attrs,
serverctrls, clientctrls, message );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attrs) {
attrsW = modarrayAtoW( attrs );
if (!attrsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_add_extW( ld, dnW, attrsW, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
modarrayfreeW( attrsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_add_extW (WLDAP32.@)
*
* Add an entry to a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to add.
* attrs [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to add.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the add operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. The serverctrls and clientctrls parameters are
* optional and should be set to NULL if not used.
*/
ULONG CDECL ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **attrsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
int dummy;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), attrs,
serverctrls, clientctrls, message );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attrs) {
attrsU = modarrayWtoU( attrs );
if (!attrsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy );
exit:
strfreeU( dnU );
modarrayfreeU( attrsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_add_ext_sA (WLDAP32.@)
*
* See ldap_add_ext_sW.
*/
ULONG CDECL ldap_add_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[],
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **attrsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), attrs,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attrs) {
attrsW = modarrayAtoW( attrs );
if (!attrsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_add_ext_sW( ld, dnW, attrsW, serverctrlsW, clientctrlsW );
exit:
strfreeW( dnW );
modarrayfreeW( attrsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_add_ext_sW (WLDAP32.@)
*
* Add an entry to a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to add.
* attrs [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to add.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The serverctrls and clientctrls parameters are optional and
* should be set to NULL if not used.
*/
ULONG CDECL ldap_add_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **attrsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), attrs,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attrs) {
attrsU = modarrayWtoU( attrs );
if (!attrsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs,
serverctrlsU, clientctrlsU );
exit:
strfreeU( dnU );
modarrayfreeU( attrsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_add_sA (WLDAP32.@)
*
* See ldap_add_sW.
*/
ULONG CDECL ldap_add_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **attrsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), attrs );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attrs) {
attrsW = modarrayAtoW( attrs );
if (!attrsW) goto exit;
}
ret = ldap_add_sW( ld, dnW, attrsW );
exit:
strfreeW( dnW );
modarrayfreeW( attrsW );
#endif
return ret;
}
/***********************************************************************
* ldap_add_sW (WLDAP32.@)
*
* Add an entry to a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to add.
* attrs [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to add.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_add_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **attrsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), attrs );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attrs) {
attrsU = modarrayWtoU( attrs );
if (!attrsU) goto exit;
}
ret = ldap_add_ext_s( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, NULL, NULL );
exit:
strfreeU( dnU );
modarrayfreeU( attrsU );
#endif
return ret;
}

View file

@ -0,0 +1,499 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winldap.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
#ifndef LBER_ERROR
# define LBER_ERROR (~0U)
#endif
/***********************************************************************
* ber_alloc_t (WLDAP32.@)
*
* Allocate a berelement structure.
*
* PARAMS
* options [I] Must be LBER_USE_DER.
*
* RETURNS
* Success: Pointer to an allocated berelement structure.
* Failure: NULL
*
* NOTES
* Free the berelement structure with ber_free.
*/
BerElement * CDECL WLDAP32_ber_alloc_t( INT options )
{
#ifdef HAVE_LDAP
return ber_alloc_t( options );
#else
return NULL;
#endif
}
/***********************************************************************
* ber_bvdup (WLDAP32.@)
*
* Copy a berval structure.
*
* PARAMS
* berval [I] Pointer to the berval structure to be copied.
*
* RETURNS
* Success: Pointer to a copy of the berval structure.
* Failure: NULL
*
* NOTES
* Free the copy with ber_bvfree.
*/
BERVAL * CDECL WLDAP32_ber_bvdup( BERVAL *berval )
{
#ifdef HAVE_LDAP
return ber_bvdup( berval );
#else
return NULL;
#endif
}
/***********************************************************************
* ber_bvecfree (WLDAP32.@)
*
* Free an array of berval structures.
*
* PARAMS
* berval [I] Pointer to an array of berval structures.
*
* RETURNS
* Nothing.
*
* NOTES
* Use this function only to free an array of berval structures
* returned by a call to ber_scanf with a 'V' in the format string.
*/
void CDECL WLDAP32_ber_bvecfree( PBERVAL *berval )
{
#ifdef HAVE_LDAP
ber_bvecfree( berval );
#endif
}
/***********************************************************************
* ber_bvfree (WLDAP32.@)
*
* Free a berval structure.
*
* PARAMS
* berval [I] Pointer to a berval structure.
*
* RETURNS
* Nothing.
*
* NOTES
* Use this function only to free berval structures allocated by
* an LDAP API.
*/
void CDECL WLDAP32_ber_bvfree( BERVAL *berval )
{
#ifdef HAVE_LDAP
ber_bvfree( berval );
#endif
}
/***********************************************************************
* ber_first_element (WLDAP32.@)
*
* Return the tag of the first element in a set or sequence.
*
* PARAMS
* berelement [I] Pointer to a berelement structure.
* len [O] Receives the length of the first element.
* opaque [O] Receives a pointer to a cookie.
*
* RETURNS
* Success: Tag of the first element.
* Failure: LBER_DEFAULT (no more data).
*
* NOTES
* len and cookie should be passed to ber_next_element.
*/
ULONG CDECL WLDAP32_ber_first_element( BerElement *berelement, ULONG *len, CHAR **opaque )
{
#ifdef HAVE_LDAP
return ber_first_element( berelement, len, opaque );
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_flatten (WLDAP32.@)
*
* Flatten a berelement structure into a berval structure.
*
* PARAMS
* berlement [I] Pointer to a berelement structure.
* berval [O] Pointer to a berval structure.
*
* RETURNS
* Success: 0
* Failure: LBER_ERROR
*
* NOTES
* Free the berval structure with ber_bvfree.
*/
INT CDECL WLDAP32_ber_flatten( BerElement *berelement, PBERVAL *berval )
{
#ifdef HAVE_LDAP
return ber_flatten( berelement, berval );
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_free (WLDAP32.@)
*
* Free a berelement structure.
*
* PARAMS
* berlement [I] Pointer to the berelement structure to be freed.
* buf [I] Flag.
*
* RETURNS
* Nothing.
*
* NOTES
* Set buf to 0 if the berelement was allocated with ldap_first_attribute
* or ldap_next_attribute, otherwise set it to 1.
*/
void CDECL WLDAP32_ber_free( BerElement *berelement, INT buf )
{
#ifdef HAVE_LDAP
ber_free( berelement, buf );
#endif
}
/***********************************************************************
* ber_init (WLDAP32.@)
*
* Initialise a berelement structure from a berval structure.
*
* PARAMS
* berval [I] Pointer to a berval structure.
*
* RETURNS
* Success: Pointer to a berelement structure.
* Failure: NULL
*
* NOTES
* Call ber_free to free the returned berelement structure.
*/
BerElement * CDECL WLDAP32_ber_init( BERVAL *berval )
{
#ifdef HAVE_LDAP
return ber_init( berval );
#else
return NULL;
#endif
}
/***********************************************************************
* ber_next_element (WLDAP32.@)
*
* Return the tag of the next element in a set or sequence.
*
* PARAMS
* berelement [I] Pointer to a berelement structure.
* len [I/O] Receives the length of the next element.
* opaque [I/O] Pointer to a cookie.
*
* RETURNS
* Success: Tag of the next element.
* Failure: LBER_DEFAULT (no more data).
*
* NOTES
* len and cookie are intitialised by ber_first_element and should
* be passed on in subsequent calls to ber_next_element.
*/
ULONG CDECL WLDAP32_ber_next_element( BerElement *berelement, ULONG *len, CHAR *opaque )
{
#ifdef HAVE_LDAP
return ber_next_element( berelement, len, opaque );
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_peek_tag (WLDAP32.@)
*
* Return the tag of the next element.
*
* PARAMS
* berelement [I] Pointer to a berelement structure.
* len [O] Receives the length of the next element.
*
* RETURNS
* Success: Tag of the next element.
* Failure: LBER_DEFAULT (no more data).
*/
ULONG CDECL WLDAP32_ber_peek_tag( BerElement *berelement, ULONG *len )
{
#ifdef HAVE_LDAP
return ber_peek_tag( berelement, len );
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_skip_tag (WLDAP32.@)
*
* Skip the current tag and return the tag of the next element.
*
* PARAMS
* berelement [I] Pointer to a berelement structure.
* len [O] Receives the length of the skipped element.
*
* RETURNS
* Success: Tag of the next element.
* Failure: LBER_DEFAULT (no more data).
*/
ULONG CDECL WLDAP32_ber_skip_tag( BerElement *berelement, ULONG *len )
{
#ifdef HAVE_LDAP
return ber_skip_tag( berelement, len );
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_printf (WLDAP32.@)
*
* Encode a berelement structure.
*
* PARAMS
* berelement [I/O] Pointer to a berelement structure.
* fmt [I] Format string.
* ... [I] Values to encode.
*
* RETURNS
* Success: Non-negative number.
* Failure: LBER_ERROR
*
* NOTES
* berelement must have been allocated with ber_alloc_t. This function
* can be called multiple times to append data.
*/
INT CDECL WLDAP32_ber_printf( BerElement *berelement, PCHAR fmt, ... )
{
#ifdef HAVE_LDAP
va_list list;
int ret = 0;
char new_fmt[2];
new_fmt[1] = 0;
va_start( list, fmt );
while (*fmt)
{
new_fmt[0] = *fmt++;
switch(new_fmt[0])
{
case 'b':
case 'e':
case 'i':
{
int i = va_arg( list, int );
ret = ber_printf( berelement, new_fmt, i );
break;
}
case 'o':
case 's':
{
char *str = va_arg( list, char * );
ret = ber_printf( berelement, new_fmt, str );
break;
}
case 't':
{
unsigned int tag = va_arg( list, unsigned int );
ret = ber_printf( berelement, new_fmt, tag );
break;
}
case 'v':
{
char **array = va_arg( list, char ** );
ret = ber_printf( berelement, new_fmt, array );
break;
}
case 'V':
{
struct berval **array = va_arg( list, struct berval ** );
ret = ber_printf( berelement, new_fmt, array );
break;
}
case 'X':
{
char *str = va_arg( list, char * );
int len = va_arg( list, int );
new_fmt[0] = 'B'; /* 'X' is deprecated */
ret = ber_printf( berelement, new_fmt, str, len );
break;
}
case 'n':
case '{':
case '}':
case '[':
case ']':
ret = ber_printf( berelement, new_fmt );
break;
default:
FIXME( "Unknown format '%c'\n", new_fmt[0] );
ret = -1;
break;
}
if (ret == -1) break;
}
va_end( list );
return ret;
#else
return LBER_ERROR;
#endif
}
/***********************************************************************
* ber_scanf (WLDAP32.@)
*
* Decode a berelement structure.
*
* PARAMS
* berelement [I/O] Pointer to a berelement structure.
* fmt [I] Format string.
* ... [I] Pointers to values to be decoded.
*
* RETURNS
* Success: Non-negative number.
* Failure: LBER_ERROR
*
* NOTES
* berelement must have been allocated with ber_init. This function
* can be called multiple times to decode data.
*/
INT CDECL WLDAP32_ber_scanf( BerElement *berelement, PCHAR fmt, ... )
{
#ifdef HAVE_LDAP
va_list list;
int ret = 0;
char new_fmt[2];
new_fmt[1] = 0;
va_start( list, fmt );
while (*fmt)
{
new_fmt[0] = *fmt++;
switch(new_fmt[0])
{
case 'a':
{
char **ptr = va_arg( list, char ** );
ret = ber_scanf( berelement, new_fmt, ptr );
break;
}
case 'b':
case 'e':
case 'i':
{
int *i = va_arg( list, int * );
ret = ber_scanf( berelement, new_fmt, i );
break;
}
case 't':
{
unsigned int *tag = va_arg( list, unsigned int * );
ret = ber_scanf( berelement, new_fmt, tag );
break;
}
case 'v':
{
char ***array = va_arg( list, char *** );
ret = ber_scanf( berelement, new_fmt, array );
break;
}
case 'B':
{
char **str = va_arg( list, char ** );
int *len = va_arg( list, int * );
ret = ber_scanf( berelement, new_fmt, str, len );
break;
}
case 'O':
{
struct berval **ptr = va_arg( list, struct berval ** );
ret = ber_scanf( berelement, new_fmt, ptr );
break;
}
case 'V':
{
struct berval ***array = va_arg( list, struct berval *** );
ret = ber_scanf( berelement, new_fmt, array );
break;
}
case 'n':
case 'x':
case '{':
case '}':
case '[':
case ']':
ret = ber_scanf( berelement, new_fmt );
break;
default:
FIXME( "Unknown format '%c'\n", new_fmt[0] );
ret = -1;
break;
}
if (ret == -1) break;
}
va_end( list );
return ret;
#else
return LBER_ERROR;
#endif
}

View file

@ -0,0 +1,703 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#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);
/***********************************************************************
* ldap_bindA (WLDAP32.@)
*
* See ldap_bindW.
*/
ULONG CDECL ldap_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *credW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_a(dn), cred, method );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (cred) {
credW = strAtoW( cred );
if (!credW) goto exit;
}
ret = ldap_bindW( ld, dnW, credW, method );
exit:
strfreeW( dnW );
strfreeW( credW );
#endif
return ret;
}
/***********************************************************************
* ldap_bindW (WLDAP32.@)
*
* Authenticate with an LDAP server (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* cred [I] Credentials (e.g. password string).
* method [I] Authentication method.
*
* RETURNS
* Success: Message ID of the bind operation.
* Failure: An LDAP error code.
*
* NOTES
* Only LDAP_AUTH_SIMPLE is supported (just like native).
*/
ULONG CDECL ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *credU = NULL;
struct berval pwd = { 0, NULL };
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_w(dn), cred, method );
if (!ld) return ~0UL;
if (method != LDAP_AUTH_SIMPLE) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (cred) {
credU = strWtoU( cred );
if (!credU) goto exit;
pwd.bv_len = strlen( credU );
pwd.bv_val = credU;
}
ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
strfreeU( credU );
#endif
return ret;
}
/***********************************************************************
* ldap_bind_sA (WLDAP32.@)
*
* See ldap_bind_sW.
*/
ULONG CDECL ldap_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *credW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_a(dn), cred, method );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (cred) {
credW = strAtoW( cred );
if (!credW) goto exit;
}
ret = ldap_bind_sW( ld, dnW, credW, method );
exit:
strfreeW( dnW );
strfreeW( credW );
#endif
return ret;
}
/***********************************************************************
* ldap_bind_sW (WLDAP32.@)
*
* Authenticate with an LDAP server (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* cred [I] Credentials (e.g. password string).
* method [I] Authentication method.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *credU = NULL;
struct berval pwd = { 0, NULL };
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_w(dn), cred, method );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (method != LDAP_AUTH_SIMPLE) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (cred) {
credU = strWtoU( cred );
if (!credU) goto exit;
pwd.bv_len = strlen( credU );
pwd.bv_val = credU;
}
ret = ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL );
exit:
strfreeU( dnU );
strfreeU( credU );
#endif
return ret;
}
/***********************************************************************
* ldap_sasl_bindA (WLDAP32.@)
*
* See ldap_sasl_bindW.
*/
ULONG CDECL ldap_sasl_bindA( WLDAP32_LDAP *ld, const PCHAR dn,
const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, int *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW, *mechanismW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(mechanism), cred, serverctrls, clientctrls, message );
if (!ld || !dn || !mechanism || !cred || !message)
return WLDAP32_LDAP_PARAM_ERROR;
dnW = strAtoW( dn );
if (!dnW) goto exit;
mechanismW = strAtoW( mechanism );
if (!mechanismW) goto exit;
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
strfreeW( mechanismW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_sasl_bindW (WLDAP32.@)
*
* Authenticate with an LDAP server using SASL (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* mechanism [I] Authentication method.
* cred [I] Credentials.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the bind operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The serverctrls and clientctrls parameters are optional and should
* be set to NULL if not used.
*/
ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn,
const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, int *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU, *mechanismU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
struct berval credU;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(mechanism), cred, serverctrls, clientctrls, message );
if (!ld || !dn || !mechanism || !cred || !message)
return WLDAP32_LDAP_PARAM_ERROR;
dnU = strWtoU( dn );
if (!dnU) goto exit;
mechanismU = strWtoU( mechanism );
if (!mechanismU) goto exit;
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
ret = ldap_sasl_bind( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, message );
exit:
strfreeU( dnU );
strfreeU( mechanismU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_sasl_bind_sA (WLDAP32.@)
*
* See ldap_sasl_bind_sW.
*/
ULONG CDECL ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn,
const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, PBERVAL *serverdata )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW, *mechanismW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata );
if (!ld || !dn || !mechanism || !cred || !serverdata)
return WLDAP32_LDAP_PARAM_ERROR;
dnW = strAtoW( dn );
if (!dnW) goto exit;
mechanismW = strAtoW( mechanism );
if (!mechanismW) goto exit;
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata );
exit:
strfreeW( dnW );
strfreeW( mechanismW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_sasl_bind_sW (WLDAP32.@)
*
* Authenticate with an LDAP server using SASL (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* mechanism [I] Authentication method.
* cred [I] Credentials.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* serverdata [O] Authentication response from the server.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The serverctrls and clientctrls parameters are optional and should
* be set to NULL if not used.
*/
ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn,
const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, PBERVAL *serverdata )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU, *mechanismU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
struct berval credU;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata );
if (!ld || !dn || !mechanism || !cred || !serverdata)
return WLDAP32_LDAP_PARAM_ERROR;
dnU = strWtoU( dn );
if (!dnU) goto exit;
mechanismU = strWtoU( mechanism );
if (!mechanismU) goto exit;
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
credU.bv_len = cred->bv_len;
credU.bv_val = cred->bv_val;
ret = ldap_sasl_bind_s( ld, dnU, mechanismU, &credU,
serverctrlsU, clientctrlsU, (struct berval **)serverdata );
exit:
strfreeU( dnU );
strfreeU( mechanismU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_simple_bindA (WLDAP32.@)
*
* See ldap_simple_bindW.
*/
ULONG CDECL ldap_simple_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *passwdW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (passwd) {
passwdW = strAtoW( passwd );
if (!passwdW) goto exit;
}
ret = ldap_simple_bindW( ld, dnW, passwdW );
exit:
strfreeW( dnW );
strfreeW( passwdW );
#endif
return ret;
}
/***********************************************************************
* ldap_simple_bindW (WLDAP32.@)
*
* Authenticate with an LDAP server (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* passwd [I] Password string.
*
* RETURNS
* Success: Message ID of the bind operation.
* Failure: An LDAP error code.
*
* NOTES
* Set dn and passwd to NULL to bind as an anonymous user.
*/
ULONG CDECL ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *passwdU = NULL;
struct berval pwd = { 0, NULL };
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
if (!ld) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (passwd) {
passwdU = strWtoU( passwd );
if (!passwdU) goto exit;
pwd.bv_len = strlen( passwdU );
pwd.bv_val = passwdU;
}
ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
strfreeU( passwdU );
#endif
return ret;
}
/***********************************************************************
* ldap_simple_bind_sA (WLDAP32.@)
*
* See ldap_simple_bind_sW.
*/
ULONG CDECL ldap_simple_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *passwdW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (passwd) {
passwdW = strAtoW( passwd );
if (!passwdW) goto exit;
}
ret = ldap_simple_bind_sW( ld, dnW, passwdW );
exit:
strfreeW( dnW );
strfreeW( passwdW );
#endif
return ret;
}
/***********************************************************************
* ldap_simple_bind_sW (WLDAP32.@)
*
* Authenticate with an LDAP server (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to bind as.
* passwd [I] Password string.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Set dn and passwd to NULL to bind as an anonymous user.
*/
ULONG CDECL ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *passwdU = NULL;
struct berval pwd = { 0, NULL };
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (passwd) {
passwdU = strWtoU( passwd );
if (!passwdU) goto exit;
pwd.bv_len = strlen( passwdU );
pwd.bv_val = passwdU;
}
ret = ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL );
exit:
strfreeU( dnU );
strfreeU( passwdU );
#endif
return ret;
}
/***********************************************************************
* ldap_unbind (WLDAP32.@)
*
* Close LDAP connection and free resources (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", ld );
if (ld)
ret = ldap_unbind_ext( ld, NULL, NULL );
else
ret = WLDAP32_LDAP_PARAM_ERROR;
#endif
return ret;
}
/***********************************************************************
* ldap_unbind_s (WLDAP32.@)
*
* Close LDAP connection and free resources (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", ld );
if (ld)
ret = ldap_unbind_ext_s( ld, NULL, NULL );
else
ret = WLDAP32_LDAP_PARAM_ERROR;
#endif
return ret;
}

View file

@ -0,0 +1,520 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_compareA (WLDAP32.@)
*
* See ldap_compareW.
*/
ULONG CDECL ldap_compareA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
ret = ~0UL;
TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(attr),
debugstr_a(value) );
if (!ld || !attr) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
attrW = strAtoW( attr );
if (!attrW) goto exit;
if (value) {
valueW = strAtoW( value );
if (!valueW) goto exit;
}
ret = ldap_compareW( ld, dnW, attrW, valueW );
exit:
strfreeW( dnW );
strfreeW( attrW );
strfreeW( valueW );
#endif
return ret;
}
/***********************************************************************
* ldap_compareW (WLDAP32.@)
*
* Check if an attribute has a certain value (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to compare value for.
* attr [I] Attribute to compare value for.
* value [I] Value to compare.
*
* RETURNS
* Success: Message ID of the compare operation.
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_compareW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *attrU = NULL, *valueU = NULL;
struct berval val = { 0, NULL };
int msg;
ret = ~0UL;
TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(attr),
debugstr_w(value) );
if (!ld || !attr) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
attrU = strWtoU( attr );
if (!attrU) goto exit;
if (value) {
valueU = strWtoU( value );
if (!valueU) goto exit;
val.bv_len = strlen( valueU );
val.bv_val = valueU;
}
ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, &val, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
strfreeU( attrU );
strfreeU( valueU );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_extA (WLDAP32.@)
*
* See ldap_compare_extW.
*/
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 ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(attr), debugstr_a(value), data, serverctrls,
clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attr) {
attrW = strAtoW( attr );
if (!attrW) goto exit;
}
if (value) {
valueW = strAtoW( value );
if (!valueW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_compare_extW( ld, dnW, attrW, valueW, data,
serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
strfreeW( attrW );
strfreeW( valueW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_extW (WLDAP32.@)
*
* Check if an attribute has a certain value (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to compare value for.
* attr [I] Attribute to compare value for.
* value [I] string encoded value to compare.
* data [I] berval encoded value to compare.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the compare operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Set value to compare strings or data to compare binary values. If
* both are non-NULL, data will be used. The serverctrls and clientctrls
* parameters are optional and should be set to NULL if not used.
*/
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 ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *attrU = NULL, *valueU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
struct berval val = { 0, NULL };
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(attr), debugstr_w(value), data, serverctrls,
clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (!attr) return WLDAP32_LDAP_NO_MEMORY;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
attrU = strWtoU( attr );
if (!attrU) goto exit;
if (!data) {
if (value) {
valueU = strWtoU( value );
if (!valueU) goto exit;
val.bv_len = strlen( valueU );
val.bv_val = valueU;
}
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU, (int *)message );
exit:
strfreeU( dnU );
strfreeU( attrU );
strfreeU( valueU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_ext_sA (WLDAP32.@)
*
* See ldap_compare_ext_sW.
*/
ULONG CDECL ldap_compare_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value,
struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, %p, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(attr), debugstr_a(value), data, serverctrls,
clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attr) {
attrW = strAtoW( attr );
if (!attrW) goto exit;
}
if (value) {
valueW = strAtoW( value );
if (!valueW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_compare_ext_sW( ld, dnW, attrW, valueW, data, serverctrlsW,
clientctrlsW );
exit:
strfreeW( dnW );
strfreeW( attrW );
strfreeW( valueW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_ext_sW (WLDAP32.@)
*
* Check if an attribute has a certain value (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to compare value for.
* attr [I] Attribute to compare value for.
* value [I] string encoded value to compare.
* data [I] berval encoded value to compare.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Set value to compare strings or data to compare binary values. If
* both are non-NULL, data will be used. The serverctrls and clientctrls
* parameters are optional and should be set to NULL if not used.
*/
ULONG CDECL ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value,
struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *attrU = NULL, *valueU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
struct berval val = { 0, NULL };
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, %p, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(attr), debugstr_w(value), data, serverctrls,
clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attr) {
attrU = strWtoU( attr );
if (!attrU) goto exit;
}
if (!data) {
if (value) {
valueU = strWtoU( value );
if (!valueU) goto exit;
val.bv_len = strlen( valueU );
val.bv_val = valueU;
}
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "",
data ? (struct berval *)data : &val,
serverctrlsU, clientctrlsU );
exit:
strfreeU( dnU );
strfreeU( attrU );
strfreeU( valueU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_sA (WLDAP32.@)
*
* See ldap_compare_sW.
*/
ULONG CDECL ldap_compare_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(attr),
debugstr_a(value) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (attr) {
attrW = strAtoW( attr );
if (!attrW) goto exit;
}
if (value) {
valueW = strAtoW( value );
if (!valueW) goto exit;
}
ret = ldap_compare_sW( ld, dnW, attrW, valueW );
exit:
strfreeW( dnW );
strfreeW( attrW );
strfreeW( valueW );
#endif
return ret;
}
/***********************************************************************
* ldap_compare_sW (WLDAP32.@)
*
* Check if an attribute has a certain value (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of entry to compare value for.
* attr [I] Attribute to compare value for.
* value [I] Value to compare.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_compare_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *attrU = NULL, *valueU = NULL;
struct berval val = { 0, NULL };
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(attr),
debugstr_w(value) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (attr) {
attrU = strWtoU( attr );
if (!attrU) goto exit;
}
if (value) {
valueU = strWtoU( value );
if (!valueU) goto exit;
val.bv_len = strlen( valueU );
val.bv_val = valueU;
}
ret = ldap_compare_ext_s( ld, dn ? dnU : "", attr ? attrU : "", &val, NULL, NULL );
exit:
strfreeU( dnU );
strfreeU( attrU );
strfreeU( valueU );
#endif
return ret;
}

View file

@ -0,0 +1,348 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#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);
/***********************************************************************
* ldap_control_freeA (WLDAP32.@)
*
* See ldap_control_freeW.
*/
ULONG CDECL ldap_control_freeA( LDAPControlA *control )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", control );
controlfreeA( control );
#endif
return ret;
}
/***********************************************************************
* ldap_control_freeW (WLDAP32.@)
*
* Free an LDAPControl structure.
*
* PARAMS
* control [I] LDAPControl structure to free.
*
* RETURNS
* LDAP_SUCCESS
*/
ULONG CDECL ldap_control_freeW( LDAPControlW *control )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", control );
controlfreeW( control );
#endif
return ret;
}
/***********************************************************************
* ldap_controls_freeA (WLDAP32.@)
*
* See ldap_controls_freeW.
*/
ULONG CDECL ldap_controls_freeA( LDAPControlA **controls )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", controls );
controlarrayfreeA( controls );
#endif
return ret;
}
/***********************************************************************
* ldap_controls_freeW (WLDAP32.@)
*
* Free an array of LDAPControl structures.
*
* PARAMS
* controls [I] Array of LDAPControl structures to free.
*
* RETURNS
* LDAP_SUCCESS
*/
ULONG CDECL ldap_controls_freeW( LDAPControlW **controls )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", controls );
controlarrayfreeW( controls );
#endif
return ret;
}
/***********************************************************************
* ldap_create_sort_controlA (WLDAP32.@)
*
* See ldap_create_sort_controlW.
*/
ULONG CDECL ldap_create_sort_controlA( WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkey,
UCHAR critical, PLDAPControlA *control )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPSortKeyW **sortkeyW = NULL;
LDAPControlW *controlW = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control );
if (!ld || !sortkey || !control)
return WLDAP32_LDAP_PARAM_ERROR;
sortkeyW = sortkeyarrayAtoW( sortkey );
if (!sortkeyW) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_create_sort_controlW( ld, sortkeyW, critical, &controlW );
*control = controlWtoA( controlW );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_control_freeW( controlW );
sortkeyarrayfreeW( sortkeyW );
#endif
return ret;
}
/***********************************************************************
* ldap_create_sort_controlW (WLDAP32.@)
*
* Create a control for server sorted search results.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* sortkey [I] Array of LDAPSortKey structures, each specifying an
* attribute to use as a sort key, a matching rule and
* the sort order (ascending or descending).
* critical [I] Tells the server this control is critical to the
* search operation.
* control [O] LDAPControl created.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Pass the created control as a server control in subsequent calls
* to ldap_search_ext(_s) to obtain sorted search results.
*/
ULONG CDECL ldap_create_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkey,
UCHAR critical, PLDAPControlW *control )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPSortKey **sortkeyU = NULL;
LDAPControl *controlU = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, sortkey, critical, control );
if (!ld || !sortkey || !control)
return WLDAP32_LDAP_PARAM_ERROR;
sortkeyU = sortkeyarrayWtoU( sortkey );
if (!sortkeyU) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_create_sort_control( ld, sortkeyU, critical, &controlU );
*control = controlUtoW( controlU );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_control_free( controlU );
sortkeyarrayfreeU( sortkeyU );
#endif
return ret;
}
/***********************************************************************
* ldap_create_vlv_controlA (WLDAP32.@)
*
* See ldap_create_vlv_controlW.
*/
INT CDECL ldap_create_vlv_controlA( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info,
UCHAR critical, LDAPControlA **control )
{
INT ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW *controlW = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
if (!ld || !control) return ~0UL;
ret = ldap_create_vlv_controlW( ld, info, critical, &controlW );
if (ret == LDAP_SUCCESS)
{
*control = controlWtoA( controlW );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_control_freeW( controlW );
}
#endif
return ret;
}
/***********************************************************************
* ldap_create_vlv_controlW (WLDAP32.@)
*
* Create a virtual list view control.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* info [I] LDAPVLVInfo structure specifying a list view window.
* critical [I] Tells the server this control is critical to the
* search operation.
* control [O] LDAPControl created.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Pass the created control in conjuction with a sort control as
* server controls in subsequent calls to ldap_search_ext(_s). The
* server will then return a sorted, contiguous subset of results
* that meets the criteria specified in the LDAPVLVInfo structure.
*/
INT CDECL ldap_create_vlv_controlW( WLDAP32_LDAP *ld, WLDAP32_LDAPVLVInfo *info,
UCHAR critical, LDAPControlW **control )
{
INT ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControl *controlU = NULL;
TRACE( "(%p, %p, 0x%02x, %p)\n", ld, info, critical, control );
if (!ld || !control) return ~0UL;
ret = ldap_create_vlv_control( ld, (LDAPVLVInfo *)info, &controlU );
if (ret == LDAP_SUCCESS)
{
*control = controlUtoW( controlU );
if (!*control) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_control_free( controlU );
}
#endif
return ret;
}
/***********************************************************************
* ldap_encode_sort_controlA (WLDAP32.@)
*
* See ldap_encode_sort_controlW.
*/
ULONG CDECL ldap_encode_sort_controlA( WLDAP32_LDAP *ld, PLDAPSortKeyA *sortkeys,
PLDAPControlA control, BOOLEAN critical )
{
return ldap_create_sort_controlA( ld, sortkeys, critical, &control );
}
/***********************************************************************
* ldap_encode_sort_controlW (WLDAP32.@)
*
* Create a control for server sorted search results.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* sortkey [I] Array of LDAPSortKey structures, each specifying an
* attribute to use as a sort key, a matching rule and
* the sort order (ascending or descending).
* critical [I] Tells the server this control is critical to the
* search operation.
* control [O] LDAPControl created.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* This function is obsolete. Use its equivalent
* ldap_create_sort_control instead.
*/
ULONG CDECL ldap_encode_sort_controlW( WLDAP32_LDAP *ld, PLDAPSortKeyW *sortkeys,
PLDAPControlW control, BOOLEAN critical )
{
return ldap_create_sort_controlW( ld, sortkeys, critical, &control );
}
/***********************************************************************
* ldap_free_controlsA (WLDAP32.@)
*
* See ldap_free_controlsW.
*/
ULONG CDECL ldap_free_controlsA( LDAPControlA **controls )
{
return ldap_controls_freeA( controls );
}
/***********************************************************************
* ldap_free_controlsW (WLDAP32.@)
*
* Free an array of LDAPControl structures.
*
* PARAMS
* controls [I] Array of LDAPControl structures to free.
*
* RETURNS
* LDAP_SUCCESS
*
* NOTES
* Obsolete, use ldap_controls_freeW.
*/
ULONG CDECL ldap_free_controlsW( LDAPControlW **controls )
{
return ldap_controls_freeW( controls );
}

View file

@ -0,0 +1,381 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_deleteA (WLDAP32.@)
*
* See ldap_deleteW.
*/
ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_deleteW( ld, dnW );
strfreeW( dnW );
#endif
return ret;
}
/***********************************************************************
* ldap_deleteW (WLDAP32.@)
*
* Delete an entry from a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to delete.
*
* RETURNS
* Success: Message ID of the add operation.
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
int msg;
TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
if (!ld) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_delete_ext( ld, dn ? dnU : "", NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
strfreeU( dnU );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_extA (WLDAP32.@)
*
* See ldap_delete_extW.
*/
ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
clientctrls, message );
ret = WLDAP32_LDAP_NO_MEMORY;
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_extW (WLDAP32.@)
*
* Delete an entry from a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to delete.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the delete operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. The serverctrls and clientctrls parameters are
* optional and should be set to NULL if not used.
*/
ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
int dummy;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
clientctrls, message );
ret = WLDAP32_LDAP_NO_MEMORY;
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
message ? (int *)message : &dummy );
exit:
strfreeU( dnU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_ext_sA (WLDAP32.@)
*
* See ldap_delete_ext_sW.
*/
ULONG CDECL ldap_delete_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW );
exit:
strfreeW( dnW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_ext_sW (WLDAP32.@)
*
* Delete an entry from a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to delete.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The serverctrls and clientctrls parameters are optional and
* should be set to NULL if not used.
*/
ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU );
exit:
strfreeU( dnU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_sA (WLDAP32.@)
*
* See ldap_delete_sW.
*/
ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_delete_sW( ld, dnW );
strfreeW( dnW );
#endif
return ret;
}
/***********************************************************************
* ldap_delete_sW (WLDAP32.@)
*
* Delete an entry from a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to delete.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL );
strfreeU( dnU );
#endif
return ret;
}

View file

@ -0,0 +1,305 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_SUCCESS 0x00
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_dn2ufnA (WLDAP32.@)
*
* See ldap_dn2ufnW.
*/
PCHAR CDECL ldap_dn2ufnA( PCHAR dn )
{
PCHAR ret = NULL;
#ifdef HAVE_LDAP
WCHAR *dnW, *retW;
TRACE( "(%s)\n", debugstr_a(dn) );
dnW = strAtoW( dn );
if (!dnW) return NULL;
retW = ldap_dn2ufnW( dnW );
ret = strWtoA( retW );
strfreeW( dnW );
ldap_memfreeW( retW );
#endif
return ret;
}
/***********************************************************************
* ldap_dn2ufnW (WLDAP32.@)
*
* Convert a DN to a user-friendly name.
*
* PARAMS
* dn [I] DN to convert.
*
* RETURNS
* Success: Pointer to a string containing the user-friendly name.
* Failure: NULL
*
* NOTES
* Free the string with ldap_memfree.
*/
PWCHAR CDECL ldap_dn2ufnW( PWCHAR dn )
{
PWCHAR ret = NULL;
#ifdef HAVE_LDAP
char *dnU, *retU;
TRACE( "(%s)\n", debugstr_w(dn) );
dnU = strWtoU( dn );
if (!dnU) return NULL;
retU = ldap_dn2ufn( dnU );
ret = strUtoW( retU );
strfreeU( dnU );
ldap_memfree( retU );
#endif
return ret;
}
/***********************************************************************
* ldap_explode_dnA (WLDAP32.@)
*
* See ldap_explode_dnW.
*/
PCHAR * CDECL ldap_explode_dnA( PCHAR dn, ULONG notypes )
{
PCHAR *ret = NULL;
#ifdef HAVE_LDAP
WCHAR *dnW, **retW;
TRACE( "(%s, 0x%08x)\n", debugstr_a(dn), notypes );
dnW = strAtoW( dn );
if (!dnW) return NULL;
retW = ldap_explode_dnW( dnW, notypes );
ret = strarrayWtoA( retW );
strfreeW( dnW );
ldap_value_freeW( retW );
#endif
return ret;
}
/***********************************************************************
* ldap_explode_dnW (WLDAP32.@)
*
* Break up a DN into its components.
*
* PARAMS
* dn [I] DN to break up.
* notypes [I] Remove attribute type information from the components.
*
* RETURNS
* Success: Pointer to a NULL-terminated array that contains the DN
* components.
* Failure: NULL
*
* NOTES
* Free the string array with ldap_value_free.
*/
PWCHAR * CDECL ldap_explode_dnW( PWCHAR dn, ULONG notypes )
{
PWCHAR *ret = NULL;
#ifdef HAVE_LDAP
char *dnU, **retU;
TRACE( "(%s, 0x%08x)\n", debugstr_w(dn), notypes );
dnU = strWtoU( dn );
if (!dnU) return NULL;
retU = ldap_explode_dn( dnU, notypes );
ret = strarrayUtoW( retU );
strfreeU( dnU );
ldap_memvfree( (void **)retU );
#endif
return ret;
}
/***********************************************************************
* ldap_get_dnA (WLDAP32.@)
*
* See ldap_get_dnW.
*/
PCHAR CDECL ldap_get_dnA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry )
{
PCHAR ret = NULL;
#ifdef HAVE_LDAP
PWCHAR retW;
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
retW = ldap_get_dnW( ld, entry );
ret = strWtoA( retW );
ldap_memfreeW( retW );
#endif
return ret;
}
/***********************************************************************
* ldap_get_dnW (WLDAP32.@)
*
* Retrieve the DN from a given LDAP message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] LDAPMessage structure to retrieve the DN from.
*
* RETURNS
* Success: Pointer to a string that contains the DN.
* Failure: NULL
*
* NOTES
* Free the string with ldap_memfree.
*/
PWCHAR CDECL ldap_get_dnW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry )
{
PWCHAR ret = NULL;
#ifdef HAVE_LDAP
char *retU;
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
retU = ldap_get_dn( ld, entry );
ret = strUtoW( retU );
ldap_memfree( retU );
#endif
return ret;
}
/***********************************************************************
* ldap_ufn2dnA (WLDAP32.@)
*
* See ldap_ufn2dnW.
*/
ULONG CDECL ldap_ufn2dnA( PCHAR ufn, PCHAR *dn )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
PWCHAR ufnW = NULL, dnW = NULL;
TRACE( "(%s, %p)\n", debugstr_a(ufn), dn );
if (!dn) return WLDAP32_LDAP_PARAM_ERROR;
*dn = NULL;
if (ufn) {
ufnW = strAtoW( ufn );
if (!ufnW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_ufn2dnW( ufnW, &dnW );
if (dnW) {
*dn = strWtoA( dnW );
if (!*dn) ret = WLDAP32_LDAP_NO_MEMORY;
}
strfreeW( ufnW );
ldap_memfreeW( dnW );
#endif
return ret;
}
/***********************************************************************
* ldap_ufn2dnW (WLDAP32.@)
*
* Convert a user-friendly name to a DN.
*
* PARAMS
* ufn [I] User-friendly name to convert.
* dn [O] Receives a pointer to a string containing the DN.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Free the string with ldap_memfree.
*/
ULONG CDECL ldap_ufn2dnW( PWCHAR ufn, PWCHAR *dn )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
char *ufnU = NULL;
TRACE( "(%s, %p)\n", debugstr_w(ufn), dn );
if (!dn) return WLDAP32_LDAP_PARAM_ERROR;
*dn = NULL;
if (ufn) {
ufnU = strWtoU( ufn );
if (!ufnU) return WLDAP32_LDAP_NO_MEMORY;
/* FIXME: do more than just a copy */
*dn = strUtoW( ufnU );
if (!*dn) ret = WLDAP32_LDAP_NO_MEMORY;
}
strfreeU( ufnU );
#endif
return ret;
}

View file

@ -0,0 +1,290 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#ifdef HAVE_LDAP_H
#include <ldap.h>
#else
#define LDAP_SUCCESS 0x00
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
extern HINSTANCE hwldap32;
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_err2stringA (WLDAP32.@)
*
* See ldap_err2stringW.
*/
PCHAR CDECL ldap_err2stringA( ULONG err )
{
static char buf[256] = "";
TRACE( "(0x%08x)\n", err );
if (err <= WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED)
LoadStringA( hwldap32, err, buf, 256 );
else
LoadStringA( hwldap32, WLDAP32_LDAP_LOCAL_ERROR, buf, 256 );
return buf;
}
/***********************************************************************
* ldap_err2stringW (WLDAP32.@)
*
* Convert an error code into a string describing the error.
*
* PARAMS
* err [I] Error code to convert.
*
* RETURNS
* Success: Pointer to a string containing the error description.
* Failure: NULL
*
* NOTES
* The returned string is statically allocated, you must not
* free this string.
*/
PWCHAR CDECL ldap_err2stringW( ULONG err )
{
static WCHAR buf[256] = { 0 };
TRACE( "(0x%08x)\n", err );
if (err <= WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED)
LoadStringW( hwldap32, err, buf, 256 );
else
LoadStringW( hwldap32, WLDAP32_LDAP_LOCAL_ERROR, buf, 256 );
return buf;
}
/***********************************************************************
* ldap_perror (WLDAP32.@)
*
* Print a given error string.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* msg [I] Error string.
*
* RETURNS
* Nothing.
*
* NOTES
* Like native, this function does nothing.
*/
void CDECL WLDAP32_ldap_perror( WLDAP32_LDAP *ld, const PCHAR msg )
{
TRACE( "(%p, %s)\n", ld, debugstr_a(msg) );
}
/***********************************************************************
* ldap_result2error (WLDAP32.@)
*
* Parse an LDAP message and return the error obtained from it.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] Pointer to an LDAPMessage structure.
* free [I] Ask for the LDAPMessage structure to be freed.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* If not asked for, use ldap_msgfree to free the LDAPMessage.
*/
ULONG CDECL WLDAP32_ldap_result2error( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res, ULONG free )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
int error;
TRACE( "(%p, %p, 0x%08x)\n", ld, res, free );
if (!ld || !res) return ~0UL;
ret = ldap_parse_result( ld, res, &error, NULL, NULL, NULL, NULL, free );
if (ret == LDAP_SUCCESS)
ret = error;
else
ret = ~0UL;
#endif
return ret;
}
/***********************************************************************
* LdapGetLastError (WLDAP32.@)
*
* Return the last error set by an LDAP function call.
*
* PARAMS
* None.
*
* RETURNS
* An LDAP error code.
*/
ULONG CDECL LdapGetLastError( void )
{
TRACE( "\n" );
return GetLastError();
}
static const ULONG WLDAP32_errormap[] = {
/* LDAP_SUCCESS */ ERROR_SUCCESS,
/* LDAP_OPERATIONS_ERROR */ ERROR_OPEN_FAILED,
/* LDAP_PROTOCOL_ERROR */ ERROR_INVALID_LEVEL,
/* LDAP_TIMELIMIT_EXCEEDED */ ERROR_TIMEOUT,
/* LDAP_SIZELIMIT_EXCEEDED */ ERROR_MORE_DATA,
/* LDAP_COMPARE_FALSE */ ERROR_DS_GENERIC_ERROR,
/* LDAP_COMPARE_TRUE */ ERROR_DS_GENERIC_ERROR,
/* LDAP_AUTH_METHOD_NOT_SUPPORTED */ ERROR_ACCESS_DENIED,
/* LDAP_STRONG_AUTH_REQUIRED */ ERROR_ACCESS_DENIED,
/* LDAP_REFERRAL_V2 */ ERROR_MORE_DATA,
/* LDAP_REFERRAL */ ERROR_MORE_DATA,
/* LDAP_ADMIN_LIMIT_EXCEEDED */ ERROR_NOT_ENOUGH_QUOTA,
/* LDAP_UNAVAILABLE_CRIT_EXTENSION */ ERROR_CAN_NOT_COMPLETE,
/* LDAP_CONFIDENTIALITY_REQUIRED */ ERROR_DS_GENERIC_ERROR,
/* LDAP_SASL_BIND_IN_PROGRESS */ ERROR_DS_GENERIC_ERROR,
/* 0x0f */ ERROR_DS_GENERIC_ERROR,
/* LDAP_NO_SUCH_ATTRIBUTE */ ERROR_INVALID_PARAMETER,
/* LDAP_UNDEFINED_TYPE */ ERROR_DS_GENERIC_ERROR,
/* LDAP_INAPPROPRIATE_MATCHING */ ERROR_INVALID_PARAMETER,
/* LDAP_CONSTRAINT_VIOLATION */ ERROR_INVALID_PARAMETER,
/* LDAP_ATTRIBUTE_OR_VALUE_EXISTS */ ERROR_ALREADY_EXISTS,
/* LDAP_INVALID_SYNTAX */ ERROR_INVALID_NAME,
/* 0x16 */ ERROR_DS_GENERIC_ERROR,
/* 0x17 */ ERROR_DS_GENERIC_ERROR,
/* 0x18 */ ERROR_DS_GENERIC_ERROR,
/* 0x19 */ ERROR_DS_GENERIC_ERROR,
/* 0x1a */ ERROR_DS_GENERIC_ERROR,
/* 0x1b */ ERROR_DS_GENERIC_ERROR,
/* 0x1c */ ERROR_DS_GENERIC_ERROR,
/* 0x1d */ ERROR_DS_GENERIC_ERROR,
/* 0x1e */ ERROR_DS_GENERIC_ERROR,
/* 0x1f */ ERROR_DS_GENERIC_ERROR,
/* LDAP_NO_SUCH_OBJECT */ ERROR_FILE_NOT_FOUND,
/* LDAP_ALIAS_PROBLEM */ ERROR_DS_GENERIC_ERROR,
/* LDAP_INVALID_DN_SYNTAX */ ERROR_INVALID_PARAMETER,
/* LDAP_IS_LEAF */ ERROR_DS_GENERIC_ERROR,
/* LDAP_ALIAS_DEREF_PROBLEM */ ERROR_DS_GENERIC_ERROR,
/* 0x25 */ ERROR_DS_GENERIC_ERROR,
/* 0x26 */ ERROR_DS_GENERIC_ERROR,
/* 0x27 */ ERROR_DS_GENERIC_ERROR,
/* 0x28 */ ERROR_DS_GENERIC_ERROR,
/* 0x29 */ ERROR_DS_GENERIC_ERROR,
/* 0x2a */ ERROR_DS_GENERIC_ERROR,
/* 0x2b */ ERROR_DS_GENERIC_ERROR,
/* 0x2c */ ERROR_DS_GENERIC_ERROR,
/* 0x2d */ ERROR_DS_GENERIC_ERROR,
/* 0x2e */ ERROR_DS_GENERIC_ERROR,
/* 0x2f */ ERROR_DS_GENERIC_ERROR,
/* LDAP_INAPPROPRIATE_AUTH */ ERROR_ACCESS_DENIED,
/* LDAP_INVALID_CREDENTIALS */ ERROR_WRONG_PASSWORD,
/* LDAP_INSUFFICIENT_RIGHTS */ ERROR_ACCESS_DENIED,
/* LDAP_BUSY */ ERROR_BUSY,
/* LDAP_UNAVAILABLE */ ERROR_DEV_NOT_EXIST,
/* LDAP_UNWILLING_TO_PERFORM */ ERROR_CAN_NOT_COMPLETE,
/* LDAP_LOOP_DETECT */ ERROR_DS_GENERIC_ERROR,
/* 0x37 */ ERROR_DS_GENERIC_ERROR,
/* 0x38 */ ERROR_DS_GENERIC_ERROR,
/* 0x39 */ ERROR_DS_GENERIC_ERROR,
/* 0x3a */ ERROR_DS_GENERIC_ERROR,
/* 0x3b */ ERROR_DS_GENERIC_ERROR,
/* LDAP_SORT_CONTROL_MISSING */ 8261,
/* LDAP_OFFSET_RANGE_ERROR */ 8262,
/* 0x3e */ ERROR_DS_GENERIC_ERROR,
/* 0x3f */ ERROR_DS_GENERIC_ERROR,
/* LDAP_NAMING_VIOLATION */ ERROR_INVALID_PARAMETER,
/* LDAP_OBJECT_CLASS_VIOLATION */ ERROR_INVALID_PARAMETER,
/* LDAP_NOT_ALLOWED_ON_NONLEAF */ ERROR_CAN_NOT_COMPLETE,
/* LDAP_NOT_ALLOWED_ON_RDN */ ERROR_ACCESS_DENIED,
/* LDAP_ALREADY_EXISTS */ ERROR_ALREADY_EXISTS,
/* LDAP_NO_OBJECT_CLASS_MODS */ ERROR_ACCESS_DENIED,
/* LDAP_RESULTS_TOO_LARGE */ ERROR_INSUFFICIENT_BUFFER,
/* LDAP_AFFECTS_MULTIPLE_DSAS */ ERROR_CAN_NOT_COMPLETE,
/* 0x48 */ ERROR_DS_GENERIC_ERROR,
/* 0x49 */ ERROR_DS_GENERIC_ERROR,
/* 0x4a */ ERROR_DS_GENERIC_ERROR,
/* 0x4b */ ERROR_DS_GENERIC_ERROR,
/* LDAP_VIRTUAL_LIST_VIEW_ERROR */ ERROR_DS_GENERIC_ERROR,
/* 0x4d */ ERROR_DS_GENERIC_ERROR,
/* 0x4e */ ERROR_DS_GENERIC_ERROR,
/* 0x4f */ ERROR_DS_GENERIC_ERROR,
/* LDAP_OTHER */ ERROR_DS_GENERIC_ERROR,
/* LDAP_SERVER_DOWN */ ERROR_BAD_NET_RESP,
/* LDAP_LOCAL_ERROR */ ERROR_DS_GENERIC_ERROR,
/* LDAP_ENCODING_ERROR */ ERROR_UNEXP_NET_ERR,
/* LDAP_DECODING_ERROR */ ERROR_UNEXP_NET_ERR,
/* LDAP_TIMEOUT */ ERROR_SERVICE_REQUEST_TIMEOUT,
/* LDAP_AUTH_UNKNOWN */ ERROR_WRONG_PASSWORD,
/* LDAP_FILTER_ERROR */ ERROR_INVALID_PARAMETER,
/* LDAP_USER_CANCELLED */ ERROR_CANCELLED,
/* LDAP_PARAM_ERROR */ ERROR_INVALID_PARAMETER,
/* LDAP_NO_MEMORY */ ERROR_NOT_ENOUGH_MEMORY,
/* LDAP_CONNECT_ERROR */ ERROR_CONNECTION_REFUSED,
/* LDAP_NOT_SUPPORTED */ ERROR_CAN_NOT_COMPLETE,
/* LDAP_CONTROL_NOT_FOUND */ ERROR_NOT_FOUND,
/* LDAP_NO_RESULTS_RETURNED */ ERROR_MORE_DATA,
/* LDAP_MORE_RESULTS_TO_RETURN */ ERROR_MORE_DATA,
/* LDAP_CLIENT_LOOP */ ERROR_DS_GENERIC_ERROR,
/* LDAP_REFERRAL_LIMIT_EXCEEDED */ ERROR_DS_GENERIC_ERROR
};
/***********************************************************************
* LdapMapErrorToWin32 (WLDAP32.@)
*
* Map an LDAP error code to a Win32 error code.
*
* PARAMS
* err [I] An LDAP error code.
*
* RETURNS
* A Win32 error code.
*/
ULONG CDECL LdapMapErrorToWin32( ULONG err )
{
TRACE( "(0x%08x)\n", err );
if (err >= sizeof(WLDAP32_errormap)/sizeof(WLDAP32_errormap[0]))
return ERROR_DS_GENERIC_ERROR;
return WLDAP32_errormap[err];
}

View file

@ -0,0 +1,299 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#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);
/***********************************************************************
* ldap_close_extended_op (WLDAP32.@)
*
* Close an extended operation.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* msgid [I] Message ID of the operation to be closed.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Contrary to native, OpenLDAP does not require us to close
* extended operations, so this is a no-op.
*/
ULONG CDECL ldap_close_extended_op( WLDAP32_LDAP *ld, ULONG msgid )
{
TRACE( "(%p, 0x%08x)\n", ld, msgid );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
return LDAP_SUCCESS;
}
/***********************************************************************
* ldap_extended_operationA (WLDAP32.@)
*
* See ldap_extended_operationW.
*/
ULONG CDECL ldap_extended_operationA( WLDAP32_LDAP *ld, PCHAR oid, struct WLDAP32_berval *data,
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *oidW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(oid), data, serverctrls,
clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (oid) {
oidW = strAtoW( oid );
if (!oidW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_extended_operationW( ld, oidW, data, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( oidW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_extended_operationW (WLDAP32.@)
*
* Perform an extended operation (asynchronous mode).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* oid [I] OID of the extended operation.
* data [I] Data needed by the operation.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the extended operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The data parameter should be set to NULL if the operation
* requires no data. Call ldap_result with the message ID to
* get the result of the operation or ldap_abandon to cancel
* the operation. The serverctrls and clientctrls parameters
* are optional and should be set to NULL if not used. Call
* ldap_close_extended_op to close the operation.
*/
ULONG CDECL ldap_extended_operationW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP32_berval *data,
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *oidU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(oid), data, serverctrls,
clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (oid) {
oidU = strWtoU( oid );
if (!oidU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_extended_operation( ld, oid ? oidU : "", (struct berval *)data,
serverctrlsU, clientctrlsU, (int *)message );
exit:
strfreeU( oidU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_extended_operation_sA (WLDAP32.@)
*
* See ldap_extended_operation_sW.
*/
ULONG CDECL ldap_extended_operation_sA( WLDAP32_LDAP *ld, PCHAR oid, struct WLDAP32_berval *data,
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, PCHAR *retoid,
struct WLDAP32_berval **retdata )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *oidW = NULL, *retoidW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p, %p)\n", ld, debugstr_a(oid), data, serverctrls,
clientctrls, retoid, retdata );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (oid) {
oidW = strAtoW( oid );
if (!oidW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_extended_operation_sW( ld, oidW, data, serverctrlsW, clientctrlsW,
&retoidW, retdata );
if (retoid && retoidW) {
*retoid = strWtoA( retoidW );
if (!*retoid) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_memfreeW( retoidW );
}
exit:
strfreeW( oidW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_extended_operation_sW (WLDAP32.@)
*
* Perform an extended operation (synchronous mode).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* oid [I] OID of the extended operation.
* data [I] Data needed by the operation.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* retoid [O] OID of the server response message.
* retdata [O] Data returned by the server.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The data parameter should be set to NULL if the operation
* requires no data. The serverctrls, clientctrls, retoid and
* and retdata parameters are also optional. Set to NULL if not
* used. Free retoid and retdata after use with ldap_memfree.
*/
ULONG CDECL ldap_extended_operation_sW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP32_berval *data,
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, PWCHAR *retoid,
struct WLDAP32_berval **retdata )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *oidU = NULL, *retoidU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p, %p)\n", ld, debugstr_w(oid), data, serverctrls,
clientctrls, retoid, retdata );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (oid) {
oidU = strWtoU( oid );
if (!oidU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_extended_operation_s( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU,
clientctrlsU, &retoidU, (struct berval **)retdata );
if (retoid && retoidU) {
*retoid = strUtoW( retoidU );
if (!*retoid) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_memfree( retoidU );
}
exit:
strfreeU( oidU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}

View file

@ -0,0 +1,680 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#ifdef HAVE_LDAP_H
#include <ldap.h>
#else
#define LDAP_SUCCESS 0x00
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
#ifdef HAVE_LDAP
/* Should eventually be determined by the algorithm documented on MSDN. */
static const WCHAR defaulthost[] = { 'l','o','c','a','l','h','o','s','t',0 };
/* Split a space separated string of hostnames into a string array */
static char **split_hostnames( const char *hostnames )
{
char **res, *str, *p, *q;
unsigned int i = 0;
str = strdupU( hostnames );
if (!str) return NULL;
p = str;
while (isspace( *p )) p++;
if (*p) i++;
while (*p)
{
if (isspace( *p ))
{
while (isspace( *p )) p++;
if (*p) i++;
}
p++;
}
res = HeapAlloc( GetProcessHeap(), 0, (i + 1) * sizeof(char *) );
if (!res)
{
HeapFree( GetProcessHeap(), 0, str );
return NULL;
}
p = str;
while (isspace( *p )) p++;
q = p;
i = 0;
while (*p)
{
if (p[1] != '\0')
{
if (isspace( *p ))
{
*p = '\0'; p++;
res[i] = strdupU( q );
if (!res[i]) goto oom;
i++;
while (isspace( *p )) p++;
q = p;
}
}
else
{
res[i] = strdupU( q );
if (!res[i]) goto oom;
i++;
}
p++;
}
res[i] = NULL;
HeapFree( GetProcessHeap(), 0, str );
return res;
oom:
for (--i; i >= 0; i--)
strfreeU( res[i] );
HeapFree( GetProcessHeap(), 0, res );
HeapFree( GetProcessHeap(), 0, str );
return NULL;
}
/* Determine if a URL starts with a known LDAP scheme */
static int has_ldap_scheme( char *url )
{
if (!strncasecmp( url, "ldap://", 7 ) ||
!strncasecmp( url, "ldaps://", 8 ) ||
!strncasecmp( url, "ldapi://", 8 ) ||
!strncasecmp( url, "cldap://", 8 )) return 1;
return 0;
}
/* Flatten an array of hostnames into a space separated string of URLs.
* Prepend a given scheme and append a given portnumber to each hostname
* if necessary.
*/
static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnumber )
{
char *res, *p, *q, **v;
unsigned int i = 0, size = 0;
static const char sep[] = " ", fmt[] = ":%d";
char port[7];
sprintf( port, fmt, portnumber );
for (v = hostnames; *v; v++)
{
if (!has_ldap_scheme( *v ))
{
size += strlen( scheme );
q = *v;
}
else
/* skip past colon in scheme prefix */
q = strchr( *v, '/' );
size += strlen( *v );
if (!strchr( q, ':' ))
size += strlen( port );
i++;
}
size += (i - 1) * strlen( sep );
res = HeapAlloc( GetProcessHeap(), 0, size + 1 );
if (!res) return NULL;
p = res;
for (v = hostnames; *v; v++)
{
if (v != hostnames)
{
strcpy( p, sep );
p += strlen( sep );
}
if (!has_ldap_scheme( *v ))
{
strcpy( p, scheme );
p += strlen( scheme );
q = *v;
}
else
/* skip past colon in scheme prefix */
q = strchr( *v, '/' );
strcpy( p, *v );
p += strlen( *v );
if (!strchr( q, ':' ))
{
strcpy( p, port );
p += strlen( port );
}
}
return res;
}
static char *urlify_hostnames( const char *scheme, char *hostnames, ULONG port )
{
char *url = NULL, **strarray;
strarray = split_hostnames( hostnames );
if (strarray)
url = join_hostnames( scheme, strarray, port );
else
return NULL;
strarrayfreeU( strarray );
return url;
}
#endif
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* cldap_openA (WLDAP32.@)
*
* See cldap_openW.
*/
WLDAP32_LDAP * CDECL cldap_openA( PCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
if (hostname) {
hostnameW = strAtoW( hostname );
if (!hostnameW) goto exit;
}
ld = cldap_openW( hostnameW, portnumber );
exit:
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
/***********************************************************************
* cldap_openW (WLDAP32.@)
*
* Initialize an LDAP context and create a UDP connection.
*
* PARAMS
* hostname [I] Name of the host to connect to.
* portnumber [I] Portnumber to use.
*
* RETURNS
* Success: Pointer to an LDAP context.
* Failure: NULL
*
* NOTES
* The hostname string can be a space separated string of hostnames,
* in which case the LDAP runtime will try to connect to the hosts
* in order, until a connection can be made. A hostname may have a
* trailing portnumber (separated from the hostname by a ':'), which
* will take precedence over the portnumber supplied as a parameter
* to this function.
*/
WLDAP32_LDAP * CDECL cldap_openW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
if (hostname) {
hostnameU = strWtoU( hostname );
if (!hostnameU) goto exit;
}
else {
hostnameU = strWtoU( defaulthost );
if (!hostnameU) goto exit;
}
url = urlify_hostnames( "cldap://", hostnameU, portnumber );
if (!url) goto exit;
ldap_initialize( &ld, url );
exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_connect (WLDAP32.@)
*
* Connect to an LDAP server.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* timeout [I] Pointer to an l_timeval structure specifying the
* timeout in seconds.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The timeout parameter may be NULL in which case a default timeout
* value will be used.
*/
ULONG CDECL ldap_connect( WLDAP32_LDAP *ld, struct l_timeval *timeout )
{
TRACE( "(%p, %p)\n", ld, timeout );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
return LDAP_SUCCESS; /* FIXME: do something, e.g. ping the host */
}
/***********************************************************************
* ldap_initA (WLDAP32.@)
*
* See ldap_initW.
*/
WLDAP32_LDAP * CDECL ldap_initA( PCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
if (hostname) {
hostnameW = strAtoW( hostname );
if (!hostnameW) goto exit;
}
ld = ldap_initW( hostnameW, portnumber );
exit:
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_initW (WLDAP32.@)
*
* Initialize an LDAP context and create a TCP connection.
*
* PARAMS
* hostname [I] Name of the host to connect to.
* portnumber [I] Portnumber to use.
*
* RETURNS
* Success: Pointer to an LDAP context.
* Failure: NULL
*
* NOTES
* The hostname string can be a space separated string of hostnames,
* in which case the LDAP runtime will try to connect to the hosts
* in order, until a connection can be made. A hostname may have a
* trailing portnumber (separated from the hostname by a ':'), which
* will take precedence over the portnumber supplied as a parameter
* to this function. The connection will not be made until the first
* LDAP function that needs it is called.
*/
WLDAP32_LDAP * CDECL ldap_initW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
if (hostname) {
hostnameU = strWtoU( hostname );
if (!hostnameU) goto exit;
}
else {
hostnameU = strWtoU( defaulthost );
if (!hostnameU) goto exit;
}
url = urlify_hostnames( "ldap://", hostnameU, portnumber );
if (!url) goto exit;
ldap_initialize( &ld, url );
exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_openA (WLDAP32.@)
*
* See ldap_openW.
*/
WLDAP32_LDAP * CDECL ldap_openA( PCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d)\n", debugstr_a(hostname), portnumber );
if (hostname) {
hostnameW = strAtoW( hostname );
if (!hostnameW) goto exit;
}
ld = ldap_openW( hostnameW, portnumber );
exit:
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_openW (WLDAP32.@)
*
* Initialize an LDAP context and create a TCP connection.
*
* PARAMS
* hostname [I] Name of the host to connect to.
* portnumber [I] Portnumber to use.
*
* RETURNS
* Success: Pointer to an LDAP context.
* Failure: NULL
*
* NOTES
* The hostname string can be a space separated string of hostnames,
* in which case the LDAP runtime will try to connect to the hosts
* in order, until a connection can be made. A hostname may have a
* trailing portnumber (separated from the hostname by a ':'), which
* will take precedence over the portnumber supplied as a parameter
* to this function.
*/
WLDAP32_LDAP * CDECL ldap_openW( PWCHAR hostname, ULONG portnumber )
{
#ifdef HAVE_LDAP
LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d)\n", debugstr_w(hostname), portnumber );
if (hostname) {
hostnameU = strWtoU( hostname );
if (!hostnameU) goto exit;
}
else {
hostnameU = strWtoU( defaulthost );
if (!hostnameU) goto exit;
}
url = urlify_hostnames( "ldap://", hostnameU, portnumber );
if (!url) goto exit;
ldap_initialize( &ld, url );
exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_sslinitA (WLDAP32.@)
*
* See ldap_sslinitW.
*/
WLDAP32_LDAP * CDECL ldap_sslinitA( PCHAR hostname, ULONG portnumber, int secure )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld;
WCHAR *hostnameW = NULL;
TRACE( "(%s, %d, 0x%08x)\n", debugstr_a(hostname), portnumber, secure );
if (hostname) {
hostnameW = strAtoW( hostname );
if (!hostnameW) return NULL;
}
ld = ldap_sslinitW( hostnameW, portnumber, secure );
strfreeW( hostnameW );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_sslinitW (WLDAP32.@)
*
* Initialize an LDAP context and create a secure TCP connection.
*
* PARAMS
* hostname [I] Name of the host to connect to.
* portnumber [I] Portnumber to use.
* secure [I] Ask the server to create an SSL connection.
*
* RETURNS
* Success: Pointer to an LDAP context.
* Failure: NULL
*
* NOTES
* The hostname string can be a space separated string of hostnames,
* in which case the LDAP runtime will try to connect to the hosts
* in order, until a connection can be made. A hostname may have a
* trailing portnumber (separated from the hostname by a ':'), which
* will take precedence over the portnumber supplied as a parameter
* to this function. The connection will not be made until the first
* LDAP function that needs it is called.
*/
WLDAP32_LDAP * CDECL ldap_sslinitW( PWCHAR hostname, ULONG portnumber, int secure )
{
#ifdef HAVE_LDAP
WLDAP32_LDAP *ld = NULL;
char *hostnameU = NULL, *url = NULL;
TRACE( "(%s, %d, 0x%08x)\n", debugstr_w(hostname), portnumber, secure );
if (hostname) {
hostnameU = strWtoU( hostname );
if (!hostnameU) goto exit;
}
else {
hostnameU = strWtoU( defaulthost );
if (!hostnameU) goto exit;
}
if (secure)
url = urlify_hostnames( "ldaps://", hostnameU, portnumber );
else
url = urlify_hostnames( "ldap://", hostnameU, portnumber );
if (!url) goto exit;
ldap_initialize( &ld, url );
exit:
strfreeU( hostnameU );
strfreeU( url );
return ld;
#endif
return NULL;
}
/***********************************************************************
* ldap_start_tls_sA (WLDAP32.@)
*
* See ldap_start_tls_sW.
*/
ULONG CDECL ldap_start_tls_sA( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result,
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
if (!ld) return ~0UL;
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_start_tls_sW( ld, retval, result, serverctrlsW, clientctrlsW );
exit:
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_start_tls_s (WLDAP32.@)
*
* Start TLS encryption on an LDAP connection.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* retval [I] Return value from the server.
* result [I] Response message from the server.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* LDAP function that needs it is called.
*/
ULONG CDECL ldap_start_tls_sW( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **result,
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %p, %p, %p, %p)\n", ld, retval, result, serverctrls, clientctrls );
if (!ld) return ~0UL;
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_start_tls_s( ld, serverctrlsU, clientctrlsU );
exit:
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_startup (WLDAP32.@)
*/
ULONG CDECL ldap_startup( PLDAP_VERSION_INFO version, HANDLE *instance )
{
TRACE( "(%p, %p)\n", version, instance );
return LDAP_SUCCESS;
}
/***********************************************************************
* ldap_stop_tls_s (WLDAP32.@)
*
* Stop TLS encryption on an LDAP connection.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
BOOLEAN CDECL ldap_stop_tls_s( WLDAP32_LDAP *ld )
{
TRACE( "(%p)\n", ld );
return TRUE; /* FIXME: find a way to stop tls on a connection */
}

View file

@ -0,0 +1,47 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/debug.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
HINSTANCE hwldap32;
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
TRACE( "(%p, %d, %p)\n", hinst, reason, reserved );
switch (reason)
{
case DLL_PROCESS_ATTACH:
hwldap32 = hinst;
DisableThreadLibraryCalls( hinst );
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,665 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#ifdef HAVE_LDAP_H
#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);
/***********************************************************************
* ldap_abandon (WLDAP32.@)
*
* Cancel an asynchronous operation.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* msgid [I] ID of the operation to cancel.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL WLDAP32_ldap_abandon( WLDAP32_LDAP *ld, ULONG msgid )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x)\n", ld, msgid );
if (!ld) return ~0UL;
ret = ldap_abandon_ext( ld, msgid, NULL, NULL );
#endif
return ret;
}
/***********************************************************************
* ldap_check_filterA (WLDAP32.@)
*
* See ldap_check_filterW.
*/
ULONG CDECL ldap_check_filterA( WLDAP32_LDAP *ld, PCHAR filter )
{
ULONG ret;
WCHAR *filterW = NULL;
TRACE( "(%p, %s)\n", ld, debugstr_a(filter) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (filter) {
filterW = strAtoW( filter );
if (!filterW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_check_filterW( ld, filterW );
strfreeW( filterW );
return ret;
}
/***********************************************************************
* ldap_check_filterW (WLDAP32.@)
*
* Check filter syntax.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* filter [I] Filter string.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_check_filterW( WLDAP32_LDAP *ld, PWCHAR filter )
{
TRACE( "(%p, %s)\n", ld, debugstr_w(filter) );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
return LDAP_SUCCESS; /* FIXME: do some checks */
}
/***********************************************************************
* ldap_cleanup (WLDAP32.@)
*/
ULONG CDECL ldap_cleanup( HANDLE instance )
{
TRACE( "(%p)\n", instance );
return LDAP_SUCCESS;
}
/***********************************************************************
* ldap_conn_from_msg (WLDAP32.@)
*
* Get the LDAP context for a given message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] LDAP message.
*
* RETURNS
* Success: Pointer to an LDAP context.
* Failure: NULL
*/
WLDAP32_LDAP * CDECL ldap_conn_from_msg( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res )
{
TRACE( "(%p, %p)\n", ld, res );
if (!ld || !res) return NULL;
return ld; /* FIXME: not always correct */
}
/***********************************************************************
* ldap_count_entries (WLDAP32.@)
*
* Count the number of entries returned from a search.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] LDAP message.
*
* RETURNS
* Success: The number of entries.
* Failure: ~0UL
*/
ULONG CDECL WLDAP32_ldap_count_entries( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return ~0UL;
ret = ldap_count_entries( ld, res );
#endif
return ret;
}
/***********************************************************************
* ldap_count_references (WLDAP32.@)
*
* Count the number of references returned from a search.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] LDAP message.
*
* RETURNS
* Success: The number of references.
* Failure: ~0UL
*/
ULONG CDECL WLDAP32_ldap_count_references( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP_COUNT_REFERENCES
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return 0;
ret = ldap_count_references( ld, res );
#endif
return ret;
}
static ULONG get_escape_size( PCHAR src, ULONG srclen )
{
ULONG i, size = 0;
if (src)
{
for (i = 0; i < srclen; i++)
{
if ((src[i] >= '0' && src[i] <= '9') ||
(src[i] >= 'A' && src[i] <= 'Z') ||
(src[i] >= 'a' && src[i] <= 'z'))
size++;
else
size += 3;
}
}
return size + 1;
}
static void escape_filter_element( PCHAR src, ULONG srclen, PCHAR dst )
{
ULONG i;
static const char fmt[] = "\\%02X";
char *d = dst;
for (i = 0; i < srclen; i++)
{
if ((src[i] >= '0' && src[i] <= '9') ||
(src[i] >= 'A' && src[i] <= 'Z') ||
(src[i] >= 'a' && src[i] <= 'z'))
*d++ = src[i];
else
{
sprintf( d, fmt, (unsigned char)src[i] );
d += 3;
}
}
*++d = 0;
}
/***********************************************************************
* ldap_escape_filter_elementA (WLDAP32.@)
*
* See ldap_escape_filter_elementW.
*/
ULONG CDECL ldap_escape_filter_elementA( PCHAR src, ULONG srclen, PCHAR dst, ULONG dstlen )
{
ULONG len;
TRACE( "(%p, 0x%08x, %p, 0x%08x)\n", src, srclen, dst, dstlen );
len = get_escape_size( src, srclen );
if (!dst) return len;
if (!src || dstlen < len)
return WLDAP32_LDAP_PARAM_ERROR;
else
{
escape_filter_element( src, srclen, dst );
return LDAP_SUCCESS;
}
}
/***********************************************************************
* ldap_escape_filter_elementW (WLDAP32.@)
*
* Escape binary data for safe passing in filters.
*
* PARAMS
* src [I] Filter element to be escaped.
* srclen [I] Length in bytes of the filter element.
* dst [O] Destination buffer for the escaped filter element.
* dstlen [I] Length in bytes of the destination buffer.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_escape_filter_elementW( PCHAR src, ULONG srclen, PWCHAR dst, ULONG dstlen )
{
ULONG len;
TRACE( "(%p, 0x%08x, %p, 0x%08x)\n", src, srclen, dst, dstlen );
len = get_escape_size( src, srclen );
if (!dst) return len;
/* no matter what you throw at it, this is what native returns */
return WLDAP32_LDAP_PARAM_ERROR;
}
/***********************************************************************
* ldap_first_attributeA (WLDAP32.@)
*
* See ldap_first_attributeW.
*/
PCHAR CDECL ldap_first_attributeA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry,
WLDAP32_BerElement** ptr )
{
PCHAR ret = NULL;
#ifdef HAVE_LDAP
WCHAR *retW;
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry) return NULL;
retW = ldap_first_attributeW( ld, entry, ptr );
ret = strWtoA( retW );
ldap_memfreeW( retW );
#endif
return ret;
}
/***********************************************************************
* ldap_first_attributeW (WLDAP32.@)
*
* Get the first attribute for a given entry.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] Entry to retrieve attribute for.
* ptr [O] Position pointer.
*
* RETURNS
* Success: Name of the first attribute.
* Failure: NULL
*
* NOTES
* Use ldap_memfree to free the returned string.
*/
PWCHAR CDECL ldap_first_attributeW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry,
WLDAP32_BerElement** ptr )
{
PWCHAR ret = NULL;
#ifdef HAVE_LDAP
char *retU;
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry) return NULL;
retU = ldap_first_attribute( ld, entry, ptr );
ret = strUtoW( retU );
ldap_memfree( retU );
#endif
return ret;
}
/***********************************************************************
* ldap_first_entry (WLDAP32.@)
*
* Get the first entry from a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] Search result message.
*
* RETURNS
* Success: The first entry.
* Failure: NULL
*
* NOTES
* The returned entry will be freed when the message is freed.
*/
WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_entry( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res )
{
#ifdef HAVE_LDAP
TRACE( "(%p, %p)\n", ld, res );
if (!ld || !res) return NULL;
return ldap_first_entry( ld, res );
#endif
return NULL;
}
/***********************************************************************
* ldap_first_reference (WLDAP32.@)
*
* Get the first reference from a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* res [I] Search result message.
*
* RETURNS
* Success: The first reference.
* Failure: NULL
*/
WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_reference( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res )
{
#ifdef HAVE_LDAP_FIRST_REFERENCE
TRACE( "(%p, %p)\n", ld, res );
if (!ld) return NULL;
return ldap_first_reference( ld, res );
#endif
return NULL;
}
/***********************************************************************
* ldap_memfreeA (WLDAP32.@)
*
* See ldap_memfreeW.
*/
void CDECL ldap_memfreeA( PCHAR block )
{
TRACE( "(%p)\n", block );
strfreeA( block );
}
/***********************************************************************
* ldap_memfreeW (WLDAP32.@)
*
* Free a block of memory.
*
* PARAMS
* block [I] Pointer to memory block to be freed.
*/
void CDECL ldap_memfreeW( PWCHAR block )
{
TRACE( "(%p)\n", block );
strfreeW( block );
}
/***********************************************************************
* ldap_msgfree (WLDAP32.@)
*
* Free a message.
*
* PARAMS
* res [I] Message to be freed.
*/
ULONG CDECL WLDAP32_ldap_msgfree( WLDAP32_LDAPMessage *res )
{
ULONG ret = LDAP_SUCCESS;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", res );
ldap_msgfree( res );
#endif
return ret;
}
/***********************************************************************
* ldap_next_attributeA (WLDAP32.@)
*
* See ldap_next_attributeW.
*/
PCHAR CDECL ldap_next_attributeA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry,
WLDAP32_BerElement *ptr )
{
PCHAR ret = NULL;
#ifdef HAVE_LDAP
WCHAR *retW;
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry || !ptr) return NULL;
retW = ldap_next_attributeW( ld, entry, ptr );
ret = strWtoA( retW );
ldap_memfreeW( retW );
#endif
return ret;
}
/***********************************************************************
* ldap_next_attributeW (WLDAP32.@)
*
* Get the next attribute for a given entry.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] Entry to retrieve attribute for.
* ptr [I/O] Position pointer.
*
* RETURNS
* Success: The name of the next attribute.
* Failure: NULL
*
* NOTES
* Free the returned string after each iteration with ldap_memfree.
* When done iterating and when ptr != NULL, call ber_free( ptr, 0 ).
*/
PWCHAR CDECL ldap_next_attributeW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry,
WLDAP32_BerElement *ptr )
{
PWCHAR ret = NULL;
#ifdef HAVE_LDAP
char *retU;
TRACE( "(%p, %p, %p)\n", ld, entry, ptr );
if (!ld || !entry || !ptr) return NULL;
retU = ldap_next_attribute( ld, entry, ptr );
ret = strUtoW( retU );
ldap_memfree( retU );
#endif
return ret;
}
/***********************************************************************
* ldap_next_entry (WLDAP32.@)
*
* Get the next entry from a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] Entry returned by a previous call.
*
* RETURNS
* Success: The next entry.
* Failure: NULL
*
* NOTES
* The returned entry will be freed when the message is freed.
*/
WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_entry( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry )
{
#ifdef HAVE_LDAP
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
return ldap_next_entry( ld, entry );
#endif
return NULL;
}
/***********************************************************************
* ldap_next_reference (WLDAP32.@)
*
* Get the next reference from a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] Entry returned by a previous call.
*
* RETURNS
* Success: The next reference.
* Failure: NULL
*
* NOTES
* The returned entry will be freed when the message is freed.
*/
WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_reference( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry )
{
#ifdef HAVE_LDAP_NEXT_REFERENCE
TRACE( "(%p, %p)\n", ld, entry );
if (!ld || !entry) return NULL;
return ldap_next_reference( ld, entry );
#endif
return NULL;
}
/***********************************************************************
* ldap_result (WLDAP32.@)
*
* Get the result of an asynchronous operation.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* msgid [I] Message ID of the operation.
* all [I] How many results should be returned?
* timeout [I] How long to wait for the results?
* res [O] Result message for the operation.
*
* RETURNS
* Success: One of the following values:
*
* LDAP_RES_ADD
* LDAP_RES_BIND
* LDAP_RES_COMPARE
* LDAP_RES_DELETE
* LDAP_RES_EXTENDED
* LDAP_RES_MODIFY
* LDAP_RES_MODRDN
* LDAP_RES_REFERRAL
* LDAP_RES_SEARCH_ENTRY
* LDAP_RES_SEARCH_RESULT
*
* Failure: ~0UL
*
* This function returns 0 when the timeout has expired.
*
* NOTES
* A NULL timeout pointer causes the function to block waiting
* for results to arrive. A timeout value of 0 causes the function
* to immediately return any available results. Free returned results
* with ldap_msgfree.
*/
ULONG CDECL WLDAP32_ldap_result( WLDAP32_LDAP *ld, ULONG msgid, ULONG all,
struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
{
ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, 0x%08x, %p, %p)\n", ld, msgid, all, timeout, res );
if (!ld || !res || msgid == ~0UL) return ~0UL;
ret = ldap_result( ld, msgid, all, (struct timeval *)timeout, res );
#endif
return ret;
}
/***********************************************************************
* LdapUnicodeToUTF8 (WLDAP32.@)
*
* Convert a wide character string to a UTF8 string.
*
* PARAMS
* src [I] Wide character string to convert.
* srclen [I] Size of string to convert, in characters.
* dst [O] Pointer to a buffer that receives the converted string.
* dstlen [I] Size of the destination buffer in characters.
*
* RETURNS
* The number of characters written into the destination buffer.
*
* NOTES
* Set dstlen to zero to ask for the required buffer size.
*/
int CDECL LdapUnicodeToUTF8( LPCWSTR src, int srclen, LPSTR dst, int dstlen )
{
return WideCharToMultiByte( CP_UTF8, 0, src, srclen, dst, dstlen, NULL, NULL );
}
/***********************************************************************
* LdapUTF8ToUnicode (WLDAP32.@)
*
* Convert a UTF8 string to a wide character string.
*
* PARAMS
* src [I] UTF8 string to convert.
* srclen [I] Size of string to convert, in characters.
* dst [O] Pointer to a buffer that receives the converted string.
* dstlen [I] Size of the destination buffer in characters.
*
* RETURNS
* The number of characters written into the destination buffer.
*
* NOTES
* Set dstlen to zero to ask for the required buffer size.
*/
int CDECL LdapUTF8ToUnicode( LPCSTR src, int srclen, LPWSTR dst, int dstlen )
{
return MultiByteToWideChar( CP_UTF8, 0, src, srclen, dst, dstlen );
}

View file

@ -0,0 +1,464 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#endif
#ifndef LDAP_NOT_SUPPORTED
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
#ifdef HAVE_LDAP
static LDAPMod *nullmods[] = { NULL };
#endif
/***********************************************************************
* ldap_modifyA (WLDAP32.@)
*
* See ldap_modifyW.
*/
ULONG CDECL ldap_modifyA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (mods) {
modsW = modarrayAtoW( mods );
if (!modsW) goto exit;
}
ret = ldap_modifyW( ld, dnW, modsW );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
#endif
return ret;
}
/***********************************************************************
* ldap_modifyW (WLDAP32.@)
*
* Change an entry in a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* mods [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to change.
*
* RETURNS
* Success: Message ID of the modify operation.
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **modsU = NULL;
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (mods) {
modsU = modarrayWtoU( mods );
if (!modsU) goto exit;
}
ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods,
NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_extA (WLDAP32.@)
*
* See ldap_modify_extW.
*/
ULONG CDECL ldap_modify_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
serverctrls, clientctrls, message );
if (!ld) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (mods) {
modsW = modarrayAtoW( mods );
if (!modsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_extW (WLDAP32.@)
*
* Change an entry in a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* mods [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to change.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the modify operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. The serverctrls and clientctrls parameters are
* optional and should be set to NULL if not used.
*/
ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **modsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
int dummy;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
serverctrls, clientctrls, message );
if (!ld) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (mods) {
modsU = modarrayWtoU( mods );
if (!modsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
clientctrlsU, message ? (int *)message : &dummy );
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_ext_sA (WLDAP32.@)
*
* See ldap_modify_ext_sW.
*/
ULONG CDECL ldap_modify_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (mods) {
modsW = modarrayAtoW( mods );
if (!modsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_ext_sW (WLDAP32.@)
*
* Change an entry in a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* mods [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to change.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* The serverctrls and clientctrls parameters are optional and
* should be set to NULL if not used.
*/
ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **modsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (mods) {
modsU = modarrayWtoU( mods );
if (!modsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods,
serverctrlsU, clientctrlsU );
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_sA (WLDAP32.@)
*
* See ldap_modify_sW.
*/
ULONG CDECL ldap_modify_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL;
LDAPModW **modsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (mods) {
modsW = modarrayAtoW( mods );
if (!modsW) goto exit;
}
ret = ldap_modify_sW( ld, dnW, modsW );
exit:
strfreeW( dnW );
modarrayfreeW( modsW );
#endif
return ret;
}
/***********************************************************************
* ldap_modify_sW (WLDAP32.@)
*
* Change an entry in a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* attrs [I] Pointer to an array of LDAPModW structures, each
* specifying an attribute and its values to change.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL;
LDAPMod **modsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (mods) {
modsU = modarrayWtoU( mods );
if (!modsU) goto exit;
}
ret = ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods, NULL, NULL );
exit:
strfreeU( dnU );
modarrayfreeU( modsU );
#endif
return ret;
}

View file

@ -0,0 +1,381 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_modrdnA (WLDAP32.@)
*
* See ldap_modrdnW.
*/
ULONG CDECL ldap_modrdnA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newdnW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) );
if (!ld || !newdn) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
newdnW = strAtoW( newdn );
if (!newdnW) goto exit;
ret = ldap_modrdnW( ld, dnW, newdnW );
exit:
strfreeW( dnW );
strfreeW( newdnW );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdnW (WLDAP32.@)
*
* Change the RDN of a directory entry (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newdn [I] New DN for the entry.
*
* RETURNS
* Success: Message ID of the modrdn operation.
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newdnU = NULL;
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
if (!ld || !newdn) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
strfreeU( newdnU );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn2A (WLDAP32.@)
*
* See ldap_modrdn2W.
*/
ULONG CDECL ldap_modrdn2A( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newdnW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
if (!ld || !newdn) return ~0UL;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
newdnW = strAtoW( newdn );
if (!newdnW) goto exit;
ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
exit:
strfreeW( dnW );
strfreeW( newdnW );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn2W (WLDAP32.@)
*
* Change the RDN of a directory entry (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newdn [I] New DN for the entry.
* delete [I] Delete old DN?
*
* RETURNS
* Success: Message ID of the modrdn operation.
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newdnU = NULL;
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
if (!ld || !newdn) return ~0UL;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( dnU );
strfreeU( newdnU );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn2_sA (WLDAP32.@)
*
* See ldap_modrdn2_sW.
*/
ULONG CDECL ldap_modrdn2_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newdnW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
newdnW = strAtoW( newdn );
if (!newdnW) goto exit;
ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
exit:
strfreeW( dnW );
strfreeW( newdnW );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn2_sW (WLDAP32.@)
*
* Change the RDN of a directory entry (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newdn [I] New DN for the entry.
* delete [I] Delete old DN?
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newdnU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL );
exit:
strfreeU( dnU );
strfreeU( newdnU );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn_sA (WLDAP32.@)
*
* See ldap_modrdn_sW.
*/
ULONG CDECL ldap_modrdn_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newdnW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
newdnW = strAtoW( newdn );
if (!newdnW) goto exit;
ret = ldap_modrdn_sW( ld, dnW, newdnW );
exit:
strfreeW( dnW );
strfreeW( newdnW );
#endif
return ret;
}
/***********************************************************************
* ldap_modrdn_sW (WLDAP32.@)
*
* Change the RDN of a directory entry (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newdn [I] New DN for the entry.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newdnU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
newdnU = strWtoU( newdn );
if (!newdnU) goto exit;
ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL );
exit:
strfreeU( dnU );
strfreeU( newdnU );
#endif
return ret;
}

View file

@ -0,0 +1,504 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_get_optionA (WLDAP32.@)
*
* See ldap_get_optionW.
*/
ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
switch (option)
{
case WLDAP32_LDAP_OPT_API_FEATURE_INFO:
{
LDAPAPIFeatureInfoW featureW;
LDAPAPIFeatureInfoA *featureA = value;
if (!featureA->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
featureW.ldapaif_info_version = featureA->ldapaif_info_version;
featureW.ldapaif_name = strAtoW( featureA->ldapaif_name );
featureW.ldapaif_version = 0;
if (!featureW.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_get_optionW( ld, option, &featureW );
featureA->ldapaif_version = featureW.ldapaif_version;
strfreeW( featureW.ldapaif_name );
return ret;
}
case WLDAP32_LDAP_OPT_API_INFO:
{
LDAPAPIInfoW infoW;
LDAPAPIInfoA *infoA = value;
memset( &infoW, 0, sizeof(LDAPAPIInfoW) );
infoW.ldapai_info_version = infoA->ldapai_info_version;
ret = ldap_get_optionW( ld, option, &infoW );
infoA->ldapai_api_version = infoW.ldapai_api_version;
infoA->ldapai_protocol_version = infoW.ldapai_protocol_version;
if (infoW.ldapai_extensions)
{
infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions );
if (!infoA->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
}
if (infoW.ldapai_vendor_name)
{
infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name );
if (!infoA->ldapai_vendor_name)
{
ldap_value_freeW( infoW.ldapai_extensions );
return WLDAP32_LDAP_NO_MEMORY;
}
}
infoA->ldapai_vendor_version = infoW.ldapai_vendor_version;
ldap_value_freeW( infoW.ldapai_extensions );
ldap_memfreeW( infoW.ldapai_vendor_name );
return ret;
}
case WLDAP32_LDAP_OPT_DEREF:
case WLDAP32_LDAP_OPT_DESC:
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
case WLDAP32_LDAP_OPT_PROTOCOL_VERSION:
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_get_optionW( ld, option, value );
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
case WLDAP32_LDAP_OPT_IO_FN_PTRS:
case WLDAP32_LDAP_OPT_REBIND_ARG:
case WLDAP32_LDAP_OPT_REBIND_FN:
case WLDAP32_LDAP_OPT_RESTART:
case WLDAP32_LDAP_OPT_THREAD_FN_PTRS:
return LDAP_LOCAL_ERROR;
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
case WLDAP32_LDAP_OPT_ENCRYPT:
case WLDAP32_LDAP_OPT_ERROR_STRING:
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
case WLDAP32_LDAP_OPT_HOST_NAME:
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
case WLDAP32_LDAP_OPT_PING_LIMIT:
case WLDAP32_LDAP_OPT_PING_WAIT_TIME:
case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS:
case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG:
case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK:
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
case WLDAP32_LDAP_OPT_ROOTDSE_CACHE:
case WLDAP32_LDAP_OPT_SASL_METHOD:
case WLDAP32_LDAP_OPT_SECURITY_CONTEXT:
case WLDAP32_LDAP_OPT_SEND_TIMEOUT:
case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE:
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
case WLDAP32_LDAP_OPT_SERVER_ERROR:
case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR:
case WLDAP32_LDAP_OPT_SIGN:
case WLDAP32_LDAP_OPT_SSL:
case WLDAP32_LDAP_OPT_SSL_INFO:
case WLDAP32_LDAP_OPT_SSPI_FLAGS:
case WLDAP32_LDAP_OPT_TCP_KEEPALIVE:
FIXME( "Unsupported option: 0x%02x\n", option );
return LDAP_NOT_SUPPORTED;
default:
FIXME( "Unknown option: 0x%02x\n", option );
return LDAP_LOCAL_ERROR;
}
#endif
return ret;
}
/***********************************************************************
* ldap_get_optionW (WLDAP32.@)
*
* Retrieve option values for a given LDAP context.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* option [I] Option to get values for.
* value [O] Pointer to option values.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
switch (option)
{
case WLDAP32_LDAP_OPT_API_FEATURE_INFO:
{
LDAPAPIFeatureInfo featureU;
LDAPAPIFeatureInfoW *featureW = value;
if (!featureW->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR;
featureU.ldapaif_info_version = featureW->ldapaif_info_version;
featureU.ldapaif_name = strWtoU( featureW->ldapaif_name );
featureU.ldapaif_version = 0;
if (!featureU.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_get_option( ld, option, &featureU );
featureW->ldapaif_version = featureU.ldapaif_version;
strfreeU( featureU.ldapaif_name );
return ret;
}
case WLDAP32_LDAP_OPT_API_INFO:
{
LDAPAPIInfo infoU;
LDAPAPIInfoW *infoW = value;
memset( &infoU, 0, sizeof(LDAPAPIInfo) );
infoU.ldapai_info_version = infoW->ldapai_info_version;
ret = ldap_get_option( ld, option, &infoU );
infoW->ldapai_api_version = infoU.ldapai_api_version;
infoW->ldapai_protocol_version = infoU.ldapai_protocol_version;
if (infoU.ldapai_extensions)
{
infoW->ldapai_extensions = strarrayUtoW( infoU.ldapai_extensions );
if (!infoW->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY;
}
if (infoU.ldapai_vendor_name)
{
infoW->ldapai_vendor_name = strUtoW( infoU.ldapai_vendor_name );
if (!infoW->ldapai_vendor_name)
{
ldap_memvfree( (void **)infoU.ldapai_extensions );
return WLDAP32_LDAP_NO_MEMORY;
}
}
infoW->ldapai_vendor_version = infoU.ldapai_vendor_version;
ldap_memvfree( (void **)infoU.ldapai_extensions );
ldap_memfree( infoU.ldapai_vendor_name );
return ret;
}
case WLDAP32_LDAP_OPT_DEREF:
case WLDAP32_LDAP_OPT_DESC:
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
case WLDAP32_LDAP_OPT_PROTOCOL_VERSION:
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_get_option( ld, option, value );
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
case WLDAP32_LDAP_OPT_IO_FN_PTRS:
case WLDAP32_LDAP_OPT_REBIND_ARG:
case WLDAP32_LDAP_OPT_REBIND_FN:
case WLDAP32_LDAP_OPT_RESTART:
case WLDAP32_LDAP_OPT_THREAD_FN_PTRS:
return LDAP_LOCAL_ERROR;
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
case WLDAP32_LDAP_OPT_ENCRYPT:
case WLDAP32_LDAP_OPT_ERROR_STRING:
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
case WLDAP32_LDAP_OPT_HOST_NAME:
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
case WLDAP32_LDAP_OPT_PING_LIMIT:
case WLDAP32_LDAP_OPT_PING_WAIT_TIME:
case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS:
case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG:
case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK:
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
case WLDAP32_LDAP_OPT_ROOTDSE_CACHE:
case WLDAP32_LDAP_OPT_SASL_METHOD:
case WLDAP32_LDAP_OPT_SECURITY_CONTEXT:
case WLDAP32_LDAP_OPT_SEND_TIMEOUT:
case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE:
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
case WLDAP32_LDAP_OPT_SERVER_ERROR:
case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR:
case WLDAP32_LDAP_OPT_SIGN:
case WLDAP32_LDAP_OPT_SSL:
case WLDAP32_LDAP_OPT_SSL_INFO:
case WLDAP32_LDAP_OPT_SSPI_FLAGS:
case WLDAP32_LDAP_OPT_TCP_KEEPALIVE:
FIXME( "Unsupported option: 0x%02x\n", option );
return LDAP_NOT_SUPPORTED;
default:
FIXME( "Unknown option: 0x%02x\n", option );
return LDAP_LOCAL_ERROR;
}
#endif
return ret;
}
/***********************************************************************
* ldap_set_optionA (WLDAP32.@)
*
* See ldap_set_optionW.
*/
ULONG CDECL ldap_set_optionA( WLDAP32_LDAP *ld, int option, void *value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
switch (option)
{
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
{
LDAPControlW **ctrlsW;
ctrlsW = controlarrayAtoW( (LDAPControlA **)value );
if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_set_optionW( ld, option, ctrlsW );
controlarrayfreeW( ctrlsW );
return ret;
}
case WLDAP32_LDAP_OPT_DEREF:
case WLDAP32_LDAP_OPT_DESC:
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
case WLDAP32_LDAP_OPT_PROTOCOL_VERSION:
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_set_optionW( ld, option, value );
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
case WLDAP32_LDAP_OPT_IO_FN_PTRS:
case WLDAP32_LDAP_OPT_REBIND_ARG:
case WLDAP32_LDAP_OPT_REBIND_FN:
case WLDAP32_LDAP_OPT_RESTART:
case WLDAP32_LDAP_OPT_THREAD_FN_PTRS:
return LDAP_LOCAL_ERROR;
case WLDAP32_LDAP_OPT_API_FEATURE_INFO:
case WLDAP32_LDAP_OPT_API_INFO:
return LDAP_UNWILLING_TO_PERFORM;
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
case WLDAP32_LDAP_OPT_ENCRYPT:
case WLDAP32_LDAP_OPT_ERROR_STRING:
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
case WLDAP32_LDAP_OPT_HOST_NAME:
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
case WLDAP32_LDAP_OPT_PING_LIMIT:
case WLDAP32_LDAP_OPT_PING_WAIT_TIME:
case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS:
case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG:
case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK:
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
case WLDAP32_LDAP_OPT_ROOTDSE_CACHE:
case WLDAP32_LDAP_OPT_SASL_METHOD:
case WLDAP32_LDAP_OPT_SECURITY_CONTEXT:
case WLDAP32_LDAP_OPT_SEND_TIMEOUT:
case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE:
case WLDAP32_LDAP_OPT_SERVER_ERROR:
case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR:
case WLDAP32_LDAP_OPT_SIGN:
case WLDAP32_LDAP_OPT_SSL:
case WLDAP32_LDAP_OPT_SSL_INFO:
case WLDAP32_LDAP_OPT_SSPI_FLAGS:
case WLDAP32_LDAP_OPT_TCP_KEEPALIVE:
FIXME( "Unsupported option: 0x%02x\n", option );
return LDAP_NOT_SUPPORTED;
default:
FIXME( "Unknown option: 0x%02x\n", option );
return LDAP_LOCAL_ERROR;
}
#endif
return ret;
}
/***********************************************************************
* ldap_set_optionW (WLDAP32.@)
*
* Set option values for a given LDAP context.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* option [I] Option to set values for.
* value [I] Pointer to option values.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Set value to LDAP_OPT_ON or LDAP_OPT_OFF for on/off options.
*/
ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, %p)\n", ld, option, value );
if (!ld || !value) return WLDAP32_LDAP_PARAM_ERROR;
switch (option)
{
case WLDAP32_LDAP_OPT_SERVER_CONTROLS:
{
LDAPControl **ctrlsU;
ctrlsU = controlarrayWtoU( (LDAPControlW **)value );
if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_set_option( ld, option, ctrlsU );
controlarrayfreeU( ctrlsU );
return ret;
}
case WLDAP32_LDAP_OPT_DEREF:
case WLDAP32_LDAP_OPT_DESC:
case WLDAP32_LDAP_OPT_ERROR_NUMBER:
case WLDAP32_LDAP_OPT_PROTOCOL_VERSION:
case WLDAP32_LDAP_OPT_REFERRALS:
case WLDAP32_LDAP_OPT_SIZELIMIT:
case WLDAP32_LDAP_OPT_TIMELIMIT:
return ldap_set_option( ld, option, value );
case WLDAP32_LDAP_OPT_CACHE_ENABLE:
case WLDAP32_LDAP_OPT_CACHE_FN_PTRS:
case WLDAP32_LDAP_OPT_CACHE_STRATEGY:
case WLDAP32_LDAP_OPT_IO_FN_PTRS:
case WLDAP32_LDAP_OPT_REBIND_ARG:
case WLDAP32_LDAP_OPT_REBIND_FN:
case WLDAP32_LDAP_OPT_RESTART:
case WLDAP32_LDAP_OPT_THREAD_FN_PTRS:
return LDAP_LOCAL_ERROR;
case WLDAP32_LDAP_OPT_API_FEATURE_INFO:
case WLDAP32_LDAP_OPT_API_INFO:
return LDAP_UNWILLING_TO_PERFORM;
case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE:
case WLDAP32_LDAP_OPT_AUTO_RECONNECT:
case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE:
case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME:
case WLDAP32_LDAP_OPT_ENCRYPT:
case WLDAP32_LDAP_OPT_ERROR_STRING:
case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND:
case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS:
case WLDAP32_LDAP_OPT_HOST_NAME:
case WLDAP32_LDAP_OPT_HOST_REACHABLE:
case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE:
case WLDAP32_LDAP_OPT_PING_LIMIT:
case WLDAP32_LDAP_OPT_PING_WAIT_TIME:
case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS:
case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG:
case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK:
case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT:
case WLDAP32_LDAP_OPT_ROOTDSE_CACHE:
case WLDAP32_LDAP_OPT_SASL_METHOD:
case WLDAP32_LDAP_OPT_SECURITY_CONTEXT:
case WLDAP32_LDAP_OPT_SEND_TIMEOUT:
case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE:
case WLDAP32_LDAP_OPT_SERVER_ERROR:
case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR:
case WLDAP32_LDAP_OPT_SIGN:
case WLDAP32_LDAP_OPT_SSL:
case WLDAP32_LDAP_OPT_SSL_INFO:
case WLDAP32_LDAP_OPT_SSPI_FLAGS:
case WLDAP32_LDAP_OPT_TCP_KEEPALIVE:
FIXME( "Unsupported option: 0x%02x\n", option );
return LDAP_NOT_SUPPORTED;
default:
FIXME( "Unknown option: 0x%02x\n", option );
return LDAP_LOCAL_ERROR;
}
#endif
return ret;
}

View file

@ -0,0 +1,296 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_SUCCESS 0x00
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
#ifndef LDAP_MAXINT
#define LDAP_MAXINT 2147483647
#endif
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_create_page_controlA (WLDAP32.@)
*
* See ldap_create_page_controlW.
*/
ULONG CDECL ldap_create_page_controlA( WLDAP32_LDAP *ld, ULONG pagesize,
struct WLDAP32_berval *cookie, UCHAR critical, PLDAPControlA *control )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW *controlW = NULL;
TRACE( "(%p, 0x%08x, %p, 0x%02x, %p)\n", ld, pagesize, cookie,
critical, control );
if (!ld || !control || pagesize > LDAP_MAXINT)
return WLDAP32_LDAP_PARAM_ERROR;
ret = ldap_create_page_controlW( ld, pagesize, cookie, critical, &controlW );
if (ret == LDAP_SUCCESS)
{
*control = controlWtoA( controlW );
ldap_control_freeW( controlW );
}
#endif
return ret;
}
#ifdef HAVE_LDAP
/* create a page control by hand */
static ULONG create_page_control( ULONG pagesize, struct WLDAP32_berval *cookie,
UCHAR critical, PLDAPControlW *control )
{
LDAPControlW *ctrl;
BerElement *ber;
ber_tag_t tag;
struct berval *berval, null_cookie = { 0, NULL };
INT ret, len;
char *val;
ber = ber_alloc_t( LBER_USE_DER );
if (!ber) return WLDAP32_LDAP_NO_MEMORY;
if (cookie)
tag = ber_printf( ber, "{iO}", (ber_int_t)pagesize, cookie );
else
tag = ber_printf( ber, "{iO}", (ber_int_t)pagesize, &null_cookie );
ret = ber_flatten( ber, &berval );
ber_free( ber, 1 );
if (tag == LBER_ERROR)
return WLDAP32_LDAP_ENCODING_ERROR;
if (ret == -1)
return WLDAP32_LDAP_NO_MEMORY;
/* copy the berval so it can be properly freed by the caller */
val = HeapAlloc( GetProcessHeap(), 0, berval->bv_len );
if (!val) return WLDAP32_LDAP_NO_MEMORY;
len = berval->bv_len;
memcpy( val, berval->bv_val, len );
ber_bvfree( berval );
ctrl = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
if (!ctrl)
{
HeapFree( GetProcessHeap(), 0, val );
return WLDAP32_LDAP_NO_MEMORY;
}
ctrl->ldctl_oid = strAtoW( LDAP_PAGED_RESULT_OID_STRING );
ctrl->ldctl_value.bv_len = len;
ctrl->ldctl_value.bv_val = val;
ctrl->ldctl_iscritical = critical;
*control = ctrl;
return LDAP_SUCCESS;
}
#endif /* HAVE_LDAP */
/***********************************************************************
* ldap_create_page_controlW (WLDAP32.@)
*
* Create a control for paged search results.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* pagesize [I] Number of entries to return per page.
* cookie [I] Used by the server to track its location in the
* search results.
* critical [I] Tells the server this control is critical to the
* search operation.
* control [O] LDAPControl created.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_create_page_controlW( WLDAP32_LDAP *ld, ULONG pagesize,
struct WLDAP32_berval *cookie, UCHAR critical, PLDAPControlW *control )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p, 0x%08x, %p, 0x%02x, %p)\n", ld, pagesize, cookie,
critical, control );
if (!ld || !control || pagesize > LDAP_MAXINT)
return WLDAP32_LDAP_PARAM_ERROR;
return create_page_control( pagesize, cookie, critical, control );
#endif
return ret;
}
ULONG CDECL ldap_get_next_page( WLDAP32_LDAP *ld, PLDAPSearch search, ULONG pagesize,
ULONG *message )
{
FIXME( "(%p, %p, 0x%08x, %p)\n", ld, search, pagesize, message );
if (!ld) return ~0UL;
return LDAP_NOT_SUPPORTED;
}
ULONG CDECL ldap_get_next_page_s( WLDAP32_LDAP *ld, PLDAPSearch search,
struct l_timeval *timeout, ULONG pagesize, ULONG *count,
WLDAP32_LDAPMessage **results )
{
FIXME( "(%p, %p, %p, 0x%08x, %p, %p)\n", ld, search, timeout,
pagesize, count, results );
if (!ld) return ~0UL;
return LDAP_NOT_SUPPORTED;
}
ULONG CDECL ldap_get_paged_count( WLDAP32_LDAP *ld, PLDAPSearch search,
ULONG *count, WLDAP32_LDAPMessage *results )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
FIXME( "(%p, %p, %p, %p)\n", ld, search, count, results );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
/* FIXME: save the cookie from the server here */
#endif
return ret;
}
/***********************************************************************
* ldap_parse_page_controlA (WLDAP32.@)
*/
ULONG CDECL ldap_parse_page_controlA( WLDAP32_LDAP *ld, PLDAPControlA *ctrls,
ULONG *count, struct WLDAP32_berval **cookie )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW **ctrlsW = NULL;
TRACE( "(%p, %p, %p, %p)\n", ld, ctrls, count, cookie );
if (!ld || !ctrls || !count || !cookie)
return WLDAP32_LDAP_PARAM_ERROR;
ctrlsW = controlarrayAtoW( ctrls );
if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_parse_page_controlW( ld, ctrlsW, count, cookie );
controlarrayfreeW( ctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_page_controlW (WLDAP32.@)
*/
ULONG CDECL ldap_parse_page_controlW( WLDAP32_LDAP *ld, PLDAPControlW *ctrls,
ULONG *count, struct WLDAP32_berval **cookie )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW *control = NULL;
BerElement *ber;
ber_tag_t tag;
ULONG i;
TRACE( "(%p, %p, %p, %p)\n", ld, ctrls, count, cookie );
if (!ld || !ctrls || !count || !cookie)
return WLDAP32_LDAP_PARAM_ERROR;
for (i = 0; ctrls[i]; i++)
{
if (!lstrcmpW( LDAP_PAGED_RESULT_OID_STRING_W, ctrls[i]->ldctl_oid ))
control = ctrls[i];
}
if (!control)
return WLDAP32_LDAP_CONTROL_NOT_FOUND;
ber = ber_init( &((LDAPControl *)control)->ldctl_value );
if (!ber)
return WLDAP32_LDAP_NO_MEMORY;
tag = ber_scanf( ber, "{iO}", count, cookie );
if ( tag == LBER_ERROR )
ret = WLDAP32_LDAP_DECODING_ERROR;
else
ret = LDAP_SUCCESS;
ber_free( ber, 1 );
#endif
return ret;
}
ULONG CDECL ldap_search_abandon_page( WLDAP32_LDAP *ld, PLDAPSearch search )
{
FIXME( "(%p, %p)\n", ld, search );
if (!ld) return ~0UL;
return LDAP_SUCCESS;
}
PLDAPSearch CDECL ldap_search_init_pageA( WLDAP32_LDAP *ld, PCHAR dn, ULONG scope,
PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, ULONG timelimit, ULONG sizelimit, PLDAPSortKeyA *sortkeys )
{
FIXME( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_a(dn),
scope, debugstr_a(filter), attrs, attrsonly );
return NULL;
}
PLDAPSearch CDECL ldap_search_init_pageW( WLDAP32_LDAP *ld, PWCHAR dn, ULONG scope,
PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, PLDAPSortKeyW *sortkeys )
{
FIXME( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_w(dn),
scope, debugstr_w(filter), attrs, attrsonly );
return NULL;
}

View file

@ -0,0 +1,429 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_parse_extended_resultA (WLDAP32.@)
*
* See ldap_parse_extended_resultW.
*/
ULONG CDECL ldap_parse_extended_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
PCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *oidW = NULL;
TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = ldap_parse_extended_resultW( ld, result, &oidW, data, free );
if (oid) {
*oid = strWtoA( oidW );
if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_memfreeW( oidW );
}
#endif
return ret;
}
/***********************************************************************
* ldap_parse_extended_resultW (WLDAP32.@)
*
* Parse the result of an extended operation.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* result [I] Result message from an extended operation.
* oid [O] OID of the extended operation.
* data [O] Result data.
* free [I] Free the result message?
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Free the OID and result data with ldap_memfree. Pass a nonzero
* value for 'free' or call ldap_msgfree to free the result message.
*/
ULONG CDECL ldap_parse_extended_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
PWCHAR *oid, struct WLDAP32_berval **data, BOOLEAN free )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *oidU = NULL;
TRACE( "(%p, %p, %p, %p, 0x%02x)\n", ld, result, oid, data, free );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (!result) return WLDAP32_LDAP_NO_RESULTS_RETURNED;
ret = ldap_parse_extended_result( ld, result, &oidU, (struct berval **)data, free );
if (oid) {
*oid = strUtoW( oidU );
if (!*oid) ret = WLDAP32_LDAP_NO_MEMORY;
ldap_memfree( oidU );
}
#endif
return ret;
}
/***********************************************************************
* ldap_parse_referenceA (WLDAP32.@)
*
* See ldap_parse_referenceW.
*/
ULONG CDECL ldap_parse_referenceA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message,
PCHAR **referrals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR **referralsW = NULL;
TRACE( "(%p, %p, %p)\n", ld, message, referrals );
if (!ld) return ~0UL;
ret = ldap_parse_referenceW( ld, message, &referralsW );
*referrals = strarrayWtoA( referralsW );
ldap_value_freeW( referralsW );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_referenceW (WLDAP32.@)
*
* Return any referrals from a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* result [I] Result message.
* referrals [O] Array of referral URLs.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Free the referrals with ldap_value_free.
*/
ULONG CDECL ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message,
PWCHAR **referrals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP_PARSE_REFERENCE
char **referralsU = NULL;
TRACE( "(%p, %p, %p)\n", ld, message, referrals );
if (!ld) return ~0UL;
ret = ldap_parse_reference( ld, message, &referralsU, NULL, 0 );
*referrals = strarrayUtoW( referralsU );
ldap_memfree( referralsU );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_resultA (WLDAP32.@)
*
* See ldap_parse_resultW.
*/
ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
ULONG *retcode, PCHAR *matched, PCHAR *error, PCHAR **referrals,
PLDAPControlA **serverctrls, BOOLEAN free )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR **matchedW = NULL, **errorW = NULL, **referralsW = NULL;
LDAPControlW **serverctrlsW = NULL;
TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
matched, error, referrals, serverctrls, free );
if (!ld) return ~0UL;
ret = ldap_parse_resultW( ld, result, retcode, matchedW, errorW,
&referralsW, &serverctrlsW, free );
matched = strarrayWtoA( matchedW );
error = strarrayWtoA( errorW );
*referrals = strarrayWtoA( referralsW );
*serverctrls = controlarrayWtoA( serverctrlsW );
ldap_value_freeW( matchedW );
ldap_value_freeW( errorW );
ldap_value_freeW( referralsW );
ldap_controls_freeW( serverctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_resultW (WLDAP32.@)
*
* Parse a result message.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* result [I] Result message.
* retcode [O] Return code for the server operation.
* matched [O] DNs matched in the operation.
* error [O] Error message for the operation.
* referrals [O] Referrals found in the result message.
* serverctrls [O] Controls used in the operation.
* free [I] Free the result message?
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Free the DNs and error message with ldap_memfree. Free
* the referrals with ldap_value_free and the controls with
* ldap_controls_free. Pass a nonzero value for 'free' or call
* ldap_msgfree to free the result message.
*/
ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
ULONG *retcode, PWCHAR *matched, PWCHAR *error, PWCHAR **referrals,
PLDAPControlW **serverctrls, BOOLEAN free )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char **matchedU = NULL, **errorU = NULL, **referralsU = NULL;
LDAPControl **serverctrlsU = NULL;
TRACE( "(%p, %p, %p, %p, %p, %p, %p, 0x%02x)\n", ld, result, retcode,
matched, error, referrals, serverctrls, free );
if (!ld) return ~0UL;
ret = ldap_parse_result( ld, result, (int *)retcode, matchedU, errorU,
&referralsU, &serverctrlsU, free );
matched = strarrayUtoW( matchedU );
error = strarrayUtoW( errorU );
*referrals = strarrayUtoW( referralsU );
*serverctrls = controlarrayUtoW( serverctrlsU );
ldap_memfree( matchedU );
ldap_memfree( errorU );
ldap_memfree( referralsU );
ldap_controls_free( serverctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_sort_controlA (WLDAP32.@)
*
* See ldap_parse_sort_controlW.
*/
ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
ULONG *result, PCHAR *attr )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *attrW = NULL;
LDAPControlW **controlW = NULL;
TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
if (!ld) return ~0UL;
if (control) {
controlW = controlarrayAtoW( control );
if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_parse_sort_controlW( ld, controlW, result, &attrW );
*attr = strWtoA( attrW );
controlarrayfreeW( controlW );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_sort_controlW (WLDAP32.@)
*
* Parse a sort control.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* control [I] Control obtained from a result message.
* result [O] Result code.
* attr [O] Failing attribute.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* If the function fails, free the failing attribute with ldap_memfree.
*/
ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
ULONG *result, PWCHAR *attr )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *attrU = NULL;
LDAPControl **controlU = NULL;
unsigned long res;
TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
if (!ld) return ~0UL;
if (control) {
controlU = controlarrayWtoU( control );
if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_parse_sort_control( ld, controlU, &res, &attrU );
*result = res;
*attr = strUtoW( attrU );
controlarrayfreeU( controlU );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_vlv_controlA (WLDAP32.@)
*
* See ldap_parse_vlv_controlW.
*/
INT CDECL ldap_parse_vlv_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
PULONG targetpos, PULONG listcount,
struct WLDAP32_berval **context, PINT errcode )
{
int ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControlW **controlW = NULL;
TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
listcount, context, errcode );
if (!ld) return ~0UL;
if (control) {
controlW = controlarrayAtoW( control );
if (!controlW) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_parse_vlv_controlW( ld, controlW, targetpos, listcount,
context, errcode );
controlarrayfreeW( controlW );
#endif
return ret;
}
/***********************************************************************
* ldap_parse_vlv_controlW (WLDAP32.@)
*
* Parse a virtual list view control.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* control [I] Controls obtained from a result message.
* targetpos [O] Positition of the target in the result list.
* listcount [O] Estimate of the number of results in the list.
* context [O] Server side context.
* errcode [O] Error code from the listview operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Free the server context with ber_bvfree.
*/
INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
PULONG targetpos, PULONG listcount,
struct WLDAP32_berval **context, PINT errcode )
{
int ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControl **controlU = NULL;
unsigned long pos, count;
TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
listcount, context, errcode );
if (!ld) return ~0UL;
if (control) {
controlU = controlarrayWtoU( control );
if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
}
ret = ldap_parse_vlv_control( ld, controlU, &pos, &count,
(struct berval **)context, errcode );
*targetpos = pos;
*listcount = count;
controlarrayfreeU( controlU );
#endif
return ret;
}

View file

@ -0,0 +1,300 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_rename_extA (WLDAP32.@)
*
* See ldap_rename_extW.
*/
ULONG CDECL ldap_rename_extA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(newrdn), debugstr_a(newparent), delete,
serverctrls, clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (newrdn) {
newrdnW = strAtoW( newrdn );
if (!newrdnW) goto exit;
}
if (newparent) {
newparentW = strAtoW( newparent );
if (!newparentW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete,
serverctrlsW, clientctrlsW, message );
exit:
strfreeW( dnW );
strfreeW( newrdnW );
strfreeW( newparentW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_rename_extW (WLDAP32.@)
*
* Change the DN of a directory entry (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newrdn [I] New RDN for the entry.
* newparent [I] New parent for the entry.
* delete [I] Delete old RDN?
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* message [O] Message ID of the operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(newrdn), debugstr_w(newparent), delete,
serverctrls, clientctrls, message );
if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (newrdn) {
newrdnU = strWtoU( newrdn );
if (!newrdnU) goto exit;
}
if (newparent) {
newparentU = strWtoU( newparent );
if (!newparentU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU, (int *)message );
exit:
strfreeU( dnU );
strfreeU( newrdnU );
strfreeU( newparentU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_rename_ext_sA (WLDAP32.@)
*
* See ldap_rename_ext_sW.
*/
ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn),
debugstr_a(newrdn), debugstr_a(newparent), delete,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnW = strAtoW( dn );
if (!dnW) goto exit;
}
if (newrdn) {
newrdnW = strAtoW( newrdn );
if (!newrdnW) goto exit;
}
if (newparent) {
newparentW = strAtoW( newparent );
if (!newparentW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete,
serverctrlsW, clientctrlsW );
exit:
strfreeW( dnW );
strfreeW( newrdnW );
strfreeW( newparentW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_rename_ext_sW (WLDAP32.@)
*
* Change the DN of a directory entry (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* dn [I] DN of the entry to change.
* newrdn [I] New RDN for the entry.
* newparent [I] New parent for the entry.
* delete [I] Delete old RDN?
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn),
debugstr_w(newrdn), debugstr_w(newparent), delete,
serverctrls, clientctrls );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (dn) {
dnU = strWtoU( dn );
if (!dnU) goto exit;
}
if (newrdn) {
newrdnU = strWtoU( newrdn );
if (!newrdnU) goto exit;
}
if (newparent) {
newparentU = strWtoU( newparent );
if (!newparentU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
delete, serverctrlsU, clientctrlsU );
exit:
strfreeU( dnU );
strfreeU( newrdnU );
strfreeU( newparentU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}

View file

@ -0,0 +1,644 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#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);
/***********************************************************************
* ldap_searchA (WLDAP32.@)
*
* See ldap_searchW.
*/
ULONG CDECL ldap_searchA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
PCHAR attrs[], ULONG attrsonly )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_a(base),
scope, debugstr_a(filter), attrs, attrsonly );
if (!ld) return ~0UL;
if (base) {
baseW = strAtoW( base );
if (!baseW) goto exit;
}
if (filter) {
filterW = strAtoW( filter );
if (!filterW) goto exit;
}
if (attrs) {
attrsW = strarrayAtoW( attrs );
if (!attrsW) goto exit;
}
ret = ldap_searchW( ld, baseW, scope, filterW, attrsW, attrsonly );
exit:
strfreeW( baseW );
strfreeW( filterW );
strarrayfreeW( attrsW );
#endif
return ret;
}
/***********************************************************************
* ldap_searchW (WLDAP32.@)
*
* Search a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* base [I] Starting point for the search.
* scope [I] Search scope. One of LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
* filter [I] Search filter.
* attrs [I] Attributes to return.
* attrsonly [I] Return no values, only attributes.
*
* RETURNS
* Success: Message ID of the search operation.
* Failure: ~0UL
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
PWCHAR attrs[], ULONG attrsonly )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
int msg;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_w(base),
scope, debugstr_w(filter), attrs, attrsonly );
if (!ld) return ~0UL;
if (base) {
baseU = strWtoU( base );
if (!baseU) goto exit;
}
if (filter) {
filterU = strWtoU( filter );
if (!filterU) goto exit;
}
if (attrs) {
attrsU = strarrayWtoU( attrs );
if (!attrsU) goto exit;
}
ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, &msg );
if (ret == LDAP_SUCCESS)
ret = msg;
else
ret = ~0UL;
exit:
strfreeU( baseU );
strfreeU( filterU );
strarrayfreeU( attrsU );
#endif
return ret;
}
/***********************************************************************
* ldap_search_extA (WLDAP32.@)
*
* See ldap_search_extW.
*/
ULONG CDECL ldap_search_extA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
serverctrls, clientctrls, timelimit, sizelimit, message );
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseW = strAtoW( base );
if (!baseW) goto exit;
}
if (filter)
{
filterW = strAtoW( filter );
if (!filterW) goto exit;
}
if (attrs) {
attrsW = strarrayAtoW( attrs );
if (!attrsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_search_extW( ld, baseW, scope, filterW, attrsW, attrsonly,
serverctrlsW, clientctrlsW, timelimit, sizelimit, message );
exit:
strfreeW( baseW );
strfreeW( filterW );
strarrayfreeW( attrsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_search_extW (WLDAP32.@)
*
* Search a directory tree (asynchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* base [I] Starting point for the search.
* scope [I] Search scope. One of LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
* filter [I] Search filter.
* attrs [I] Attributes to return.
* attrsonly [I] Return no values, only attributes.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* timelimit [I] Timeout in seconds.
* sizelimit [I] Maximum number of entries to return. Zero means unlimited.
* message [O] Message ID of the search operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_result with the message ID to get the result of
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
struct timeval tv;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
serverctrls, clientctrls, timelimit, sizelimit, message );
if (!ld) return ~0UL;
if (base) {
baseU = strWtoU( base );
if (!baseU) goto exit;
}
if (filter) {
filterU = strWtoU( filter );
if (!filterU) goto exit;
}
if (attrs) {
attrsU = strarrayWtoU( attrs );
if (!attrsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
tv.tv_sec = timelimit;
tv.tv_usec = 0;
ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message );
exit:
strfreeU( baseU );
strfreeU( filterU );
strarrayfreeU( attrsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_search_ext_sA (WLDAP32.@)
*
* See ldap_search_ext_sW.
*/
ULONG CDECL ldap_search_ext_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
PLDAPControlA *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
serverctrls, clientctrls, timeout, sizelimit, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseW = strAtoW( base );
if (!baseW) goto exit;
}
if (filter) {
filterW = strAtoW( filter );
if (!filterW) goto exit;
}
if (attrs) {
attrsW = strarrayAtoW( attrs );
if (!attrsW) goto exit;
}
if (serverctrls) {
serverctrlsW = controlarrayAtoW( serverctrls );
if (!serverctrlsW) goto exit;
}
if (clientctrls) {
clientctrlsW = controlarrayAtoW( clientctrls );
if (!clientctrlsW) goto exit;
}
ret = ldap_search_ext_sW( ld, baseW, scope, filterW, attrsW, attrsonly,
serverctrlsW, clientctrlsW, timeout, sizelimit, res );
exit:
strfreeW( baseW );
strfreeW( filterW );
strarrayfreeW( attrsW );
controlarrayfreeW( serverctrlsW );
controlarrayfreeW( clientctrlsW );
#endif
return ret;
}
/***********************************************************************
* ldap_search_ext_sW (WLDAP32.@)
*
* Search a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* base [I] Starting point for the search.
* scope [I] Search scope. One of LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
* filter [I] Search filter.
* attrs [I] Attributes to return.
* attrsonly [I] Return no values, only attributes.
* serverctrls [I] Array of LDAP server controls.
* clientctrls [I] Array of LDAP client controls.
* timeout [I] Timeout in seconds.
* sizelimit [I] Maximum number of entries to return. Zero means unlimited.
* res [O] Results of the search operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_msgfree to free the results.
*/
ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
PLDAPControlW *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
serverctrls, clientctrls, timeout, sizelimit, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseU = strWtoU( base );
if (!baseU) goto exit;
}
if (filter) {
filterU = strWtoU( filter );
if (!filterU) goto exit;
}
if (attrs) {
attrsU = strarrayWtoU( attrs );
if (!attrsU) goto exit;
}
if (serverctrls) {
serverctrlsU = controlarrayWtoU( serverctrls );
if (!serverctrlsU) goto exit;
}
if (clientctrls) {
clientctrlsU = controlarrayWtoU( clientctrls );
if (!clientctrlsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
serverctrlsU, clientctrlsU, (struct timeval *)timeout, sizelimit, res );
exit:
strfreeU( baseU );
strfreeU( filterU );
strarrayfreeU( attrsU );
controlarrayfreeU( serverctrlsU );
controlarrayfreeU( clientctrlsU );
#endif
return ret;
}
/***********************************************************************
* ldap_search_sA (WLDAP32.@)
*
* See ldap_search_sW.
*/
ULONG CDECL ldap_search_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
PCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_a(base),
scope, debugstr_a(filter), attrs, attrsonly, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseW = strAtoW( base );
if (!baseW) goto exit;
}
if (filter) {
filterW = strAtoW( filter );
if (!filterW) goto exit;
}
if (attrs) {
attrsW = strarrayAtoW( attrs );
if (!attrsW) goto exit;
}
ret = ldap_search_sW( ld, baseW, scope, filterW, attrsW, attrsonly, res );
exit:
strfreeW( baseW );
strfreeW( filterW );
strarrayfreeW( attrsW );
#endif
return ret;
}
/***********************************************************************
* ldap_search_sW (WLDAP32.@)
*
* Search a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* base [I] Starting point for the search.
* scope [I] Search scope. One of LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
* filter [I] Search filter.
* attrs [I] Attributes to return.
* attrsonly [I] Return no values, only attributes.
* res [O] Results of the search operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_msgfree to free the results.
*/
ULONG CDECL ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
PWCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_w(base),
scope, debugstr_w(filter), attrs, attrsonly, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseU = strWtoU( base );
if (!baseU) goto exit;
}
if (filter) {
filterU = strWtoU( filter );
if (!filterU) goto exit;
}
if (attrs) {
attrsU = strarrayWtoU( attrs );
if (!attrsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, NULL, 0, res );
exit:
strfreeU( baseU );
strfreeU( filterU );
strarrayfreeU( attrsU );
#endif
return ret;
}
/***********************************************************************
* ldap_search_stA (WLDAP32.@)
*
* See ldap_search_stW.
*/
ULONG CDECL ldap_search_stA( WLDAP32_LDAP *ld, const PCHAR base, ULONG scope,
const PCHAR filter, PCHAR attrs[], ULONG attrsonly,
struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
debugstr_a(base), scope, debugstr_a(filter), attrs,
attrsonly, timeout, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseW = strAtoW( base );
if (!baseW) goto exit;
}
if (filter) {
filterW = strAtoW( filter );
if (!filterW) goto exit;
}
if (attrs) {
attrsW = strarrayAtoW( attrs );
if (!attrsW) goto exit;
}
ret = ldap_search_stW( ld, baseW, scope, filterW, attrsW, attrsonly,
timeout, res );
exit:
strfreeW( baseW );
strfreeW( filterW );
strarrayfreeW( attrsW );
#endif
return ret;
}
/***********************************************************************
* ldap_search_stW (WLDAP32.@)
*
* Search a directory tree (synchronous operation).
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* base [I] Starting point for the search.
* scope [I] Search scope. One of LDAP_SCOPE_BASE,
* LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
* filter [I] Search filter.
* attrs [I] Attributes to return.
* attrsonly [I] Return no values, only attributes.
* timeout [I] Timeout in seconds.
* res [O] Results of the search operation.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*
* NOTES
* Call ldap_msgfree to free the results.
*/
ULONG CDECL ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
const PWCHAR filter, PWCHAR attrs[], ULONG attrsonly,
struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
ret = WLDAP32_LDAP_NO_MEMORY;
TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
debugstr_w(base), scope, debugstr_w(filter), attrs,
attrsonly, timeout, res );
if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
if (base) {
baseU = strWtoU( base );
if (!baseU) goto exit;
}
if (filter) {
filterU = strWtoU( filter );
if (!filterU) goto exit;
}
if (attrs) {
attrsU = strarrayWtoU( attrs );
if (!attrsU) goto exit;
}
ret = ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
NULL, NULL, (struct timeval *)timeout, 0, res );
exit:
strfreeU( baseU );
strfreeU( filterU );
strarrayfreeU( attrsU );
#endif
return ret;
}

View file

@ -0,0 +1,377 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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_H
#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);
/***********************************************************************
* ldap_count_values_len (WLDAP32.@)
*
* Count the number of values in an array of berval structures.
*
* PARAMS
* vals [I] Pointer to an array of berval structures.
*
* RETURNS
* Success: The number of values counted.
* Failure: 0
*
* NOTES
* Call ldap_count_values_len with the result of a call to
* ldap_get_values_len.
*/
ULONG CDECL WLDAP32_ldap_count_values_len( struct WLDAP32_berval **vals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
TRACE( "(%p)\n", vals );
ret = ldap_count_values_len( (struct berval **)vals );
#endif
return ret;
}
/***********************************************************************
* ldap_count_valuesA (WLDAP32.@)
*
* See ldap_count_valuesW.
*/
ULONG CDECL ldap_count_valuesA( PCHAR *vals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR **valsW = NULL;
TRACE( "(%p)\n", vals );
if (!vals) return 0;
valsW = strarrayAtoW( vals );
if (!valsW) return WLDAP32_LDAP_NO_MEMORY;
ret = ldap_count_valuesW( valsW );
strarrayfreeW( valsW );
#endif
return ret;
}
/***********************************************************************
* ldap_count_valuesW (WLDAP32.@)
*
* Count the number of values in a string array.
*
* PARAMS
* vals [I] Pointer to an array of strings.
*
* RETURNS
* Success: The number of values counted.
* Failure: 0
*
* NOTES
* Call ldap_count_valuesW with the result of a call to
* ldap_get_valuesW.
*/
ULONG CDECL ldap_count_valuesW( PWCHAR *vals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
WCHAR **p = vals;
TRACE( "(%p)\n", vals );
if (!vals) return 0;
ret = 0;
while (*p++) ret++;
#endif
return ret;
}
/***********************************************************************
* ldap_get_valuesA (WLDAP32.@)
*
* See ldap_get_valuesW.
*/
PCHAR * CDECL ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PCHAR attr )
{
PCHAR *ret = NULL;
#ifdef HAVE_LDAP
WCHAR *attrW = NULL, **retW;
TRACE( "(%p, %p, %s)\n", ld, entry, debugstr_a(attr) );
if (!ld || !entry || !attr) return NULL;
attrW = strAtoW( attr );
if (!attrW) return NULL;
retW = ldap_get_valuesW( ld, entry, attrW );
ret = strarrayWtoA( retW );
ldap_value_freeW( retW );
strfreeW( attrW );
#endif
return ret;
}
#ifdef HAVE_LDAP
static char *bv2str( struct berval *bv )
{
char *str = NULL;
unsigned int len = bv->bv_len;
str = HeapAlloc( GetProcessHeap(), 0, len + 1 );
if (str)
{
memcpy( str, bv->bv_val, len );
str[len] = '\0';
}
return str;
}
static char **bv2str_array( struct berval **bv )
{
unsigned int len = 0, i = 0;
struct berval **p = bv;
char **str;
while (*p)
{
len++;
p++;
}
str = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(char *) );
if (!str) return NULL;
p = bv;
while (*p)
{
str[i] = bv2str( *p );
if (!str[i])
{
for (--i; i >= 0; i--)
HeapFree( GetProcessHeap(), 0, str[i] );
HeapFree( GetProcessHeap(), 0, str );
return NULL;
}
i++;
p++;
}
str[i] = NULL;
return str;
}
#endif
/***********************************************************************
* ldap_get_valuesW (WLDAP32.@)
*
* Retrieve string values for a given attribute.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* entry [I] Entry to retrieve values from.
* attr [I] Attribute to retrieve values for.
*
* RETURNS
* Success: Pointer to a character array holding the values.
* Failure: NULL
*
* NOTES
* Call ldap_get_valuesW with the result of a call to
* ldap_first_entry or ldap_next_entry. Free the returned
* array with a call to ldap_value_freeW.
*/
PWCHAR * CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PWCHAR attr )
{
PWCHAR *ret = NULL;
#ifdef HAVE_LDAP
char *attrU = NULL, **retU;
struct berval **bv;
TRACE( "(%p, %p, %s)\n", ld, entry, debugstr_w(attr) );
if (!ld || !entry || !attr) return NULL;
attrU = strWtoU( attr );
if (!attrU) return NULL;
bv = ldap_get_values_len( ld, entry, attrU );
retU = bv2str_array( bv );
ret = strarrayUtoW( retU );
ldap_value_free_len( bv );
strarrayfreeU( retU );
strfreeU( attrU );
#endif
return ret;
}
/***********************************************************************
* ldap_get_values_lenA (WLDAP32.@)
*
* See ldap_get_values_lenW.
*/
struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld,
WLDAP32_LDAPMessage *message, PCHAR attr )
{
#ifdef HAVE_LDAP
WCHAR *attrW = NULL;
struct WLDAP32_berval **ret;
TRACE( "(%p, %p, %s)\n", ld, message, debugstr_a(attr) );
if (!ld || !message || !attr) return NULL;
attrW = strAtoW( attr );
if (!attrW) return NULL;
ret = ldap_get_values_lenW( ld, message, attrW );
strfreeW( attrW );
return ret;
#endif
return NULL;
}
/***********************************************************************
* ldap_get_values_lenW (WLDAP32.@)
*
* Retrieve binary values for a given attribute.
*
* PARAMS
* ld [I] Pointer to an LDAP context.
* message [I] Entry to retrieve values from.
* attr [I] Attribute to retrieve values for.
*
* RETURNS
* Success: Pointer to a berval array holding the values.
* Failure: NULL
*
* NOTES
* Call ldap_get_values_lenW with the result of a call to
* ldap_first_entry or ldap_next_entry. Free the returned
* array with a call to ldap_value_free_len.
*/
struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld,
WLDAP32_LDAPMessage *message, PWCHAR attr )
{
#ifdef HAVE_LDAP
char *attrU = NULL;
struct berval **ret;
TRACE( "(%p, %p, %s)\n", ld, message, debugstr_w(attr) );
if (!ld || !message || !attr) return NULL;
attrU = strWtoU( attr );
if (!attrU) return NULL;
ret = ldap_get_values_len( ld, message, attrU );
strfreeU( attrU );
return (struct WLDAP32_berval **)ret;
#endif
return NULL;
}
/***********************************************************************
* ldap_value_free_len (WLDAP32.@)
*
* Free an array of berval structures.
*
* PARAMS
* vals [I] Array of berval structures.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL WLDAP32_ldap_value_free_len( struct WLDAP32_berval **vals )
{
#ifdef HAVE_LDAP
TRACE( "(%p)\n", vals );
ldap_value_free_len( (struct berval **)vals );
#endif
return LDAP_SUCCESS;
}
/***********************************************************************
* ldap_value_freeA (WLDAP32.@)
*
* See ldap_value_freeW.
*/
ULONG CDECL ldap_value_freeA( PCHAR *vals )
{
TRACE( "(%p)\n", vals );
strarrayfreeA( vals );
return LDAP_SUCCESS;
}
/***********************************************************************
* ldap_value_freeW (WLDAP32.@)
*
* Free an array of string values.
*
* PARAMS
* vals [I] Array of string values.
*
* RETURNS
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG CDECL ldap_value_freeW( PWCHAR *vals )
{
TRACE( "(%p)\n", vals );
strarrayfreeW( vals );
return LDAP_SUCCESS;
}

View file

@ -0,0 +1,448 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* This is an internal version of winldap.h where constants, types and
* functions are prefixed with WLDAP32_ whenever they conflict with
* native headers.
*/
typedef enum {
WLDAP32_LDAP_SERVER_DOWN = 0x51,
WLDAP32_LDAP_LOCAL_ERROR = 0x52,
WLDAP32_LDAP_ENCODING_ERROR = 0x53,
WLDAP32_LDAP_DECODING_ERROR = 0x54,
WLDAP32_LDAP_TIMEOUT = 0x55,
WLDAP32_LDAP_AUTH_UNKNOWN = 0x56,
WLDAP32_LDAP_FILTER_ERROR = 0x57,
WLDAP32_LDAP_USER_CANCELLED = 0x58,
WLDAP32_LDAP_PARAM_ERROR = 0x59,
WLDAP32_LDAP_NO_MEMORY = 0x5a,
WLDAP32_LDAP_CONNECT_ERROR = 0x5b,
WLDAP32_LDAP_NOT_SUPPORTED = 0x5c,
WLDAP32_LDAP_NO_RESULTS_RETURNED = 0x5e,
WLDAP32_LDAP_CONTROL_NOT_FOUND = 0x5d,
WLDAP32_LDAP_MORE_RESULTS_TO_RETURN = 0x5f,
WLDAP32_LDAP_CLIENT_LOOP = 0x60,
WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED = 0x61
} LDAP_RETCODE;
typedef struct berelement
{
PCHAR opaque;
} WLDAP32_BerElement;
#define WLDAP32_LDAP_OPT_API_INFO 0x00
#define WLDAP32_LDAP_OPT_DESC 0x01
#define WLDAP32_LDAP_OPT_DEREF 0x02
#define WLDAP32_LDAP_OPT_SIZELIMIT 0x03
#define WLDAP32_LDAP_OPT_TIMELIMIT 0x04
#define WLDAP32_LDAP_OPT_THREAD_FN_PTRS 0x05
#define WLDAP32_LDAP_OPT_REBIND_FN 0x06
#define WLDAP32_LDAP_OPT_REBIND_ARG 0x07
#define WLDAP32_LDAP_OPT_REFERRALS 0x08
#define WLDAP32_LDAP_OPT_RESTART 0x09
#define WLDAP32_LDAP_OPT_SSL 0x0a
#define WLDAP32_LDAP_OPT_IO_FN_PTRS 0x0b
#define WLDAP32_LDAP_OPT_CACHE_FN_PTRS 0x0d
#define WLDAP32_LDAP_OPT_CACHE_STRATEGY 0x0e
#define WLDAP32_LDAP_OPT_CACHE_ENABLE 0x0f
#define WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT 0x10
#define WLDAP32_LDAP_OPT_VERSION 0x11
#define WLDAP32_LDAP_OPT_PROTOCOL_VERSION WLDAP32_LDAP_OPT_VERSION
#define WLDAP32_LDAP_OPT_SERVER_CONTROLS 0x12
#define WLDAP32_LDAP_OPT_API_FEATURE_INFO 0x15
#define WLDAP32_LDAP_OPT_HOST_NAME 0x30
#define WLDAP32_LDAP_OPT_ERROR_NUMBER 0x31
#define WLDAP32_LDAP_OPT_ERROR_STRING 0x32
#define WLDAP32_LDAP_OPT_SERVER_ERROR 0x33
#define WLDAP32_LDAP_OPT_SERVER_EXT_ERROR 0x34
#define WLDAP32_LDAP_OPT_PING_KEEP_ALIVE 0x36
#define WLDAP32_LDAP_OPT_PING_WAIT_TIME 0x37
#define WLDAP32_LDAP_OPT_PING_LIMIT 0x38
#define WLDAP32_LDAP_OPT_DNSDOMAIN_NAME 0x3b
#define WLDAP32_LDAP_OPT_GETDSNAME_FLAGS 0x3d
#define WLDAP32_LDAP_OPT_HOST_REACHABLE 0x3e
#define WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS 0x3f
#define WLDAP32_LDAP_OPT_TCP_KEEPALIVE 0x40
#define WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND 0x41
#define WLDAP32_LDAP_OPT_SEND_TIMEOUT 0x42
#define WLDAP32_LDAP_OPT_REFERRAL_CALLBACK 0x70
#define WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE 0x80
#define WLDAP32_LDAP_OPT_SERVER_CERTIFICATE 0x81
#define WLDAP32_LDAP_OPT_AUTO_RECONNECT 0x91
#define WLDAP32_LDAP_OPT_SSPI_FLAGS 0x92
#define WLDAP32_LDAP_OPT_SSL_INFO 0x93
#define WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG 0x94
#define WLDAP32_LDAP_OPT_TLS WLDAP32_LDAP_OPT_SSL
#define WLDAP32_LDAP_OPT_TLS_INFO WLDAP32_LDAP_OPT_SSL_INFO
#define WLDAP32_LDAP_OPT_SIGN 0x95
#define WLDAP32_LDAP_OPT_ENCRYPT 0x96
#define WLDAP32_LDAP_OPT_SASL_METHOD 0x97
#define WLDAP32_LDAP_OPT_AREC_EXCLUSIVE 0x98
#define WLDAP32_LDAP_OPT_SECURITY_CONTEXT 0x99
#define WLDAP32_LDAP_OPT_ROOTDSE_CACHE 0x9a
typedef struct ldap
{
struct
{
UINT_PTR sb_sd;
UCHAR Reserved1[41];
ULONG_PTR sb_naddr;
UCHAR Reserved2[24];
} ld_sb;
PCHAR ld_host;
ULONG ld_version;
UCHAR ld_lberoptions;
ULONG ld_deref;
ULONG ld_timelimit;
ULONG ld_sizelimit;
ULONG ld_errno;
PCHAR ld_matched;
PCHAR ld_error;
ULONG ld_msgid;
UCHAR Reserved3[25];
ULONG ld_cldaptries;
ULONG ld_cldaptimeout;
ULONG ld_refhoplimit;
ULONG ld_options;
} WLDAP32_LDAP, *WLDAP32_PLDAP;
typedef struct ldapmodA {
ULONG mod_op;
PCHAR mod_type;
union {
PCHAR *modv_strvals;
struct berval **modv_bvals;
} mod_vals;
} LDAPModA, *PLDAPModA;
typedef struct ldapmodW {
ULONG mod_op;
PWCHAR mod_type;
union {
PWCHAR *modv_strvals;
struct berval **modv_bvals;
} mod_vals;
} LDAPModW, *PLDAPModW;
typedef struct l_timeval
{
LONG tv_sec;
LONG tv_usec;
} LDAP_TIMEVAL, *PLDAP_TIMEVAL;
typedef struct ldapmsg
{
ULONG lm_msgid;
ULONG lm_msgtype;
PVOID lm_ber;
struct ldapmsg *lm_chain;
struct ldapmsg *lm_next;
ULONG lm_time;
WLDAP32_PLDAP Connection;
PVOID Request;
ULONG lm_returncode;
USHORT lm_referral;
BOOLEAN lm_chased;
BOOLEAN lm_eom;
BOOLEAN ConnectionReferenced;
} WLDAP32_LDAPMessage, *WLDAP32_PLDAPMessage;
#define LAPI_MAJOR_VER1 1
#define LAPI_MINOR_VER1 1
typedef struct ldap_version_info
{
ULONG lv_size;
ULONG lv_major;
ULONG lv_minor;
} LDAP_VERSION_INFO, *PLDAP_VERSION_INFO;
typedef struct WLDAP32_berval
{
ULONG bv_len;
PCHAR bv_val;
} LDAP_BERVAL, *PLDAP_BERVAL, BERVAL, *PBERVAL, WLDAP32_BerValue;
#define LDAP_PAGED_RESULT_OID_STRING "1.2.840.113556.1.4.319"
#define LDAP_PAGED_RESULT_OID_STRING_W (const WCHAR []){'1','.','2','.', \
'8','4','0','.','1','1','3','5','5','6','.','1','.','4','.','3','1','9',0}
typedef struct ldapcontrolA
{
PCHAR ldctl_oid;
struct WLDAP32_berval ldctl_value;
BOOLEAN ldctl_iscritical;
} LDAPControlA, *PLDAPControlA;
typedef struct ldapcontrolW
{
PWCHAR ldctl_oid;
struct WLDAP32_berval ldctl_value;
BOOLEAN ldctl_iscritical;
} LDAPControlW, *PLDAPControlW;
typedef struct WLDAP32_ldapvlvinfo
{
int ldvlv_version;
ULONG ldvlv_before_count;
ULONG ldvlv_after_count;
ULONG ldvlv_offset;
ULONG ldvlv_count;
PBERVAL ldvlv_attrvalue;
PBERVAL ldvlv_context;
VOID *ldvlv_extradata;
} WLDAP32_LDAPVLVInfo, *WLDAP32_PLDAPVLVInfo;
typedef struct ldapsearch LDAPSearch, *PLDAPSearch;
typedef struct ldapsortkeyA
{
PCHAR sk_attrtype;
PCHAR sk_matchruleoid;
BOOLEAN sk_reverseorder;
} LDAPSortKeyA, *PLDAPSortKeyA;
typedef struct ldapsortkeyW
{
PWCHAR sk_attrtype;
PWCHAR sk_matchruleoid;
BOOLEAN sk_reverseorder;
} LDAPSortKeyW, *PLDAPSortKeyW;
typedef struct ldapapiinfoA
{
int ldapai_info_version;
int ldapai_api_version;
int ldapai_protocol_version;
char **ldapai_extensions;
char *ldapai_vendor_name;
int ldapai_vendor_version;
} LDAPAPIInfoA;
typedef struct ldapapiinfoW
{
int ldapai_info_version;
int ldapai_api_version;
int ldapai_protocol_version;
PWCHAR *ldapai_extensions;
PWCHAR ldapai_vendor_name;
int ldapai_vendor_version;
} LDAPAPIInfoW;
typedef struct ldap_apifeature_infoA
{
int ldapaif_info_version;
char *ldapaif_name;
int ldapaif_version;
} LDAPAPIFeatureInfoA;
typedef struct ldap_apifeature_infoW
{
int ldapaif_info_version;
PWCHAR ldapaif_name;
int ldapaif_version;
} LDAPAPIFeatureInfoW;
WLDAP32_LDAP *cldap_openA(PCHAR,ULONG);
WLDAP32_LDAP *cldap_openW(PWCHAR,ULONG);
ULONG WLDAP32_ldap_abandon(WLDAP32_LDAP*,ULONG);
ULONG ldap_addA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
ULONG ldap_addW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
ULONG ldap_add_extA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_add_extW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_add_ext_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*);
ULONG ldap_add_ext_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*);
ULONG ldap_add_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
ULONG ldap_add_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
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);
ULONG ldap_check_filterA(WLDAP32_LDAP*,PCHAR);
ULONG ldap_check_filterW(WLDAP32_LDAP*,PWCHAR);
ULONG ldap_cleanup(HANDLE);
ULONG ldap_close_extended_op(WLDAP32_LDAP*,ULONG);
ULONG ldap_compareA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR);
ULONG ldap_compareW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR);
ULONG ldap_compare_extA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_compare_extW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_compare_ext_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*);
ULONG ldap_compare_ext_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*);
ULONG ldap_compare_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR);
ULONG ldap_compare_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR);
ULONG ldap_connect(WLDAP32_LDAP*,LDAP_TIMEVAL*);
WLDAP32_LDAP *ldap_conn_from_msg(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG ldap_control_freeA(LDAPControlA*);
ULONG ldap_control_freeW(LDAPControlW*);
ULONG ldap_controls_freeA(LDAPControlA**);
ULONG ldap_controls_freeW(LDAPControlW**);
ULONG WLDAP32_ldap_count_entries(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG WLDAP32_ldap_count_references(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG ldap_count_valuesA(PCHAR*);
ULONG ldap_count_valuesW(PWCHAR*);
ULONG WLDAP32_ldap_count_values_len(PBERVAL*);
ULONG ldap_create_page_controlA(WLDAP32_PLDAP,ULONG,struct WLDAP32_berval*,UCHAR,PLDAPControlA*);
ULONG ldap_create_page_controlW(WLDAP32_PLDAP,ULONG,struct WLDAP32_berval*,UCHAR,PLDAPControlW*);
ULONG ldap_create_sort_controlA(WLDAP32_PLDAP,PLDAPSortKeyA*,UCHAR,PLDAPControlA*);
ULONG ldap_create_sort_controlW(WLDAP32_PLDAP,PLDAPSortKeyW*,UCHAR,PLDAPControlW*);
INT ldap_create_vlv_controlA(WLDAP32_LDAP*,WLDAP32_LDAPVLVInfo*,UCHAR,LDAPControlA**);
INT ldap_create_vlv_controlW(WLDAP32_LDAP*,WLDAP32_LDAPVLVInfo*,UCHAR,LDAPControlW**);
ULONG ldap_deleteA(WLDAP32_LDAP*,PCHAR);
ULONG ldap_deleteW(WLDAP32_LDAP*,PWCHAR);
ULONG ldap_delete_extA(WLDAP32_LDAP*,PCHAR,PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_delete_extW(WLDAP32_LDAP*,PWCHAR,PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_delete_ext_sA(WLDAP32_LDAP*,PCHAR,PLDAPControlA*,PLDAPControlA*);
ULONG ldap_delete_ext_sW(WLDAP32_LDAP*,PWCHAR,PLDAPControlW*,PLDAPControlW*);
ULONG ldap_delete_sA(WLDAP32_LDAP*,PCHAR);
ULONG ldap_delete_sW(WLDAP32_LDAP*,PWCHAR);
PCHAR ldap_dn2ufnA(PCHAR);
PWCHAR ldap_dn2ufnW(PWCHAR);
ULONG ldap_encode_sort_controlA(WLDAP32_PLDAP,PLDAPSortKeyA*,PLDAPControlA,BOOLEAN);
ULONG ldap_encode_sort_controlW(WLDAP32_PLDAP,PLDAPSortKeyW*,PLDAPControlW,BOOLEAN);
PCHAR ldap_err2stringA(ULONG);
PWCHAR ldap_err2stringW(ULONG);
ULONG ldap_escape_filter_elementA(PCHAR,ULONG,PCHAR,ULONG);
ULONG ldap_escape_filter_elementW(PCHAR,ULONG,PWCHAR,ULONG);
PCHAR *ldap_explode_dnA(PCHAR,ULONG);
PWCHAR *ldap_explode_dnW(PWCHAR,ULONG);
ULONG ldap_extended_operationA(WLDAP32_LDAP*,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_extended_operationW(WLDAP32_LDAP*,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_extended_operation_sA(WLDAP32_LDAP*,PCHAR,struct WLDAP32_berval*,PLDAPControlA*, PLDAPControlA*,
PCHAR*,struct WLDAP32_berval**);
ULONG ldap_extended_operation_sW(WLDAP32_LDAP*,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*, PLDAPControlW*,
PWCHAR*,struct WLDAP32_berval**);
PCHAR ldap_first_attributeA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement**);
PWCHAR ldap_first_attributeW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement**);
WLDAP32_LDAPMessage *WLDAP32_ldap_first_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
WLDAP32_LDAPMessage *WLDAP32_ldap_first_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG ldap_free_controlsA(LDAPControlA**);
ULONG ldap_free_controlsW(LDAPControlW**);
PCHAR ldap_get_dnA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
PWCHAR ldap_get_dnW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
ULONG ldap_get_next_page(WLDAP32_LDAP*,PLDAPSearch,ULONG,ULONG*);
ULONG ldap_get_next_page_s(WLDAP32_LDAP*,PLDAPSearch,struct l_timeval*,ULONG,ULONG*,WLDAP32_LDAPMessage**);
ULONG ldap_get_optionA(WLDAP32_LDAP*,int,void*);
ULONG ldap_get_optionW(WLDAP32_LDAP*,int,void*);
ULONG ldap_get_paged_count(WLDAP32_LDAP*,PLDAPSearch,ULONG*,WLDAP32_LDAPMessage*);
PCHAR *ldap_get_valuesA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR);
PWCHAR *ldap_get_valuesW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR);
PBERVAL *ldap_get_values_lenA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR);
PBERVAL *ldap_get_values_lenW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR);
WLDAP32_LDAP *ldap_initA(const PCHAR,ULONG);
WLDAP32_LDAP *ldap_initW(const PWCHAR,ULONG);
void ldap_memfreeA(PCHAR);
void ldap_memfreeW(PWCHAR);
ULONG ldap_modifyA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
ULONG ldap_modifyW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
ULONG ldap_modify_extA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_modify_extW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_modify_ext_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*);
ULONG ldap_modify_ext_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*);
ULONG ldap_modify_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
ULONG ldap_modify_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
ULONG ldap_modrdnA(WLDAP32_LDAP*,PCHAR,PCHAR);
ULONG ldap_modrdnW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
ULONG ldap_modrdn2A(WLDAP32_LDAP*,PCHAR,PCHAR,INT);
ULONG ldap_modrdn2W(WLDAP32_LDAP*,PWCHAR,PWCHAR,INT);
ULONG ldap_modrdn2_sA(WLDAP32_LDAP*,PCHAR,PCHAR,INT);
ULONG ldap_modrdn2_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,INT);
ULONG ldap_modrdn_sA(WLDAP32_LDAP*,PCHAR,PCHAR);
ULONG ldap_modrdn_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
ULONG WLDAP32_ldap_msgfree(WLDAP32_LDAPMessage*);
PCHAR ldap_next_attributeA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement*);
PWCHAR ldap_next_attributeW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement*);
WLDAP32_LDAPMessage *WLDAP32_ldap_next_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
WLDAP32_LDAPMessage *WLDAP32_ldap_next_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
WLDAP32_LDAP *ldap_openA(PCHAR,ULONG);
WLDAP32_LDAP *ldap_openW(PWCHAR,ULONG);
ULONG ldap_parse_extended_resultA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR*,struct WLDAP32_berval**,BOOLEAN);
ULONG ldap_parse_extended_resultW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR*,struct WLDAP32_berval**,BOOLEAN);
ULONG ldap_parse_page_controlA(WLDAP32_LDAP*,PLDAPControlA*,ULONG*,struct WLDAP32_berval**);
ULONG ldap_parse_page_controlW(WLDAP32_LDAP*,PLDAPControlW*,ULONG*,struct WLDAP32_berval**);
ULONG ldap_parse_referenceA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR**);
ULONG ldap_parse_referenceW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR**);
ULONG ldap_parse_resultA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,ULONG*,PCHAR*,PCHAR*,PCHAR**,PLDAPControlA**,BOOLEAN);
ULONG ldap_parse_resultW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,ULONG*,PWCHAR*,PWCHAR*,PWCHAR**,PLDAPControlW**,BOOLEAN);
ULONG ldap_parse_sort_controlA(WLDAP32_LDAP*,PLDAPControlA*,ULONG*,PCHAR*);
ULONG ldap_parse_sort_controlW(WLDAP32_LDAP*,PLDAPControlW*,ULONG*,PWCHAR*);
int ldap_parse_vlv_controlA(WLDAP32_LDAP*,LDAPControlA**,ULONG*,ULONG*,struct WLDAP32_berval**,INT*);
int ldap_parse_vlv_controlW(WLDAP32_LDAP*,LDAPControlW**,ULONG*,ULONG*,struct WLDAP32_berval**,INT*);
void WLDAP32_ldap_perror(WLDAP32_LDAP*,const PCHAR);
ULONG ldap_rename_extA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,INT,PLDAPControlA*,PLDAPControlA*,ULONG*);
ULONG ldap_rename_extW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,INT,PLDAPControlW*,PLDAPControlW*,ULONG*);
ULONG ldap_rename_ext_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,INT,PLDAPControlA*,PLDAPControlA*);
ULONG ldap_rename_ext_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,INT,PLDAPControlW*,PLDAPControlW*);
ULONG WLDAP32_ldap_result(WLDAP32_LDAP*,ULONG,ULONG,struct l_timeval*,WLDAP32_LDAPMessage**);
ULONG WLDAP32_ldap_result2error(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,ULONG);
ULONG ldap_sasl_bindA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,int*);
ULONG ldap_sasl_bindW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,int*);
ULONG ldap_sasl_bind_sA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,PBERVAL*);
ULONG ldap_sasl_bind_sW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,PBERVAL*);
ULONG ldap_search_abandon_page(WLDAP32_PLDAP,PLDAPSearch);
ULONG ldap_searchA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG);
ULONG ldap_searchW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG);
ULONG ldap_search_extA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,PLDAPControlA*,
PLDAPControlA*,ULONG,ULONG,ULONG*);
ULONG ldap_search_extW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,PLDAPControlW*,
PLDAPControlW*,ULONG,ULONG,ULONG*);
ULONG ldap_search_ext_sA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,PLDAPControlA*,
PLDAPControlA*,struct l_timeval*,ULONG,WLDAP32_LDAPMessage**);
ULONG ldap_search_ext_sW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,PLDAPControlW*,
PLDAPControlW*,struct l_timeval*,ULONG,WLDAP32_LDAPMessage**);
PLDAPSearch ldap_search_init_pageA(WLDAP32_PLDAP,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,PLDAPControlA*,
PLDAPControlA*,ULONG,ULONG,PLDAPSortKeyA*);
PLDAPSearch ldap_search_init_pageW(WLDAP32_PLDAP,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,PLDAPControlW*,
PLDAPControlW*,ULONG,ULONG, PLDAPSortKeyW*);
ULONG ldap_search_sA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,WLDAP32_LDAPMessage**);
ULONG ldap_search_sW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,WLDAP32_LDAPMessage**);
ULONG ldap_search_stA(WLDAP32_LDAP*,const PCHAR,ULONG,const PCHAR,PCHAR[],ULONG,
struct l_timeval*,WLDAP32_LDAPMessage**);
ULONG ldap_search_stW(WLDAP32_LDAP*,const PWCHAR,ULONG,const PWCHAR,PWCHAR[],ULONG,
struct l_timeval*,WLDAP32_LDAPMessage**);
ULONG ldap_set_optionA(WLDAP32_LDAP*,int,void*);
ULONG ldap_set_optionW(WLDAP32_LDAP*,int,void*);
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);
ULONG ldap_simple_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
WLDAP32_LDAP *ldap_sslinitA(PCHAR,ULONG,int);
WLDAP32_LDAP *ldap_sslinitW(PWCHAR,ULONG,int);
ULONG ldap_start_tls_sA(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlA*,PLDAPControlA*);
ULONG ldap_start_tls_sW(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlW*,PLDAPControlW*);
ULONG ldap_startup(PLDAP_VERSION_INFO,HANDLE*);
BOOLEAN ldap_stop_tls_s(WLDAP32_PLDAP);
ULONG ldap_ufn2dnA(PCHAR,PCHAR*);
ULONG ldap_ufn2dnW(PWCHAR,PWCHAR*);
ULONG WLDAP32_ldap_unbind(WLDAP32_LDAP*);
ULONG WLDAP32_ldap_unbind_s(WLDAP32_LDAP*);
ULONG ldap_value_freeA(PCHAR*);
ULONG ldap_value_freeW(PWCHAR*);
ULONG WLDAP32_ldap_value_free_len(struct WLDAP32_berval**);
ULONG LdapGetLastError(void);
ULONG LdapMapErrorToWin32(ULONG);
int LdapUnicodeToUTF8(LPCWSTR,int,LPSTR,int);
int LdapUTF8ToUnicode(LPCSTR,int,LPWSTR,int);

View file

@ -0,0 +1,856 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* A set of helper functions to convert LDAP data structures
* to and from ansi (A), wide character (W) and utf8 (U) encodings.
*/
static inline char *strdupU( const char *src )
{
char *dst;
if (!src) return NULL;
dst = HeapAlloc( GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) );
if (dst)
strcpy( dst, src );
return dst;
}
static inline LPWSTR strAtoW( LPCSTR str )
{
LPWSTR ret = NULL;
if (str)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
}
return ret;
}
static inline LPSTR strWtoA( LPCWSTR str )
{
LPSTR ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
}
static inline char *strWtoU( LPCWSTR str )
{
LPSTR ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
}
static inline LPWSTR strUtoW( char *str )
{
LPWSTR ret = NULL;
if (str)
{
DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len );
}
return ret;
}
static inline void strfreeA( LPSTR str )
{
HeapFree( GetProcessHeap(), 0, str );
}
static inline void strfreeW( LPWSTR str )
{
HeapFree( GetProcessHeap(), 0, str );
}
static inline void strfreeU( char *str )
{
HeapFree( GetProcessHeap(), 0, str );
}
static inline DWORD strarraylenA( LPSTR *strarray )
{
LPSTR *p = strarray;
while (*p) p++;
return p - strarray;
}
static inline DWORD strarraylenW( LPWSTR *strarray )
{
LPWSTR *p = strarray;
while (*p) p++;
return p - strarray;
}
static inline DWORD strarraylenU( char **strarray )
{
char **p = strarray;
while (*p) p++;
return p - strarray;
}
static inline LPWSTR *strarrayAtoW( LPSTR *strarray )
{
LPWSTR *strarrayW = NULL;
DWORD size;
if (strarray)
{
size = sizeof(WCHAR*) * (strarraylenA( strarray ) + 1);
strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (strarrayW)
{
LPSTR *p = strarray;
LPWSTR *q = strarrayW;
while (*p) *q++ = strAtoW( *p++ );
*q = NULL;
}
}
return strarrayW;
}
static inline LPSTR *strarrayWtoA( LPWSTR *strarray )
{
LPSTR *strarrayA = NULL;
DWORD size;
if (strarray)
{
size = sizeof(LPSTR) * (strarraylenW( strarray ) + 1);
strarrayA = HeapAlloc( GetProcessHeap(), 0, size );
if (strarrayA)
{
LPWSTR *p = strarray;
LPSTR *q = strarrayA;
while (*p) *q++ = strWtoA( *p++ );
*q = NULL;
}
}
return strarrayA;
}
static inline char **strarrayWtoU( LPWSTR *strarray )
{
char **strarrayU = NULL;
DWORD size;
if (strarray)
{
size = sizeof(char*) * (strarraylenW( strarray ) + 1);
strarrayU = HeapAlloc( GetProcessHeap(), 0, size );
if (strarrayU)
{
LPWSTR *p = strarray;
char **q = strarrayU;
while (*p) *q++ = strWtoU( *p++ );
*q = NULL;
}
}
return strarrayU;
}
static inline LPWSTR *strarrayUtoW( char **strarray )
{
LPWSTR *strarrayW = NULL;
DWORD size;
if (strarray)
{
size = sizeof(WCHAR*) * (strarraylenU( strarray ) + 1);
strarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (strarrayW)
{
char **p = strarray;
LPWSTR *q = strarrayW;
while (*p) *q++ = strUtoW( *p++ );
*q = NULL;
}
}
return strarrayW;
}
static inline void strarrayfreeA( LPSTR *strarray )
{
if (strarray)
{
LPSTR *p = strarray;
while (*p) strfreeA( *p++ );
HeapFree( GetProcessHeap(), 0, strarray );
}
}
static inline void strarrayfreeW( LPWSTR *strarray )
{
if (strarray)
{
LPWSTR *p = strarray;
while (*p) strfreeW( *p++ );
HeapFree( GetProcessHeap(), 0, strarray );
}
}
static inline void strarrayfreeU( char **strarray )
{
if (strarray)
{
char **p = strarray;
while (*p) strfreeU( *p++ );
HeapFree( GetProcessHeap(), 0, strarray );
}
}
#ifdef HAVE_LDAP
static inline struct berval *bvdup( struct berval *bv )
{
struct berval *berval;
DWORD size = sizeof(struct berval) + bv->bv_len;
berval = HeapAlloc( GetProcessHeap(), 0, size );
if (berval)
{
char *val = (char *)berval + sizeof(struct berval);
berval->bv_len = bv->bv_len;
berval->bv_val = val;
memcpy( val, bv->bv_val, bv->bv_len );
}
return berval;
}
static inline DWORD bvarraylen( struct berval **bv )
{
struct berval **p = bv;
while (*p) p++;
return p - bv;
}
static inline struct berval **bvarraydup( struct berval **bv )
{
struct berval **berval = NULL;
DWORD size;
if (bv)
{
size = sizeof(struct berval *) * (bvarraylen( bv ) + 1);
berval = HeapAlloc( GetProcessHeap(), 0, size );
if (berval)
{
struct berval **p = bv;
struct berval **q = berval;
while (*p) *q++ = bvdup( *p++ );
*q = NULL;
}
}
return berval;
}
static inline void bvarrayfree( struct berval **bv )
{
struct berval **p = bv;
while (*p) HeapFree( GetProcessHeap(), 0, *p++ );
HeapFree( GetProcessHeap(), 0, bv );
}
static inline LDAPModW *modAtoW( LDAPModA *mod )
{
LDAPModW *modW;
modW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPModW) );
if (modW)
{
modW->mod_op = mod->mod_op;
modW->mod_type = strAtoW( mod->mod_type );
if (mod->mod_op & LDAP_MOD_BVALUES)
modW->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
else
modW->mod_vals.modv_strvals = strarrayAtoW( mod->mod_vals.modv_strvals );
}
return modW;
}
static inline LDAPMod *modWtoU( LDAPModW *mod )
{
LDAPMod *modU;
modU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPMod) );
if (modU)
{
modU->mod_op = mod->mod_op;
modU->mod_type = strWtoU( mod->mod_type );
if (mod->mod_op & LDAP_MOD_BVALUES)
modU->mod_vals.modv_bvals = bvarraydup( mod->mod_vals.modv_bvals );
else
modU->mod_vals.modv_strvals = strarrayWtoU( mod->mod_vals.modv_strvals );
}
return modU;
}
static inline void modfreeW( LDAPModW *mod )
{
if (mod->mod_op & LDAP_MOD_BVALUES)
bvarrayfree( mod->mod_vals.modv_bvals );
else
strarrayfreeW( mod->mod_vals.modv_strvals );
HeapFree( GetProcessHeap(), 0, mod );
}
static inline void modfreeU( LDAPMod *mod )
{
if (mod->mod_op & LDAP_MOD_BVALUES)
bvarrayfree( mod->mod_vals.modv_bvals );
else
strarrayfreeU( mod->mod_vals.modv_strvals );
HeapFree( GetProcessHeap(), 0, mod );
}
static inline DWORD modarraylenA( LDAPModA **modarray )
{
LDAPModA **p = modarray;
while (*p) p++;
return p - modarray;
}
static inline DWORD modarraylenW( LDAPModW **modarray )
{
LDAPModW **p = modarray;
while (*p) p++;
return p - modarray;
}
static inline LDAPModW **modarrayAtoW( LDAPModA **modarray )
{
LDAPModW **modarrayW = NULL;
DWORD size;
if (modarray)
{
size = sizeof(LDAPModW*) * (modarraylenA( modarray ) + 1);
modarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (modarrayW)
{
LDAPModA **p = modarray;
LDAPModW **q = modarrayW;
while (*p) *q++ = modAtoW( *p++ );
*q = NULL;
}
}
return modarrayW;
}
static inline LDAPMod **modarrayWtoU( LDAPModW **modarray )
{
LDAPMod **modarrayU = NULL;
DWORD size;
if (modarray)
{
size = sizeof(LDAPMod*) * (modarraylenW( modarray ) + 1);
modarrayU = HeapAlloc( GetProcessHeap(), 0, size );
if (modarrayU)
{
LDAPModW **p = modarray;
LDAPMod **q = modarrayU;
while (*p) *q++ = modWtoU( *p++ );
*q = NULL;
}
}
return modarrayU;
}
static inline void modarrayfreeW( LDAPModW **modarray )
{
if (modarray)
{
LDAPModW **p = modarray;
while (*p) modfreeW( *p++ );
HeapFree( GetProcessHeap(), 0, modarray );
}
}
static inline void modarrayfreeU( LDAPMod **modarray )
{
if (modarray)
{
LDAPMod **p = modarray;
while (*p) modfreeU( *p++ );
HeapFree( GetProcessHeap(), 0, modarray );
}
}
static inline LDAPControlW *controlAtoW( LDAPControlA *control )
{
LDAPControlW *controlW;
DWORD len = control->ldctl_value.bv_len;
char *val = NULL;
if (control->ldctl_value.bv_val)
{
val = HeapAlloc( GetProcessHeap(), 0, len );
if (!val) return NULL;
memcpy( val, control->ldctl_value.bv_val, len );
}
controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
if (!controlW)
{
HeapFree( GetProcessHeap(), 0, val );
return NULL;
}
controlW->ldctl_oid = strAtoW( control->ldctl_oid );
controlW->ldctl_value.bv_len = len;
controlW->ldctl_value.bv_val = val;
controlW->ldctl_iscritical = control->ldctl_iscritical;
return controlW;
}
static inline LDAPControlA *controlWtoA( LDAPControlW *control )
{
LDAPControlA *controlA;
DWORD len = control->ldctl_value.bv_len;
char *val = NULL;
if (control->ldctl_value.bv_val)
{
val = HeapAlloc( GetProcessHeap(), 0, len );
if (!val) return NULL;
memcpy( val, control->ldctl_value.bv_val, len );
}
controlA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlA) );
if (!controlA)
{
HeapFree( GetProcessHeap(), 0, val );
return NULL;
}
controlA->ldctl_oid = strWtoA( control->ldctl_oid );
controlA->ldctl_value.bv_len = len;
controlA->ldctl_value.bv_val = val;
controlA->ldctl_iscritical = control->ldctl_iscritical;
return controlA;
}
static inline LDAPControl *controlWtoU( LDAPControlW *control )
{
LDAPControl *controlU;
DWORD len = control->ldctl_value.bv_len;
char *val = NULL;
if (control->ldctl_value.bv_val)
{
val = HeapAlloc( GetProcessHeap(), 0, len );
if (!val) return NULL;
memcpy( val, control->ldctl_value.bv_val, len );
}
controlU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControl) );
if (!controlU)
{
HeapFree( GetProcessHeap(), 0, val );
return NULL;
}
controlU->ldctl_oid = strWtoU( control->ldctl_oid );
controlU->ldctl_value.bv_len = len;
controlU->ldctl_value.bv_val = val;
controlU->ldctl_iscritical = control->ldctl_iscritical;
return controlU;
}
static inline LDAPControlW *controlUtoW( LDAPControl *control )
{
LDAPControlW *controlW;
DWORD len = control->ldctl_value.bv_len;
char *val = NULL;
if (control->ldctl_value.bv_val)
{
val = HeapAlloc( GetProcessHeap(), 0, len );
if (!val) return NULL;
memcpy( val, control->ldctl_value.bv_val, len );
}
controlW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) );
if (!controlW)
{
HeapFree( GetProcessHeap(), 0, val );
return NULL;
}
controlW->ldctl_oid = strUtoW( control->ldctl_oid );
controlW->ldctl_value.bv_len = len;
controlW->ldctl_value.bv_val = val;
controlW->ldctl_iscritical = control->ldctl_iscritical;
return controlW;
}
static inline void controlfreeA( LDAPControlA *control )
{
if (control)
{
strfreeA( control->ldctl_oid );
HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
HeapFree( GetProcessHeap(), 0, control );
}
}
static inline void controlfreeW( LDAPControlW *control )
{
if (control)
{
strfreeW( control->ldctl_oid );
HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
HeapFree( GetProcessHeap(), 0, control );
}
}
static inline void controlfreeU( LDAPControl *control )
{
if (control)
{
strfreeU( control->ldctl_oid );
HeapFree( GetProcessHeap(), 0, control->ldctl_value.bv_val );
HeapFree( GetProcessHeap(), 0, control );
}
}
static inline DWORD controlarraylenA( LDAPControlA **controlarray )
{
LDAPControlA **p = controlarray;
while (*p) p++;
return p - controlarray;
}
static inline DWORD controlarraylenW( LDAPControlW **controlarray )
{
LDAPControlW **p = controlarray;
while (*p) p++;
return p - controlarray;
}
static inline DWORD controlarraylenU( LDAPControl **controlarray )
{
LDAPControl **p = controlarray;
while (*p) p++;
return p - controlarray;
}
static inline LDAPControlW **controlarrayAtoW( LDAPControlA **controlarray )
{
LDAPControlW **controlarrayW = NULL;
DWORD size;
if (controlarray)
{
size = sizeof(LDAPControlW*) * (controlarraylenA( controlarray ) + 1);
controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (controlarrayW)
{
LDAPControlA **p = controlarray;
LDAPControlW **q = controlarrayW;
while (*p) *q++ = controlAtoW( *p++ );
*q = NULL;
}
}
return controlarrayW;
}
static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray )
{
LDAPControlA **controlarrayA = NULL;
DWORD size;
if (controlarray)
{
size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
controlarrayA = HeapAlloc( GetProcessHeap(), 0, size );
if (controlarrayA)
{
LDAPControlW **p = controlarray;
LDAPControlA **q = controlarrayA;
while (*p) *q++ = controlWtoA( *p++ );
*q = NULL;
}
}
return controlarrayA;
}
static inline LDAPControl **controlarrayWtoU( LDAPControlW **controlarray )
{
LDAPControl **controlarrayU = NULL;
DWORD size;
if (controlarray)
{
size = sizeof(LDAPControl*) * (controlarraylenW( controlarray ) + 1);
controlarrayU = HeapAlloc( GetProcessHeap(), 0, size );
if (controlarrayU)
{
LDAPControlW **p = controlarray;
LDAPControl **q = controlarrayU;
while (*p) *q++ = controlWtoU( *p++ );
*q = NULL;
}
}
return controlarrayU;
}
static inline LDAPControlW **controlarrayUtoW( LDAPControl **controlarray )
{
LDAPControlW **controlarrayW = NULL;
DWORD size;
if (controlarray)
{
size = sizeof(LDAPControlW*) * (controlarraylenU( controlarray ) + 1);
controlarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (controlarrayW)
{
LDAPControl **p = controlarray;
LDAPControlW **q = controlarrayW;
while (*p) *q++ = controlUtoW( *p++ );
*q = NULL;
}
}
return controlarrayW;
}
static inline void controlarrayfreeA( LDAPControlA **controlarray )
{
if (controlarray)
{
LDAPControlA **p = controlarray;
while (*p) controlfreeA( *p++ );
HeapFree( GetProcessHeap(), 0, controlarray );
}
}
static inline void controlarrayfreeW( LDAPControlW **controlarray )
{
if (controlarray)
{
LDAPControlW **p = controlarray;
while (*p) controlfreeW( *p++ );
HeapFree( GetProcessHeap(), 0, controlarray );
}
}
static inline void controlarrayfreeU( LDAPControl **controlarray )
{
if (controlarray)
{
LDAPControl **p = controlarray;
while (*p) controlfreeU( *p++ );
HeapFree( GetProcessHeap(), 0, controlarray );
}
}
static inline LDAPSortKeyW *sortkeyAtoW( LDAPSortKeyA *sortkey )
{
LDAPSortKeyW *sortkeyW;
sortkeyW = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyW) );
if (sortkeyW)
{
sortkeyW->sk_attrtype = strAtoW( sortkey->sk_attrtype );
sortkeyW->sk_matchruleoid = strAtoW( sortkey->sk_matchruleoid );
sortkeyW->sk_reverseorder = sortkey->sk_reverseorder;
}
return sortkeyW;
}
static inline LDAPSortKeyA *sortkeyWtoA( LDAPSortKeyW *sortkey )
{
LDAPSortKeyA *sortkeyA;
sortkeyA = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKeyA) );
if (sortkeyA)
{
sortkeyA->sk_attrtype = strWtoA( sortkey->sk_attrtype );
sortkeyA->sk_matchruleoid = strWtoA( sortkey->sk_matchruleoid );
sortkeyA->sk_reverseorder = sortkey->sk_reverseorder;
}
return sortkeyA;
}
static inline LDAPSortKey *sortkeyWtoU( LDAPSortKeyW *sortkey )
{
LDAPSortKey *sortkeyU;
sortkeyU = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPSortKey) );
if (sortkeyU)
{
sortkeyU->attributeType = strWtoU( sortkey->sk_attrtype );
sortkeyU->orderingRule = strWtoU( sortkey->sk_matchruleoid );
sortkeyU->reverseOrder = sortkey->sk_reverseorder;
}
return sortkeyU;
}
static inline void sortkeyfreeA( LDAPSortKeyA *sortkey )
{
if (sortkey)
{
strfreeA( sortkey->sk_attrtype );
strfreeA( sortkey->sk_matchruleoid );
HeapFree( GetProcessHeap(), 0, sortkey );
}
}
static inline void sortkeyfreeW( LDAPSortKeyW *sortkey )
{
if (sortkey)
{
strfreeW( sortkey->sk_attrtype );
strfreeW( sortkey->sk_matchruleoid );
HeapFree( GetProcessHeap(), 0, sortkey );
}
}
static inline void sortkeyfreeU( LDAPSortKey *sortkey )
{
if (sortkey)
{
strfreeU( sortkey->attributeType );
strfreeU( sortkey->orderingRule );
HeapFree( GetProcessHeap(), 0, sortkey );
}
}
static inline DWORD sortkeyarraylenA( LDAPSortKeyA **sortkeyarray )
{
LDAPSortKeyA **p = sortkeyarray;
while (*p) p++;
return p - sortkeyarray;
}
static inline DWORD sortkeyarraylenW( LDAPSortKeyW **sortkeyarray )
{
LDAPSortKeyW **p = sortkeyarray;
while (*p) p++;
return p - sortkeyarray;
}
static inline LDAPSortKeyW **sortkeyarrayAtoW( LDAPSortKeyA **sortkeyarray )
{
LDAPSortKeyW **sortkeyarrayW = NULL;
DWORD size;
if (sortkeyarray)
{
size = sizeof(LDAPSortKeyW*) * (sortkeyarraylenA( sortkeyarray ) + 1);
sortkeyarrayW = HeapAlloc( GetProcessHeap(), 0, size );
if (sortkeyarrayW)
{
LDAPSortKeyA **p = sortkeyarray;
LDAPSortKeyW **q = sortkeyarrayW;
while (*p) *q++ = sortkeyAtoW( *p++ );
*q = NULL;
}
}
return sortkeyarrayW;
}
static inline LDAPSortKey **sortkeyarrayWtoU( LDAPSortKeyW **sortkeyarray )
{
LDAPSortKey **sortkeyarrayU = NULL;
DWORD size;
if (sortkeyarray)
{
size = sizeof(LDAPSortKey*) * (sortkeyarraylenW( sortkeyarray ) + 1);
sortkeyarrayU = HeapAlloc( GetProcessHeap(), 0, size );
if (sortkeyarrayU)
{
LDAPSortKeyW **p = sortkeyarray;
LDAPSortKey **q = sortkeyarrayU;
while (*p) *q++ = sortkeyWtoU( *p++ );
*q = NULL;
}
}
return sortkeyarrayU;
}
static inline void sortkeyarrayfreeW( LDAPSortKeyW **sortkeyarray )
{
if (sortkeyarray)
{
LDAPSortKeyW **p = sortkeyarray;
while (*p) sortkeyfreeW( *p++ );
HeapFree( GetProcessHeap(), 0, sortkeyarray );
}
}
static inline void sortkeyarrayfreeU( LDAPSortKey **sortkeyarray )
{
if (sortkeyarray)
{
LDAPSortKey **p = sortkeyarray;
while (*p) sortkeyfreeU( *p++ );
HeapFree( GetProcessHeap(), 0, sortkeyarray );
}
}
#endif /* HAVE_LDAP */

View file

@ -0,0 +1,33 @@
/*
* Top level resource file for WLDAP32
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wldap32_De.rc"
#include "wldap32_En.rc"
#include "wldap32_Es.rc"
#include "wldap32_Fr.rc"
#include "wldap32_Ko.rc"
#include "wldap32_Nl.rc"
#include "wldap32_No.rc"
#include "wldap32_Ru.rc"
#include "wldap32_Tr.rc"

View file

@ -0,0 +1,245 @@
10 cdecl ldap_abandon(ptr long) WLDAP32_ldap_abandon
11 cdecl ldap_add(ptr str ptr) ldap_addA
12 cdecl ldap_get_optionW(ptr long ptr)
13 cdecl ldap_unbind(ptr) WLDAP32_ldap_unbind
14 cdecl ldap_set_optionW(ptr long ptr)
16 cdecl LdapGetLastError()
17 cdecl cldap_open(str long) cldap_openA
18 cdecl LdapMapErrorToWin32(long)
19 cdecl ldap_compare(ptr str str str) ldap_compareA
20 cdecl ldap_delete(ptr str) ldap_deleteA
21 cdecl ldap_result2error(ptr ptr long) WLDAP32_ldap_result2error
22 cdecl ldap_err2string(long) ldap_err2stringA
23 cdecl ldap_modify(ptr str ptr) ldap_modifyA
24 cdecl ldap_modrdn(ptr str ptr) ldap_modrdnA
25 cdecl ldap_open(str long) ldap_openA
26 cdecl ldap_first_entry(ptr ptr) WLDAP32_ldap_first_entry
27 cdecl ldap_next_entry(ptr ptr) WLDAP32_ldap_next_entry
28 cdecl cldap_openW(wstr long)
29 cdecl LdapUTF8ToUnicode(str long ptr long)
30 cdecl ldap_get_dn(ptr ptr) ldap_get_dnA
31 cdecl ldap_dn2ufn(str) ldap_dn2ufnA
32 cdecl ldap_first_attribute(ptr ptr ptr) ldap_first_attributeA
33 cdecl ldap_next_attribute(ptr ptr ptr) ldap_next_attributeA
34 cdecl ldap_get_values(ptr ptr str) ldap_get_valuesA
35 cdecl ldap_get_values_len(ptr ptr str) ldap_get_values_lenA
36 cdecl ldap_count_entries(ptr ptr) WLDAP32_ldap_count_entries
37 cdecl ldap_count_values(ptr) ldap_count_valuesA
38 cdecl ldap_value_free(ptr) ldap_value_freeA
39 cdecl ldap_explode_dn(str long) ldap_explode_dnA
40 cdecl ldap_result(ptr long long ptr ptr) WLDAP32_ldap_result
41 cdecl ldap_msgfree(ptr) WLDAP32_ldap_msgfree
42 cdecl ldap_addW(ptr wstr ptr)
43 cdecl ldap_search(ptr str long str ptr long) ldap_searchA
44 cdecl ldap_add_s(ptr str ptr) ldap_add_sA
45 cdecl ldap_bind_s(ptr str str long) ldap_bind_sA
46 cdecl ldap_unbind_s(ptr) WLDAP32_ldap_unbind_s
47 cdecl ldap_delete_s(ptr str) ldap_delete_sA
48 cdecl ldap_modify_s(ptr str ptr) ldap_modify_sA
49 cdecl ldap_modrdn_s(ptr str ptr) ldap_modrdn_sA
50 cdecl ldap_search_s(ptr str long str ptr long ptr) ldap_search_sA
51 cdecl ldap_search_st(ptr str long str ptr long ptr ptr) ldap_search_stA
52 cdecl ldap_compare_s(ptr str str str) ldap_compare_sA
53 cdecl LdapUnicodeToUTF8(wstr long ptr long)
54 cdecl ber_bvfree(ptr) WLDAP32_ber_bvfree
55 cdecl cldap_openA(str long)
56 cdecl ldap_addA(ptr str ptr)
57 cdecl ldap_add_ext(ptr str ptr ptr ptr ptr) ldap_add_extA
58 cdecl ldap_add_extA(ptr str ptr ptr ptr ptr)
59 cdecl ldap_simple_bind(ptr str str) ldap_simple_bindA
60 cdecl ldap_simple_bind_s(ptr str str) ldap_simple_bind_sA
61 cdecl ldap_bind(ptr str str long) ldap_bindA
62 cdecl ldap_add_extW(ptr wstr ptr ptr ptr ptr)
63 cdecl ldap_add_ext_s(ptr str ptr ptr ptr) ldap_add_ext_sA
64 cdecl ldap_add_ext_sA(ptr str ptr ptr ptr)
65 cdecl ldap_add_ext_sW(ptr str ptr ptr ptr)
66 cdecl ldap_add_sA(ptr str ptr)
67 cdecl ldap_modrdn2(ptr str ptr long) ldap_modrdn2A
68 cdecl ldap_modrdn2_s(ptr str ptr long) ldap_modrdn2_sA
69 cdecl ldap_add_sW(ptr wstr ptr)
70 cdecl ldap_bindA(ptr str str long)
71 cdecl ldap_bindW(ptr wstr wstr long)
72 cdecl ldap_bind_sA(ptr str str long)
73 cdecl ldap_bind_sW(ptr wstr wstr long)
74 cdecl ldap_close_extended_op(ptr long)
75 cdecl ldap_compareA(ptr str str str)
76 cdecl ldap_compareW(ptr wstr wstr wstr)
77 cdecl ldap_count_values_len(ptr) WLDAP32_ldap_count_values_len
78 cdecl ldap_compare_ext(ptr str str str ptr ptr ptr ptr) ldap_compare_extA
79 cdecl ldap_value_free_len(ptr) WLDAP32_ldap_value_free_len
80 cdecl ldap_compare_extA(ptr str str str ptr ptr ptr ptr)
81 cdecl ldap_compare_extW(ptr wstr wstr wstr ptr ptr ptr ptr)
82 cdecl ldap_perror(ptr ptr) WLDAP32_ldap_perror
83 cdecl ldap_compare_ext_s(ptr str str str ptr ptr ptr) ldap_compare_ext_sA
84 cdecl ldap_compare_ext_sA(ptr str str str ptr ptr ptr)
85 cdecl ldap_compare_ext_sW(ptr wstr wstr wstr ptr ptr ptr)
86 cdecl ldap_compare_sA(ptr str str str)
87 cdecl ldap_compare_sW(ptr wstr wstr wstr)
88 cdecl ldap_connect(ptr ptr)
89 cdecl ldap_control_free(ptr) ldap_control_freeA
90 cdecl ldap_control_freeA(ptr)
91 cdecl ldap_control_freeW(ptr)
92 cdecl ldap_controls_free(ptr) ldap_controls_freeA
93 cdecl ldap_controls_freeA(ptr)
94 cdecl ldap_controls_freeW(ptr)
95 cdecl ldap_count_references(ptr ptr) WLDAP32_ldap_count_references
96 cdecl ldap_count_valuesA(ptr)
97 cdecl ldap_count_valuesW(ptr)
98 cdecl ldap_create_page_control(ptr long ptr long ptr) ldap_create_page_controlA
99 cdecl ldap_create_page_controlA(ptr long ptr long ptr)
100 cdecl ldap_create_page_controlW(ptr long ptr long ptr)
101 cdecl ldap_create_sort_control(ptr ptr long ptr) ldap_create_sort_controlA
102 cdecl ldap_create_sort_controlA(ptr ptr long ptr)
103 cdecl ldap_create_sort_controlW(ptr ptr long ptr)
104 cdecl ldap_deleteA(ptr str)
105 cdecl ldap_deleteW(ptr wstr)
106 cdecl ldap_delete_ext(ptr str ptr ptr ptr) ldap_delete_extA
107 cdecl ldap_delete_extA(ptr str ptr ptr ptr)
108 cdecl ldap_delete_extW(ptr wstr ptr ptr ptr)
109 cdecl ldap_delete_ext_s(ptr str ptr ptr) ldap_delete_ext_sA
110 cdecl ldap_delete_ext_sA(ptr str ptr ptr)
111 cdecl ldap_delete_ext_sW(ptr wstr ptr ptr)
112 cdecl ldap_delete_sA(ptr str)
113 cdecl ldap_delete_sW(ptr wstr)
114 cdecl ldap_dn2ufnW(wstr)
115 cdecl ldap_encode_sort_controlA(ptr ptr ptr long)
116 cdecl ldap_encode_sort_controlW(ptr ptr ptr long)
117 cdecl ldap_err2stringA(long)
118 cdecl ldap_err2stringW(long)
119 cdecl ldap_escape_filter_elementA(str long ptr long)
120 cdecl ldap_escape_filter_elementW(wstr long ptr long)
121 cdecl ldap_explode_dnA(str long)
122 cdecl ldap_explode_dnW(wstr long)
123 cdecl ldap_extended_operation(ptr str ptr ptr ptr ptr) ldap_extended_operationA
124 cdecl ldap_extended_operationA(ptr str ptr ptr ptr ptr)
125 cdecl ldap_extended_operationW(ptr wstr ptr ptr ptr ptr)
126 cdecl ldap_first_attributeA(ptr ptr ptr)
127 cdecl ldap_first_attributeW(ptr ptr ptr)
128 cdecl ldap_first_reference(ptr ptr) WLDAP32_ldap_first_reference
129 cdecl ldap_free_controls(ptr) ldap_free_controlsA
130 cdecl ldap_free_controlsA(ptr)
131 cdecl ldap_free_controlsW(ptr)
132 cdecl ldap_get_dnA(ptr ptr)
133 cdecl ldap_get_dnW(ptr ptr)
134 cdecl ldap_get_next_page(ptr ptr long ptr)
135 cdecl ldap_get_next_page_s(ptr ptr ptr long ptr ptr)
136 cdecl ldap_get_option(ptr long ptr) ldap_get_optionA
137 cdecl ldap_get_optionA(ptr long ptr)
138 cdecl ldap_get_paged_count(ptr ptr ptr ptr)
139 cdecl ldap_get_valuesA(ptr ptr str)
140 cdecl ldap_get_valuesW(ptr ptr wstr)
141 cdecl ldap_get_values_lenA(ptr ptr str)
142 cdecl ldap_get_values_lenW(ptr ptr wstr)
143 cdecl ldap_init(str long) ldap_initA
144 cdecl ldap_initA(str long)
145 cdecl ldap_initW(wstr long)
146 cdecl ldap_memfreeA(ptr)
147 cdecl ldap_memfreeW(ptr)
148 cdecl ldap_modifyA(ptr str ptr)
149 cdecl ldap_modifyW(ptr wstr ptr)
150 cdecl ldap_modify_ext(ptr str ptr ptr ptr ptr) ldap_modify_extA
151 cdecl ldap_modify_extA(ptr str ptr ptr ptr ptr)
152 cdecl ldap_modify_extW(ptr wstr ptr ptr ptr ptr)
153 cdecl ldap_modify_ext_s(ptr str ptr ptr ptr) ldap_modify_ext_sA
154 cdecl ldap_modify_ext_sA(ptr str ptr ptr ptr)
155 cdecl ldap_modify_ext_sW(ptr wstr ptr ptr ptr)
156 cdecl ldap_modify_sA(ptr str ptr)
157 cdecl ldap_modify_sW(ptr wstr ptr)
158 cdecl ldap_modrdn2A(ptr str ptr long)
159 cdecl ldap_modrdn2W(ptr wstr ptr long)
160 cdecl ldap_modrdn2_sA(ptr str ptr long)
161 cdecl ldap_modrdn2_sW(ptr wstr ptr long)
162 cdecl ldap_modrdnA(ptr str ptr)
163 cdecl ldap_modrdnW(ptr wstr ptr)
164 cdecl ldap_modrdn_sA(ptr str ptr)
165 cdecl ldap_modrdn_sW(ptr wstr ptr)
166 cdecl ldap_next_attributeA(ptr ptr ptr)
167 cdecl ldap_next_attributeW(ptr ptr ptr)
168 cdecl ldap_next_reference(ptr ptr) WLDAP32_ldap_next_reference
169 cdecl ldap_openA(str long)
170 cdecl ldap_openW(wstr long)
171 cdecl ldap_parse_page_control(ptr ptr ptr ptr) ldap_parse_page_controlA
172 cdecl ldap_parse_page_controlA(ptr ptr ptr ptr)
173 cdecl ldap_parse_page_controlW(ptr ptr ptr ptr)
174 cdecl ldap_parse_reference(ptr ptr ptr) ldap_parse_referenceA
175 cdecl ldap_parse_referenceA(ptr ptr ptr)
176 cdecl ldap_parse_referenceW(ptr ptr ptr)
177 cdecl ldap_parse_result(ptr ptr ptr ptr ptr ptr ptr long) ldap_parse_resultA
178 cdecl ldap_parse_resultA(ptr ptr ptr ptr ptr ptr ptr long)
179 cdecl ldap_parse_resultW(ptr ptr ptr ptr ptr ptr ptr long)
180 cdecl ldap_parse_sort_control(ptr ptr ptr ptr) ldap_parse_sort_controlA
181 cdecl ldap_parse_sort_controlA(ptr ptr ptr ptr)
182 cdecl ldap_parse_sort_controlW(ptr ptr ptr ptr)
183 cdecl ldap_rename_ext(ptr str str str long ptr ptr ptr) ldap_rename_extA
184 cdecl ldap_rename_extA(ptr str str str long ptr ptr ptr)
185 cdecl ldap_rename_extW(ptr wstr wstr wstr long ptr ptr ptr)
186 cdecl ldap_rename_ext_s(ptr str str str long ptr ptr) ldap_rename_ext_sA
187 cdecl ldap_rename_ext_sA(ptr str str str long ptr ptr)
188 cdecl ldap_rename_ext_sW(ptr wstr wstr wstr long ptr ptr)
189 cdecl ldap_searchA(ptr str long str ptr long)
190 cdecl ldap_searchW(ptr wstr long wstr ptr long)
191 cdecl ldap_search_abandon_page(ptr ptr)
192 cdecl ldap_search_ext(ptr str long str ptr long ptr ptr long long ptr) ldap_search_extA
193 cdecl ldap_search_extA(ptr str long str ptr long ptr ptr long long ptr)
194 cdecl ldap_search_extW(ptr wstr long wstr ptr long ptr ptr long long ptr)
195 cdecl ldap_search_ext_s(ptr str long str ptr long ptr ptr ptr long ptr) ldap_search_ext_sA
196 cdecl ldap_search_ext_sA(ptr str long str ptr long ptr ptr ptr long ptr)
197 cdecl ldap_escape_filter_element(str long ptr long) ldap_escape_filter_elementA
198 stub ldap_set_dbg_flags
199 stub ldap_set_dbg_routine
200 cdecl ldap_memfree(ptr) ldap_memfreeA
201 cdecl ldap_startup(ptr ptr)
202 cdecl ldap_cleanup(long)
203 cdecl ldap_search_ext_sW(ptr wstr long wstr ptr long ptr ptr ptr long ptr)
204 cdecl ldap_search_init_page(ptr str long str ptr long ptr ptr long long ptr) ldap_search_init_pageA
205 cdecl ldap_search_init_pageA(ptr str long str ptr long ptr ptr long long ptr)
206 cdecl ldap_search_init_pageW(ptr wstr long wstr ptr long ptr ptr long long ptr)
207 cdecl ldap_search_sA(ptr str long str ptr long ptr)
208 cdecl ldap_search_sW(ptr wstr long wstr ptr long ptr)
209 cdecl ldap_search_stA(ptr str long str ptr long ptr ptr)
210 cdecl ldap_search_stW(ptr wstr long wstr ptr long ptr ptr)
211 cdecl ldap_set_option(ptr long ptr) ldap_set_optionA
212 cdecl ldap_set_optionA(ptr long ptr)
213 cdecl ldap_simple_bindA(ptr str str)
214 cdecl ldap_simple_bindW(ptr wstr wstr)
215 cdecl ldap_simple_bind_sA(ptr str str)
216 cdecl ldap_simple_bind_sW(ptr wstr wstr)
217 cdecl ldap_sslinit(str long long) ldap_sslinitA
218 cdecl ldap_sslinitA(str long long)
219 cdecl ldap_sslinitW(str long long)
220 cdecl ldap_ufn2dn(str ptr) ldap_ufn2dnA
221 cdecl ldap_ufn2dnA(str ptr)
222 cdecl ldap_ufn2dnW(wstr ptr)
223 cdecl ldap_value_freeA(ptr)
224 cdecl ldap_value_freeW(ptr)
230 cdecl ldap_check_filterA(ptr str)
231 cdecl ldap_check_filterW(ptr wstr)
232 cdecl ldap_dn2ufnA(str)
300 cdecl ber_init(ptr) WLDAP32_ber_init
301 cdecl ber_free(ptr long) WLDAP32_ber_free
302 cdecl ber_bvecfree(ptr) WLDAP32_ber_bvecfree
303 cdecl ber_bvdup(ptr) WLDAP32_ber_bvdup
304 cdecl ber_alloc_t(long) WLDAP32_ber_alloc_t
305 cdecl ber_skip_tag(ptr ptr) WLDAP32_ber_skip_tag
306 cdecl ber_peek_tag(ptr ptr) WLDAP32_ber_peek_tag
307 cdecl ber_first_element(ptr ptr ptr) WLDAP32_ber_first_element
308 cdecl ber_next_element(ptr ptr ptr) WLDAP32_ber_next_element
309 cdecl ber_flatten(ptr ptr) WLDAP32_ber_flatten
310 varargs ber_printf(ptr str) WLDAP32_ber_printf
311 varargs ber_scanf(ptr str) WLDAP32_ber_scanf
312 cdecl ldap_conn_from_msg(ptr ptr)
313 cdecl ldap_sasl_bindW(ptr wstr wstr ptr ptr ptr ptr)
314 cdecl ldap_sasl_bind_sW(ptr wstr wstr ptr ptr ptr ptr)
315 cdecl ldap_sasl_bindA(ptr str str ptr ptr ptr ptr)
316 cdecl ldap_sasl_bind_sA(ptr str str ptr ptr ptr ptr)
317 cdecl ldap_parse_extended_resultW(ptr ptr ptr ptr long)
318 cdecl ldap_parse_extended_resultA(ptr ptr ptr ptr long)
319 cdecl ldap_create_vlv_controlW(ptr ptr long ptr)
320 cdecl ldap_create_vlv_controlA(ptr ptr long ptr)
321 cdecl ldap_parse_vlv_controlW(ptr ptr ptr ptr ptr ptr)
322 cdecl ldap_parse_vlv_controlA(ptr ptr ptr ptr ptr ptr)
329 cdecl ldap_start_tls_sW(ptr ptr ptr ptr ptr)
330 cdecl ldap_start_tls_sA(ptr ptr ptr ptr ptr)
331 cdecl ldap_stop_tls_s(ptr)
332 cdecl ldap_extended_operation_sW(ptr wstr ptr ptr ptr ptr ptr)
333 cdecl ldap_extended_operation_sA(ptr str ptr ptr ptr ptr ptr)

View file

@ -0,0 +1,123 @@
/*
* German resources for WLDAP32
*
* Copyright 2005 Henning Gerhardt
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
0 "Erfolgreich"
1 "Operationsfehler"
2 "Protokollfehler"
3 "Zeitlimit überschritten"
4 "Größenlimit überschritten"
5 "Vergleich falsch"
6 "Vergleich wahr"
7 "Authentifizierungsmethode nicht unterstützt"
8 "Starke Authentifizierung erforderlich"
9 "Weiterleitung (v2)"
10 "Weiterleitung"
11 "Verwaltungslimit überschritten"
12 "Kritische Erweiterung nicht verfügbar"
13 "Vertraulichkeit erforderlich"
14 ""
15 ""
16 "Attribut nicht vorhanden"
17 "Nicht definierter Typ"
18 "Unzulässiger Vergleich"
19 "Restriktionsverletzung"
20 "Attribut oder Wert vorhanden"
21 "Ungültige Syntax"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Objekt nicht vorhanden"
33 "Aliasproblem"
34 "Ungültige DN Syntax"
35 "Endknoten"
36 "Alias Dereferenzierungsproblem"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Fehlerhafte Authentifizierung"
49 "Anmeldeinformationen fehlerhaft"
50 "Nicht ausreichende Rechte"
51 "Beschäftigt"
52 "Nicht verfügbar"
53 "Ausführung verweigert"
54 "Schleife erkannt"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Fehlende Sortiersteuerung"
61 "Indexbereichsfehler"
62 ""
63 ""
64 "Bennenungsverletzung"
65 "Objektklasse verletzt"
66 "Nicht erlaubt für Nicht-Endknoten"
67 "Nicht erlaubt für RDN"
68 "Bereits vorhanden"
69 "Keine Objektklassenmodifikationen"
70 "Ergebnisse zu groß"
71 "Mehrere DSAs betroffen"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Andere"
81 "Server heruntergefahren"
82 "Lokaler Fehler"
83 "Kodierungsfehler"
84 "Dekodierungsfehler"
85 "Zeitüberschreitung"
86 "Unbekannte Authentifizierung"
87 "Filterfehler"
88 "Benutzerabbruch"
89 "Parameterfehler"
90 "Nicht genügend Speicher"
91 "Kann nicht zum LDAP Server verbinden"
92 "Die Operation wird durch dieses LDAP Protokoll nicht unterstützt"
93 "Angegebenes Steuerobjekt wurde in der Meldung nicht gefunden"
94 "Keine Ergebnisse in der Meldung vorhanden"
95 "Weitere Ergebnisse gefunden"
96 "Schleife während der Abarbeitung von Weiterleitungen"
97 "Überschreitung der maximalen Anzahl von Weiterleitungen"
}

View file

@ -0,0 +1,123 @@
/*
* English resources for WLDAP32
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
0 "Success"
1 "Operations Error"
2 "Protocol Error"
3 "Time Limit Exceeded"
4 "Size Limit Exceeded"
5 "Compare False"
6 "Compare True"
7 "Authentication Method Not Supported"
8 "Strong Authentication Required"
9 "Referral (v2)"
10 "Referral"
11 "Administration Limit Exceeded"
12 "Unavailable Critical Extension"
13 "Confidentiality Required"
14 ""
15 ""
16 "No Such Attribute"
17 "Undefined Type"
18 "Inappropriate Matching"
19 "Constraint Violation"
20 "Attribute Or Value Exists"
21 "Invalid Syntax"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "No Such Object"
33 "Alias Problem"
34 "Invalid DN Syntax"
35 "Is Leaf"
36 "Alias Dereference Problem"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Inappropriate Authentication"
49 "Invalid Credentials"
50 "Insufficient Rights"
51 "Busy"
52 "Unavailable"
53 "Unwilling To Perform"
54 "Loop Detected"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Sort Control Missing"
61 "Index range error"
62 ""
63 ""
64 "Naming Violation"
65 "Object Class Violation"
66 "Not allowed on Non-leaf"
67 "Not allowed on RDN"
68 "Already Exists"
69 "No Object Class Mods"
70 "Results Too Large"
71 "Affects Multiple DSAs"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Other"
81 "Server Down"
82 "Local Error"
83 "Encoding Error"
84 "Decoding Error"
85 "Timeout"
86 "Auth Unknown"
87 "Filter Error"
88 "User Cancelled"
89 "Parameter Error"
90 "No Memory"
91 "Can't connect to the LDAP server"
92 "Operation not supported by this version of the LDAP protocol"
93 "Specified control was not found in message"
94 "No result present in message"
95 "More results returned"
96 "Loop while handling referrals"
97 "Referral hop limit exceeded"
}

View file

@ -0,0 +1,123 @@
/*
* Spanish resources for WLDAP32
*
* Copyright 2006 José Manuel Ferrer Ortiz
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
0 "Éxito"
1 "Error en operacioens"
2 "Error de protocolo"
3 "Límite de tiempo excedido"
4 "Límite de tamaño excedido"
5 "Comparación falsa"
6 "Comparación verdadera"
7 "Método de autentificación no soportado"
8 "Autentificación fuerte requerida"
9 "Remisión (v2)"
10 "Remisión"
11 "Límite de administración excedido"
12 "Extensión crítica no disponible"
13 "Confidencialidad requerida"
14 ""
15 ""
16 "No existe dicho atributo"
17 "Tipo no definido"
18 "Emparejamiento inapropiado"
19 "Violación de restricción"
20 "El valor o atributo ya existe"
21 "Sintaxis inválida"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "No existe dicho objeto"
33 "Problema de alias"
34 "Sintaxis inválida de DN"
35 "Es una hoja"
36 "Problema de dereferencia de alias"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Autentificación inapropriada"
49 "Credenciales inválidos"
50 "Insuficientes permisos"
51 "Ocupado"
52 "No disponible"
53 "Reacio a actuar"
54 "Bucle detectado"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Falta control de orden"
61 "Error de rango de índice"
62 ""
63 ""
64 "Violación de nomenclatura"
65 "Violación de clase de objeto"
66 "No permitido en una no-hoja"
67 "No permitido en RDN"
68 "Ya existe"
69 "No Mods de clase de objeto"
70 "Resultados demasiado largos"
71 "Afecta a múltiples DSAs"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Otro"
81 "Servidor caído"
82 "Error local"
83 "Error de codificación"
84 "Error de decodificación"
85 "Tiempo de espera superado"
86 "Autentificación desconocida"
87 "Error de filtro"
88 "Cancelado por el usuario"
89 "Error de parámetro"
90 "Sin memoria"
91 "No se ha podido conectar al servidor LDAP"
92 "Operación no soportada por esta versión del protocolo LDAP"
93 "Control especificado no se ha encontrado en el mensaje"
94 "Ningún resultado presente en el mensaje"
95 "Más resultados devueltos"
96 "Bucle al manejar remisiones"
97 "Límite de saltos de remisiones excedido"
}

View file

@ -0,0 +1,123 @@
/*
* French resources for WLDAP32
*
* Copyright 2005 Jonathan Ernst
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
0 "Succès"
1 "Erreur d'opération"
2 "Erreur de protocole"
3 "Limite de temps dépassée"
4 "Limite de taille dépassée"
5 "Comparaison Fausse"
6 "Comparaison Vraie"
7 "Méthode d'authentification non supportée"
8 "Authentification forte requise"
9 "Référant (v2)"
10 "Référant"
11 "Limite administrative dépassée"
12 "Extension critique indisponible"
13 "Confidentialité requise"
14 ""
15 ""
16 "Attribut inconnu"
17 "Type indéfini"
18 "Inappropriate Matching"
19 "Violation de contrainte"
20 "Attribut ou valeur existant"
21 "Syntaxe invalide"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Objet inconnu"
33 "Problème d'alias"
34 "Synatxe DN invalide"
35 "Est une feuille"
36 "Problème de déréférencement d'alias"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Authentification inappropriée"
49 "Droits invalides"
50 "Droits insuffisants"
51 "Occupé"
52 "Indisponible"
53 "Ne souhaite pas s'exécuter"
54 "Boucle détectée"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Contrôle de tri manquant"
61 "Erreur d'intervalle d'index"
62 ""
63 ""
64 "Violation de nomenclature"
65 "Violation de classe d'objet"
66 "Interdit sur des non-feuilles"
67 "Interdit sur RDN"
68 "Existe déjà"
69 "Pas de Mods de classe d'objet"
70 "Résultat trop grand"
71 "Affecte de multiple DSAs"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Autre"
81 "Serveur indisponible"
82 "Erreur locale"
83 "Erreur d'encodage"
84 "Erreur de décodage"
85 "Délai d'attente dépassé"
86 "Auth inconnue"
87 "Erreur de filtre"
88 "Annulation de l'utilisateur"
89 "Erreur de paramètre"
90 "Pas de mémoire"
91 "Impossible de se connecter au serveur LDAP"
92 "Opération non supportée par cette version du protocole LDAP"
93 "Le contrôle spécifié n'a pas été trouvé dans le message"
94 "Pas de résultat dans le message"
95 "Plusde résultats retournés"
96 "Boucle lors du traitement des référants"
97 "Limite du nombre de référents dépassée"
}

View file

@ -0,0 +1,123 @@
/*
* Korean resources for WLDAP32
*
* Copyright 2005 YunSong Hwang
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
0 "성공"
1 "작업 에러"
2 "프로토콜 에러"
3 "시간 제한 도달"
4 "크기 제한 도달"
5 "잘못된 비교"
6 "잘된 비교"
7 "인증방법은 지원하지 않습니다"
8 "강력한 인증이 요구됩니다"
9 "추천 (v2)"
10 "추천"
11 "관리 한도를 넘었습니다"
12 "치명적 확장은 가능하지 않습니다"
13 "기밀성이 요구됩니다"
14 ""
15 ""
16 "어떤 속성도 없습니다"
17 "정의되지 않은 타입"
18 "어울리지 않습니다"
19 "강제 위반"
20 "속성이나 값이 존재합니다"
21 "잘못된 문법"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "어떤 객체도 없음"
33 "Alias 문제"
34 "잘못된 DN 문법"
35 "이즈(IS) 리프(Leaf)"
36 "Alias 디레퍼런스 문제"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "부적절한 인증"
49 "잘못된 증명서"
50 "충분하지 않은 권리"
51 "바쁨"
52 "불가능"
53 "실행하는 것이 마음에 내키지 않습니다"
54 "루프가 발견되었습니다"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "정렬 제어가 빠졌습니다"
61 "인덱스 범위 에러"
62 ""
63 ""
64 "명명 위반"
65 "객체 클래스 위반"
66 "론-리프를 따를 수 없습니다"
67 "RDN은 따를수 없습니다"
68 "이미 존재합니다"
69 "어떤 객체 클래스 모드도 없숩니다"
70 "결과가 너무 큽니다"
71 "다양한 DSAs이 작용합니다."
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "다른 문제"
81 "서바 다운"
82 "로컬 에러"
83 "인코딩 에러"
84 "디코딩 에러"
85 "시간 초과"
86 "알수 없는 인증"
87 "필터 에러"
88 "사용자가 취소함"
89 "매개변수 에러"
90 "메모리 없음"
91 "LDAP 서버에 연결할수 없습니다"
92 " LDAP 프로토콜의 이 버젼은 그 작업을 지원하지 않습니다"
93 "지정된 제어는 메세지에서 발견할 수 없습니다"
94 "어떤 결과도 메세지에 존재하지 않습니다"
95 "더 많은 결과가 돌아왔습니다"
96 "리퍼럴을 다루는 동안의 루프"
97 "리퍼럴 홉 제한에 도달했습니다"
}

View file

@ -0,0 +1,123 @@
/*
* Dutch resources for WLDAP32
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
0 "Succes"
1 "Operationele fout"
2 "Protocolfout"
3 "Tijdlimiet overschreden"
4 "Maximum omvang overschreden"
5 "Vergelijking niet waar"
6 "Vergelijking waar"
7 "Authenticatiemethode wordt niet ondersteund"
8 "Sterke authenticatie vereist"
9 "Verwijzing (v2)"
10 "Verwijzing"
11 "Administratieve limiet overschreden"
12 "Kritieke extensie niet beschikbaar"
13 "Vertrouwelijkheid vereist"
14 ""
15 ""
16 "Attribuut bestaat niet"
17 "Ongedefiniëerd type"
18 "Foutieve vergelijking"
19 "Schending van restrictie"
20 "Attribuut of waarde bestaat"
21 "Ongeldige syntax"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Object bestaat niet"
33 "Aliasprobleem"
34 "Ongeldige DN syntax"
35 "Eindknoop"
36 "Alias volgprobleem"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Foutieve authenticatie"
49 "Ongeldige aanmeldingsgegevens"
50 "Onvoldoende rechten"
51 "Bezig"
52 "Niet beschikbaar"
53 "Uitvoering geweigerd"
54 "Cirkel gedetecteerd"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Besturingselement voor sorteren ontbreekt"
61 "Buiten indexbereik"
62 ""
63 ""
64 "Naamgevingsfout"
65 "Schending objectklassedefinitie"
66 "Niet toegestaan op niet-eindknopen"
67 "Niet toegestaan op RDN"
68 "Bestaat reeds"
69 "Geen objectklassemodificaties"
70 "Resultaten te groot"
71 "Betreft meerdere DSAs"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Anders"
81 "Server plat"
82 "Lokale fout"
83 "Codeerfout"
84 "Decodeerfout"
85 "Timeout"
86 "Onbekende authenticatiemethode"
87 "Filterfout"
88 "Afgebroken door gebruiker"
89 "Parameterfout"
90 "Onvoldoende geheugen"
91 "Kan geen verbinding maken met LDAP-server"
92 "Operatie niet ondersteund door deze versie van het LDAP-protocol"
93 "Opgegeven besturingselement niet gevonden in bericht"
94 "Geen resultaat aanwezig in bericht"
95 "Meer resultaten teruggekregen"
96 "Cirkel gevonden bij het verwerken van verwijzingen"
97 "Overschrijding van limiet op verwijzingen"
}

View file

@ -0,0 +1,123 @@
/*
* Norwegian Bokmål resources for WLDAP32
*
* Copyright 2005 Alexander N. Sørnes <alex@thehandofagony.com>
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL
STRINGTABLE DISCARDABLE
{
0 "Suksess"
1 "Operasjonsfeil"
2 "Protokollfeil"
3 "Tidsbegrensning overskredet"
4 "Størrelsesbegrensing overskredet"
5 "Sammenlikne usann"
6 "Sammenlikne sann"
7 "Autentiseringsmetoden støttes ikke"
8 "Sterk autentisering kreves"
9 "Henvisning (v2)"
10 "Henvisning"
11 "Administrasjonsbegrensing overskredet"
12 "Kritisk utvidelse utilgjengelig"
13 "Krever konfidensialitet"
14 ""
15 ""
16 "Ingen sånn attributt"
17 "Udefinert type"
18 "Upassende sammenlikning"
19 "Pressovertredelse"
20 "Attributt eller verdi finnes allerede"
21 "Ugyldig syntaks"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Ikke noe sånt objekt"
33 "Alias-problem"
34 "Ugyldig DN-syntaks"
35 "Er blad"
36 "Problem med alias-dereferanse"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Upassende autentisering"
49 "Ugyldige kreditiver"
50 "Manglende rettigheter"
51 "Opptatt"
52 "Utilgjengelig"
53 "Uvillig til å utføre"
54 "Løkke oppdaget"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Sorteringskontroller mangler"
61 "Feil med indeksrekkevidde"
62 ""
63 ""
64 "Navngivingsovertredelse"
65 "Objektklasseovertredelse"
66 "Ikke tillatt på ikke-blad"
67 "Ikke tillatt på RDN"
68 "Finnes allerede"
69 "Ingen objektklassemodifiserere"
70 "Resultatene er for store"
71 "Berører flere DSA'er"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Annen"
81 "Tjener nede"
82 "Lokal feil"
83 "Kodingsfeil"
84 "Dekodingsfeil"
85 "Tidsavbrudd"
86 "Ukjent autentisering"
87 "Filterfeil"
88 "Bruker avbrøt"
89 "Parameterfeil"
90 "Intet minne"
91 "Kunne ikke koble til LDAP-tjeneren"
92 "Operasjonen støttes ikke av denne versjonen av LDAP-protokollen"
93 "Den oppgitte kontrolleren ble ikke funnet i meldingen"
94 "Ingen resultater i melding"
95 "Flere resultater returnert"
96 "Løkke under håndtering av henvisninger"
97 "Grense for henvisningshopp overskredet"
}

View file

@ -0,0 +1,123 @@
/*
* Russian resources for WLDAP32
*
* Copyright 2005 Dmitry Timoshkov
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
0 "Успех"
1 "Ошибка операции"
2 "Ошибка протокола"
3 "Превышено ограничение по времени"
4 "Превышено ограничение по размеру"
5 "Сравнение неверно"
6 "Сравнение верно"
7 "Метод авторизации не поддерживается"
8 "Требуется строгая авторизация"
9 "Ссылка (v2)"
10 "Ссылка"
11 "Превышено ограничение администрирования"
12 "Критическое расширение недоступно"
13 "Требуется конфиденциальность"
14 ""
15 ""
16 "Нет такого атрибута"
17 "Неопределенный тип"
18 "Неподходящее соответствие"
19 "Нарушение ограничения"
20 "Атрибут или значение существует"
21 "Неверный синтаксис"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Нет такого объекта"
33 "Проблема с псевдонимом"
34 "Неверный DN синтаксис"
35 "Это лист дерева"
36 "Проблема обращения по псевдониму"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Неподходящая авторизация"
49 "Неверное удостоверение личности"
50 "Недостаточно прав"
51 "Занято"
52 "Недоступно"
53 "Не желает выполнить"
54 "Обнаружено зацикливание"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Отсутствует управление сортировкой"
61 "Ошибка диапазона индекса"
62 ""
63 ""
64 "Нарушение правил наименования"
65 "Нарушение класса объекта"
66 "Не разрешено не на листе дерева"
67 "Не разрешено на RDN"
68 "Уже существует"
69 "Нет режимов класса объекта"
70 "Результаты слишком велики"
71 "Влияет на несколько DSA"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Другой"
81 "Сервер недоступен"
82 "Локальная ошибка"
83 "Ошибка кодирования"
84 "Ошибка декодирования"
85 "Тайм-аут"
86 "Неизвестная авторизация"
87 "Ошибка фильтра"
88 "Отменено пользователем"
89 "Ошибка параметра"
90 "Нет памяти"
91 "Невозможно подключиться к LDAP серверу"
92 "Операция не поддерживается этой версией протокола LDAP"
93 "Указанный управляющий элемент не найден в сообщении"
94 "Результата нет в сообщении"
95 "Еще есть результаты"
96 "Зацикливание при обработке ссылок"
97 "Предел числа пересылки ссылок превышен"
}

View file

@ -0,0 +1,123 @@
/*
* Turkish resources for WLDAP32
*
* Copyright 2006 Fatih Aşıcı
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
0 "Başarılı"
1 "İşlem Hatası"
2 "İletişim Kuralı Hatası"
3 "Zaman Sınırııldı"
4 "Boyut Sınırııldı"
5 "Karşılaştırma Yanlış"
6 "Karşılaştırma Doğru"
7 "Yetkilendirme Yöntemi Desteklenmiyor"
8 "Güçlü Yerkilendirme Gerekli"
9 "Başvuru (v2)"
10 "Başvuru"
11 "Yönetim Sınırııldı"
12 "Kullanılabilir Olmayan Kritik Uzantı"
13 "Gizli Olarak Gerekli"
14 ""
15 ""
16 "Böyle Bir Öznitelik Yok"
17 "Tanımlanmamış Tür"
18 "Uygunsuz Eşleşme"
19 "Kısıtlama İhlali"
20 "Varolan Öznitelik Veya Değer"
21 "Geçersiz Sözdizimi"
22 ""
23 ""
24 ""
25 ""
26 ""
27 ""
28 ""
29 ""
30 ""
31 ""
32 "Böyle Bir Nesne Yok"
33 "Takma Ad Sorunu"
34 "Geçersiz DN Sözdizimi"
35 "Yaprak Konumunda"
36 "Takma Ad Başvuru Sorunu"
37 ""
38 ""
39 ""
40 ""
41 ""
42 ""
43 ""
44 ""
45 ""
46 ""
47 ""
48 "Uygunsuz Yetkilendirme"
49 "Geçersiz Belgeler"
50 "Geçersiz Yetkiler"
51 "Meşgul"
52 "Kullanılabilir Değil"
53 "Yürütmeye İsteksiz"
54 "Döngü Algılandı"
55 ""
56 ""
57 ""
58 ""
59 ""
60 "Sıralama Denetimi Eksik"
61 "Eksik Dizin Aralığı Hatası"
62 ""
63 ""
64 "Adlandırma İhlali"
65 "Nesne Sınıfı İhlali"
66 "Yaprak olmayan konumda izinli değil"
67 "RDN üzerinde izin verilmiyor"
68 "Zaten Var"
69 "Nesne Sınıfı Modülleri Yok"
70 "Sonuçlar Çok Büyük"
71 "Birden Fazla DSA Etkilenir"
72 ""
73 ""
74 ""
75 ""
76 ""
77 ""
78 ""
79 ""
80 "Diğer"
81 "Sunucu Kapalı"
82 "Yerel Hata"
83 "Kodlama Hatası"
84 "Kod Çözme Hatası"
85 "Zaman Aşımı"
86 "Yazar Bilinmiyor"
87 "Süzme Hatası"
88 "Kullanıcı İptal Etti"
89 "Parametre Hatası"
90 "Bellek Yok"
91 "LDAP sunucusuna bağlanamıyor"
92 "İşlem LDAP iletişim kuralının bu sürümünce desteklenmiyor."
93 "İletide belirtilen denetim bulunamadı"
94 "İletide sonuç yok"
95 "Dönen diğer sonuçlar"
96 "Başvuruları işlerken dön"
97 "Paketin gönderildiği yönlendirici sınırııldı"
}