Commit 0fad7e1f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

Implement ldap_parse_extended_result{A,W}, ldap_parse_reference{A,W},

ldap_parse_result{A,W}, ldap_parse_sort_control{A,W} and ldap_parse_vlv_control{A,W}. Stub implementations for ldap_parse_page_control{A,W}.
parent 43284a51
......@@ -23,6 +23,7 @@ C_SRCS = \
modify.c \
modrdn.c \
option.c \
parse.c \
rename.c \
search.c \
value.c
......
/*
* WLDAP32 - LDAP support for Wine
*
* Copyright 2005 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#ifdef HAVE_LDAP_H
#include <ldap.h>
#else
#define LDAP_NOT_SUPPORTED 0x5c
#endif
#include "winldap_private.h"
#include "wldap32.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
ULONG 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;
}
ULONG 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;
}
ULONG ldap_parse_page_controlA( WLDAP32_LDAP *ld, PLDAPControlA *serverctrls,
ULONG *count, struct WLDAP32_berval **cookie )
{
FIXME( "(%p, %p, %p, %p)\n", ld, serverctrls, count, cookie );
if (!ld) return ~0UL;
return LDAP_NOT_SUPPORTED;
}
ULONG ldap_parse_page_controlW( WLDAP32_LDAP *ld, PLDAPControlW *serverctrls,
ULONG *count, struct WLDAP32_berval **cookie )
{
FIXME( "(%p, %p, %p, %p)\n", ld, serverctrls, count, cookie );
if (!ld) return ~0UL;
return LDAP_NOT_SUPPORTED;
}
ULONG 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;
}
ULONG ldap_parse_referenceW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message,
PWCHAR **referrals )
{
ULONG ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
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;
}
ULONG 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;
}
ULONG 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;
}
ULONG 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;
}
ULONG 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;
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, result, &attrU );
*attr = strUtoW( attrU );
controlarrayfreeU( controlU );
#endif
return ret;
}
int ldap_parse_vlv_controlA( WLDAP32_LDAP *ld, LDAPControlA **control,
unsigned long *targetpos, unsigned long *listcount,
struct WLDAP32_berval **context, int *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;
}
int ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, LDAPControlW **control,
unsigned long *targetpos, unsigned long *listcount,
struct WLDAP32_berval **context, int *errcode )
{
int ret = LDAP_NOT_SUPPORTED;
#ifdef HAVE_LDAP
LDAPControl **controlU = NULL;
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, targetpos, listcount,
(struct berval **)context, errcode );
controlarrayfreeU( controlU );
#endif
return ret;
}
......@@ -158,18 +158,18 @@
168 cdecl ldap_next_reference(ptr ptr) WLDAP32_ldap_next_reference
169 cdecl ldap_openA(str long)
170 cdecl ldap_openW(wstr long)
171 stub ldap_parse_page_control
172 stub ldap_parse_page_controlA
173 stub ldap_parse_page_controlW
174 stub ldap_parse_reference
175 stub ldap_parse_referenceA
176 stub ldap_parse_referenceW
177 stub ldap_parse_result
178 stub ldap_parse_resultA
179 stub ldap_parse_resultW
180 stub ldap_parse_sort_control
181 stub ldap_parse_sort_controlA
182 stub ldap_parse_sort_controlW
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)
......@@ -232,12 +232,12 @@
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 stub ldap_parse_extended_resultW
318 stub ldap_parse_extended_resultA
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 stub ldap_parse_vlv_controlW
322 stub ldap_parse_vlv_controlA
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment