Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d08d6f51
Commit
d08d6f51
authored
Sep 20, 2022
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Use the bundled liblber and libldap.
parent
17021e53
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1051 additions
and
2326 deletions
+1051
-2326
configure
configure
+26
-172
configure.ac
configure.ac
+1
-28
Makefile.in
dlls/wldap32/Makefile.in
+2
-5
add.c
dlls/wldap32/add.c
+6
-9
ber.c
dlls/wldap32/ber.c
+82
-80
bind.c
dlls/wldap32/bind.c
+75
-72
compare.c
dlls/wldap32/compare.c
+12
-15
control.c
dlls/wldap32/control.c
+13
-21
delete.c
dlls/wldap32/delete.c
+4
-7
dn.c
dlls/wldap32/dn.c
+14
-37
error.c
dlls/wldap32/error.c
+66
-25
extended.c
dlls/wldap32/extended.c
+16
-18
init.c
dlls/wldap32/init.c
+4
-10
libldap.c
dlls/wldap32/libldap.c
+0
-683
libldap.h
dlls/wldap32/libldap.h
+0
-624
main.c
dlls/wldap32/main.c
+0
-6
misc.c
dlls/wldap32/misc.c
+42
-79
modify.c
dlls/wldap32/modify.c
+6
-9
modrdn.c
dlls/wldap32/modrdn.c
+3
-6
option.c
dlls/wldap32/option.c
+32
-48
page.c
dlls/wldap32/page.c
+17
-17
parse.c
dlls/wldap32/parse.c
+37
-51
rename.c
dlls/wldap32/rename.c
+5
-7
search.c
dlls/wldap32/search.c
+25
-30
ber.c
dlls/wldap32/tests/ber.c
+1
-1
value.c
dlls/wldap32/value.c
+17
-23
winldap_private.h
dlls/wldap32/winldap_private.h
+545
-231
config.h.in
include/config.h.in
+0
-12
No files found.
configure
View file @
d08d6f51
...
...
@@ -652,8 +652,6 @@ ac_header_c_list=
ac_subst_vars
=
'LTLIBOBJS
LIBOBJS
TAGSFLAGS
LDAP_LIBS
LDAP_CFLAGS
RT_LIBS
DELAYLOADFLAG
MSVCRTFLAGS
...
...
@@ -723,6 +721,8 @@ PNG_PE_LIBS
PNG_PE_CFLAGS
MPG123_PE_LIBS
MPG123_PE_CFLAGS
LDAP_PE_LIBS
LDAP_PE_CFLAGS
LCMS2_PE_LIBS
LCMS2_PE_CFLAGS
JXR_PE_LIBS
...
...
@@ -921,7 +921,6 @@ with_gssapi
with_gstreamer
with_inotify
with_krb5
with_ldap
with_mingw
with_netapi
with_opencl
...
...
@@ -1714,6 +1713,8 @@ JXR_PE_CFLAGS
JXR_PE_LIBS
LCMS2_PE_CFLAGS
LCMS2_PE_LIBS
LDAP_PE_CFLAGS
LDAP_PE_LIBS
MPG123_PE_CFLAGS
MPG123_PE_LIBS
PNG_PE_CFLAGS
...
...
@@ -1767,9 +1768,7 @@ KRB5_LIBS
GSSAPI_CFLAGS
GSSAPI_LIBS
NETAPI_CFLAGS
NETAPI_LIBS
LDAP_CFLAGS
LDAP_LIBS'
NETAPI_LIBS'
# Initialize some variables set by options.
...
...
@@ -2428,7 +2427,6 @@ Optional Packages:
--without-gstreamer do not use GStreamer (codecs support)
--without-inotify do not use inotify (filesystem change notifications)
--without-krb5 do not use krb5 (Kerberos)
--without-ldap do not use LDAP
--without-mingw do not use the MinGW cross-compiler
--without-netapi do not use the Samba NetAPI library
--without-opencl do not use OpenCL
...
...
@@ -2496,6 +2494,10 @@ Some influential environment variables:
version
LCMS2_PE_LIBS
Linker flags for the PE lcms2, overriding the bundled version
LDAP_PE_CFLAGS
C compiler flags for the PE ldap, overriding the bundled version
LDAP_PE_LIBS
Linker flags for the PE ldap, overriding the bundled version
MPG123_PE_CFLAGS
C compiler flags for the PE mpg123, overriding the bundled
version
...
...
@@ -2585,8 +2587,6 @@ Some influential environment variables:
NETAPI_CFLAGS
C compiler flags for netapi, overriding pkg-config
NETAPI_LIBS Linker flags for netapi, overriding pkg-config
LDAP_CFLAGS C compiler flags for openldap, overriding pkg-config
LDAP_LIBS Linker flags for openldap, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
...
...
@@ -4281,13 +4281,6 @@ then :
fi
# Check whether --with-ldap was given.
if
test
${
with_ldap
+y
}
then
:
withval
=
$with_ldap
;
if
test
"x
$withval
"
=
"xno"
;
then
ac_cv_header_ldap_h
=
no
;
ac_cv_header_lber_h
=
no
;
fi
fi
# Check whether --with-mingw was given.
if
test
${
with_mingw
+y
}
then
:
...
...
@@ -8130,12 +8123,6 @@ then :
printf
"%s
\n
"
"#define HAVE_PWD_H 1"
>>
confdefs.h
fi
ac_fn_c_check_header_compile
"
$LINENO
"
"sasl/sasl.h"
"ac_cv_header_sasl_sasl_h"
"
$ac_includes_default
"
if
test
"x
$ac_cv_header_sasl_sasl_h
"
=
xyes
then
:
printf
"%s
\n
"
"#define HAVE_SASL_SASL_H 1"
>>
confdefs.h
fi
ac_fn_c_check_header_compile
"
$LINENO
"
"sched.h"
"ac_cv_header_sched_h"
"
$ac_includes_default
"
if
test
"x
$ac_cv_header_sched_h
"
=
xyes
then
:
...
...
@@ -13409,6 +13396,21 @@ fi
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: lcms2 cflags:
$LCMS2_PE_CFLAGS
"
>
&5
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: lcms2 libs:
$LCMS2_PE_LIBS
"
>
&5
if
${
LDAP_PE_LIBS
:+false
}
:
then
:
LDAP_PE_LIBS
=
ldap
if
${
LDAP_PE_CFLAGS
:+false
}
:
then
:
LDAP_PE_CFLAGS
=
"-I
\$
(top_srcdir)/libs/ldap/include"
else
$as_nop
enable_ldap
=
no
fi
else
$as_nop
enable_ldap
=
no
fi
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: ldap cflags:
$LDAP_PE_CFLAGS
"
>
&5
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: ldap libs:
$LDAP_PE_LIBS
"
>
&5
if
${
MPG123_PE_LIBS
:+false
}
:
then
:
MPG123_PE_LIBS
=
mpg123
...
...
@@ -20077,154 +20079,6 @@ fi
;;
esac
if
test
"x
$with_ldap
"
!=
"xno"
then
if
${
LDAP_CFLAGS
:+false
}
:
then
:
if
test
${
PKG_CONFIG
+y
}
then
:
LDAP_CFLAGS
=
`
$PKG_CONFIG
--cflags
openldap 2>/dev/null
`
fi
fi
if
${
LDAP_LIBS
:+false
}
:
then
:
if
test
${
PKG_CONFIG
+y
}
then
:
LDAP_LIBS
=
`
$PKG_CONFIG
--libs
openldap 2>/dev/null
`
fi
fi
LDAP_LIBS
=
${
LDAP_LIBS
:-
"-lldap -llber"
}
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: openldap cflags:
$LDAP_CFLAGS
"
>
&5
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: openldap libs:
$LDAP_LIBS
"
>
&5
ac_save_CPPFLAGS
=
$CPPFLAGS
CPPFLAGS
=
"
$CPPFLAGS
$LDAP_CFLAGS
"
ac_fn_c_check_header_compile
"
$LINENO
"
"ldap.h"
"ac_cv_header_ldap_h"
"
$ac_includes_default
"
if
test
"x
$ac_cv_header_ldap_h
"
=
xyes
then
:
printf
"%s
\n
"
"#define HAVE_LDAP_H 1"
>>
confdefs.h
fi
ac_fn_c_check_header_compile
"
$LINENO
"
"lber.h"
"ac_cv_header_lber_h"
"
$ac_includes_default
"
if
test
"x
$ac_cv_header_lber_h
"
=
xyes
then
:
printf
"%s
\n
"
"#define HAVE_LBER_H 1"
>>
confdefs.h
fi
if
test
"
$ac_cv_header_ldap_h
"
=
"yes"
-a
"
$ac_cv_header_lber_h
"
=
"yes"
then
ac_fn_c_check_type
"
$LINENO
"
"LDAPSortKey"
"ac_cv_type_LDAPSortKey"
"#include <ldap.h>
"
if
test
"x
$ac_cv_type_LDAPSortKey
"
=
xyes
then
:
{
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for ldap_initialize in -lldap"
>
&5
printf
%s
"checking for ldap_initialize in -lldap... "
>
&6
;
}
if
test
${
ac_cv_lib_ldap_ldap_initialize
+y
}
then
:
printf
%s
"(cached) "
>
&6
else
$as_nop
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-lldap
$PTHREAD_LIBS
$LDAP_LIBS
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char ldap_initialize ();
int
main (void)
{
return ldap_initialize ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
then
:
ac_cv_lib_ldap_ldap_initialize
=
yes
else
$as_nop
ac_cv_lib_ldap_ldap_initialize
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.beam
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_ldap_ldap_initialize
"
>
&5
printf
"%s
\n
"
"
$ac_cv_lib_ldap_ldap_initialize
"
>
&6
;
}
if
test
"x
$ac_cv_lib_ldap_ldap_initialize
"
=
xyes
then
:
{
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for ber_init in -llber"
>
&5
printf
%s
"checking for ber_init in -llber... "
>
&6
;
}
if
test
${
ac_cv_lib_lber_ber_init
+y
}
then
:
printf
%s
"(cached) "
>
&6
else
$as_nop
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-llber
$PTHREAD_LIBS
$LDAP_LIBS
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char ber_init ();
int
main (void)
{
return ber_init ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
then
:
ac_cv_lib_lber_ber_init
=
yes
else
$as_nop
ac_cv_lib_lber_ber_init
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.beam
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_lber_ber_init
"
>
&5
printf
"%s
\n
"
"
$ac_cv_lib_lber_ber_init
"
>
&6
;
}
if
test
"x
$ac_cv_lib_lber_ber_init
"
=
xyes
then
:
printf
"%s
\n
"
"#define HAVE_LDAP 1"
>>
confdefs.h
else
$as_nop
LDAP_LIBS
=
""
fi
else
$as_nop
LDAP_LIBS
=
""
fi
else
$as_nop
LDAP_LIBS
=
""
fi
else
LDAP_LIBS
=
""
fi
CPPFLAGS
=
$ac_save_CPPFLAGS
fi
if
test
"x
$LDAP_LIBS
"
=
"x"
then
:
case
"x
$with_ldap
"
in
x
)
as_fn_append wine_notices
"|libldap (OpenLDAP)
${
notice_platform
}
development files not found, LDAP won't be supported."
;;
xno
)
;;
*
)
as_fn_error
$?
"libldap (OpenLDAP)
${
notice_platform
}
development files not found, LDAP won't be supported.
This is an error since --with-ldap was requested."
"
$LINENO
"
5
;;
esac
fi
{
printf
"%s
\n
"
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for sched_setaffinity"
>
&5
printf
%s
"checking for sched_setaffinity... "
>
&6
;
}
if
test
${
wine_cv_have_sched_setaffinity
+y
}
...
...
@@ -23316,6 +23170,8 @@ JXR_PE_CFLAGS = $JXR_PE_CFLAGS
JXR_PE_LIBS =
$JXR_PE_LIBS
LCMS2_PE_CFLAGS =
$LCMS2_PE_CFLAGS
LCMS2_PE_LIBS =
$LCMS2_PE_LIBS
LDAP_PE_CFLAGS =
$LDAP_PE_CFLAGS
LDAP_PE_LIBS =
$LDAP_PE_LIBS
MPG123_PE_CFLAGS =
$MPG123_PE_CFLAGS
MPG123_PE_LIBS =
$MPG123_PE_LIBS
PNG_PE_CFLAGS =
$PNG_PE_CFLAGS
...
...
@@ -23385,8 +23241,6 @@ NETAPI_LIBS = $NETAPI_LIBS
MSVCRTFLAGS =
$MSVCRTFLAGS
DELAYLOADFLAG =
$DELAYLOADFLAG
RT_LIBS =
$RT_LIBS
LDAP_CFLAGS =
$LDAP_CFLAGS
LDAP_LIBS =
$LDAP_LIBS
TAGSFLAGS =
$TAGSFLAGS
LIBOBJS =
$LIBOBJS
LTLIBOBJS =
$LTLIBOBJS
...
...
configure.ac
View file @
d08d6f51
...
...
@@ -42,8 +42,6 @@ AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Ker
AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)]))
AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (filesystem change notifications)]))
AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)]))
AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]),
[if test "x$withval" = "xno"; then ac_cv_header_ldap_h=no; ac_cv_header_lber_h=no; fi])
AC_ARG_WITH(mingw, AS_HELP_STRING([--without-mingw],[do not use the MinGW cross-compiler]))
AC_ARG_WITH(netapi, AS_HELP_STRING([--without-netapi],[do not use the Samba NetAPI library]))
AC_ARG_WITH(opencl, AS_HELP_STRING([--without-opencl],[do not use OpenCL]),
...
...
@@ -456,7 +454,6 @@ AC_CHECK_HEADERS(\
port.h \
pthread.h \
pwd.h \
sasl/sasl.h \
sched.h \
scsi/scsi.h \
scsi/scsi_ioctl.h \
...
...
@@ -1183,6 +1180,7 @@ WINE_EXTLIB_FLAGS(GSM, gsm, gsm, "-I\$(top_srcdir)/libs/gsm/inc")
WINE_EXTLIB_FLAGS(JPEG, jpeg, jpeg, "-I\$(top_srcdir)/libs/jpeg")
WINE_EXTLIB_FLAGS(JXR, jxr, jxr, "-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys")
WINE_EXTLIB_FLAGS(LCMS2, lcms2, lcms2, "-I\$(top_srcdir)/libs/lcms2/include")
WINE_EXTLIB_FLAGS(LDAP, ldap, ldap, "-I\$(top_srcdir)/libs/ldap/include")
WINE_EXTLIB_FLAGS(MPG123, mpg123, mpg123, "-I\$(top_srcdir)/libs/mpg123/src/libmpg123")
WINE_EXTLIB_FLAGS(PNG, png, "png \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/png")
WINE_EXTLIB_FLAGS(TIFF, tiff, "tiff \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/tiff/libtiff")
...
...
@@ -2078,31 +2076,6 @@ case $host_os in
;;
esac
dnl **** Check for OpenLDAP ***
if test "x$with_ldap" != "xno"
then
dnl Actually there's no pkg-config support for ldap, but this way we can still override the flags
WINE_PACKAGE_FLAGS(LDAP,[openldap],[-lldap -llber],,,
[AC_CHECK_HEADERS([ldap.h lber.h])
if test "$ac_cv_header_ldap_h" = "yes" -a "$ac_cv_header_lber_h" = "yes"
then
AC_CHECK_TYPE(LDAPSortKey,
[AC_CHECK_LIB(ldap, ldap_initialize,
[AC_CHECK_LIB(lber, ber_init,
[AC_DEFINE(HAVE_LDAP, 1, [Define if you have the OpenLDAP development environment])],
[LDAP_LIBS=""],
[$PTHREAD_LIBS $LDAP_LIBS])],
[LDAP_LIBS=""],
[$PTHREAD_LIBS $LDAP_LIBS])],
[LDAP_LIBS=""],
[#include <ldap.h>])
else
LDAP_LIBS=""
fi])
fi
WINE_NOTICE_WITH(ldap,[test "x$LDAP_LIBS" = "x"],
[libldap (OpenLDAP) ${notice_platform}development files not found, LDAP won't be supported.])
AC_CACHE_CHECK([for sched_setaffinity],wine_cv_have_sched_setaffinity,
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <sched.h>]], [[sched_setaffinity(0, 0, 0);]])],[wine_cv_have_sched_setaffinity=yes],[wine_cv_have_sched_setaffinity=no]))
...
...
dlls/wldap32/Makefile.in
View file @
d08d6f51
MODULE
=
wldap32.dll
UNIXLIB
=
wldap32.so
IMPORTLIB
=
wldap32
IMPORTS
=
user32
UNIX_CFLAGS
=
$(LDAP_CFLAGS)
UNIX_LIBS
=
$(LDAP_LIBS)
IMPORTS
=
$(LDAP_PE_LIBS)
secur32 ws2_32 user32
EXTRAINCL
=
$(LDAP_PE_CFLAGS)
C_SRCS
=
\
add.c
\
...
...
@@ -16,7 +14,6 @@ C_SRCS = \
error.c
\
extended.c
\
init.c
\
libldap.c
\
main.c
\
misc.c
\
modify.c
\
...
...
dlls/wldap32/add.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -105,8 +104,8 @@ ULONG CDECL ldap_add_extW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW *
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPMod
U
**
attrsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPMod
**
attrsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
attrs
,
serverctrls
,
clientctrls
,
message
);
...
...
@@ -118,8 +117,7 @@ ULONG CDECL ldap_add_extW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW *
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_add_ext_params
params
=
{
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_add_ext
,
&
params
));
ret
=
map_error
(
ldap_add_ext
(
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
...
...
@@ -168,8 +166,8 @@ ULONG CDECL ldap_add_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPMod
U
**
attrsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPMod
**
attrsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
attrs
,
serverctrls
,
clientctrls
);
...
...
@@ -181,8 +179,7 @@ ULONG CDECL ldap_add_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_add_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_add_ext_s
,
&
params
));
ret
=
map_error
(
ldap_add_ext_s
(
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
)
);
}
exit:
...
...
dlls/wldap32/ber.c
View file @
d08d6f51
...
...
@@ -23,8 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "winber.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -37,17 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
WLDAP32_BerElement
*
CDECL
WLDAP32_ber_alloc_t
(
int
options
)
{
WLDAP32_BerElement
*
ret
;
struct
ber_alloc_t_params
params
;
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
params
.
options
=
options
;
params
.
ret
=
(
void
**
)
&
BER
(
ret
);
if
(
LDAP_CALL
(
ber_alloc_t
,
&
params
))
{
TRACE
(
"%d
\n
"
,
options
);
if
(
options
!=
WLDAP32_LBER_USE_DER
||
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
((
ret
->
opaque
=
(
char
*
)
ber_alloc_t
(
options
)))
return
ret
;
free
(
ret
);
return
NULL
;
}
return
ret
;
}
/***********************************************************************
...
...
@@ -55,6 +49,7 @@ WLDAP32_BerElement * CDECL WLDAP32_ber_alloc_t( int options )
*/
BERVAL
*
CDECL
WLDAP32_ber_bvdup
(
BERVAL
*
berval
)
{
TRACE
(
"%p
\n
"
,
berval
);
return
bervalWtoW
(
berval
);
}
...
...
@@ -63,6 +58,7 @@ BERVAL * CDECL WLDAP32_ber_bvdup( BERVAL *berval )
*/
void
CDECL
WLDAP32_ber_bvecfree
(
BERVAL
**
berval
)
{
TRACE
(
"%p
\n
"
,
berval
);
bvarrayfreeW
(
berval
);
}
...
...
@@ -71,6 +67,7 @@ void CDECL WLDAP32_ber_bvecfree( BERVAL **berval )
*/
void
CDECL
WLDAP32_ber_bvfree
(
BERVAL
*
berval
)
{
TRACE
(
"berval
\n
"
);
free
(
berval
);
}
...
...
@@ -79,8 +76,8 @@ void CDECL WLDAP32_ber_bvfree( BERVAL *berval )
*/
ULONG
CDECL
WLDAP32_ber_first_element
(
WLDAP32_BerElement
*
ber
,
ULONG
*
len
,
char
**
opaque
)
{
struct
ber_first_element_params
params
=
{
BER
(
ber
),
(
unsigned
int
*
)
len
,
opaque
}
;
return
LDAP_CALL
(
ber_first_element
,
&
params
);
TRACE
(
"%p, %p, %p
\n
"
,
ber
,
len
,
opaque
)
;
return
ber_first_element
(
BER
(
ber
),
len
,
opaque
);
}
/***********************************************************************
...
...
@@ -88,15 +85,14 @@ ULONG CDECL WLDAP32_ber_first_element( WLDAP32_BerElement *ber, ULONG *len, char
*/
int
CDECL
WLDAP32_ber_flatten
(
WLDAP32_BerElement
*
ber
,
BERVAL
**
berval
)
{
struct
bervalU
*
bervalU
;
struct
berval
*
bervalW
;
struct
ber_flatten_params
params
=
{
BER
(
ber
),
&
bervalU
};
struct
berval
*
bervalU
;
struct
WLDAP32_berval
*
bervalW
;
if
(
LDAP_CALL
(
ber_flatten
,
&
params
))
return
WLDAP32_LBER_ERROR
;
TRACE
(
"%p, %p
\n
"
,
ber
,
berval
)
;
if
(
ber_flatten
(
BER
(
ber
),
&
bervalU
))
return
WLDAP32_LBER_ERROR
;
if
(
!
(
bervalW
=
bervalUtoW
(
bervalU
)))
return
WLDAP32_LBER_ERROR
;
LDAP_CALL
(
ber_bvfree
,
bervalU
);
if
(
!
bervalW
)
return
WLDAP32_LBER_ERROR
;
ber_bvfree
(
bervalU
);
*
berval
=
bervalW
;
return
0
;
}
...
...
@@ -106,8 +102,8 @@ int CDECL WLDAP32_ber_flatten( WLDAP32_BerElement *ber, BERVAL **berval )
*/
void
CDECL
WLDAP32_ber_free
(
WLDAP32_BerElement
*
ber
,
int
freebuf
)
{
struct
ber_free_params
params
=
{
BER
(
ber
),
freebuf
}
;
LDAP_CALL
(
ber_free
,
&
params
);
TRACE
(
"%p, %d
\n
"
,
ber
,
freebuf
)
;
ber_free
(
BER
(
ber
),
freebuf
);
free
(
ber
);
}
...
...
@@ -116,9 +112,11 @@ void CDECL WLDAP32_ber_free( WLDAP32_BerElement *ber, int freebuf )
*/
WLDAP32_BerElement
*
CDECL
WLDAP32_ber_init
(
BERVAL
*
berval
)
{
struct
berval
U
*
bervalU
;
struct
berval
*
bervalU
;
WLDAP32_BerElement
*
ret
;
struct
ber_init_params
params
;
BerElement
*
ber
;
TRACE
(
"%p
\n
"
,
berval
);
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
bervalU
=
bervalWtoU
(
berval
)))
...
...
@@ -126,15 +124,12 @@ WLDAP32_BerElement * CDECL WLDAP32_ber_init( BERVAL *berval )
free
(
ret
);
return
NULL
;
}
params
.
berval
=
bervalU
;
params
.
ret
=
(
void
**
)
&
BER
(
ret
);
if
(
LDAP_CALL
(
ber_init
,
&
params
))
{
free
(
ret
);
ret
=
NULL
;
}
ber
=
ber_init
(
bervalU
);
free
(
bervalU
);
return
ret
;
if
((
ret
->
opaque
=
(
char
*
)
ber
))
return
ret
;
free
(
ret
);
return
NULL
;
}
/***********************************************************************
...
...
@@ -142,8 +137,8 @@ WLDAP32_BerElement * CDECL WLDAP32_ber_init( BERVAL *berval )
*/
ULONG
CDECL
WLDAP32_ber_next_element
(
WLDAP32_BerElement
*
ber
,
ULONG
*
len
,
char
*
opaque
)
{
struct
ber_next_element_params
params
=
{
BER
(
ber
),
(
unsigned
int
*
)
len
,
opaque
}
;
return
LDAP_CALL
(
ber_next_element
,
&
params
);
TRACE
(
"%p, %p, %p
\n
"
,
ber
,
len
,
opaque
)
;
return
ber_next_element
(
BER
(
ber
),
len
,
opaque
);
}
/***********************************************************************
...
...
@@ -151,8 +146,8 @@ ULONG CDECL WLDAP32_ber_next_element( WLDAP32_BerElement *ber, ULONG *len, char
*/
ULONG
CDECL
WLDAP32_ber_peek_tag
(
WLDAP32_BerElement
*
ber
,
ULONG
*
len
)
{
struct
ber_peek_tag_params
params
=
{
BER
(
ber
),
(
unsigned
int
*
)
len
}
;
return
LDAP_CALL
(
ber_peek_tag
,
&
params
);
TRACE
(
"%p, %p
\n
"
,
ber
,
len
)
;
return
ber_peek_tag
(
BER
(
ber
),
len
);
}
/***********************************************************************
...
...
@@ -160,8 +155,8 @@ ULONG CDECL WLDAP32_ber_peek_tag( WLDAP32_BerElement *ber, ULONG *len )
*/
ULONG
CDECL
WLDAP32_ber_skip_tag
(
WLDAP32_BerElement
*
ber
,
ULONG
*
len
)
{
struct
ber_skip_tag_params
params
=
{
BER
(
ber
),
(
unsigned
int
*
)
len
}
;
return
LDAP_CALL
(
ber_skip_tag
,
&
params
);
TRACE
(
"%p, %p
\n
"
,
ber
,
len
)
;
return
ber_skip_tag
(
BER
(
ber
),
len
);
}
/***********************************************************************
...
...
@@ -173,53 +168,61 @@ int WINAPIV WLDAP32_ber_printf( WLDAP32_BerElement *ber, char *fmt, ... )
int
ret
=
0
;
char
new_fmt
[
2
];
TRACE
(
"%p(%p), %s
\n
"
,
ber
,
ber
->
opaque
,
fmt
);
new_fmt
[
1
]
=
0
;
va_start
(
list
,
fmt
);
while
(
*
fmt
)
{
struct
ber_printf_params
params
=
{
BER
(
ber
),
new_fmt
};
new_fmt
[
0
]
=
*
fmt
++
;
switch
(
new_fmt
[
0
])
{
case
'b'
:
case
'e'
:
case
'i'
:
params
.
arg1
=
va_arg
(
list
,
int
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
{
int
arg
=
va_arg
(
list
,
int
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
'o'
:
case
's'
:
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
*
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
{
char
*
arg
=
va_arg
(
list
,
char
*
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
't'
:
params
.
arg1
=
va_arg
(
list
,
unsigned
int
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
{
unsigned
int
arg
=
va_arg
(
list
,
unsigned
int
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
'v'
:
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
**
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
{
char
**
arg
=
va_arg
(
list
,
char
**
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
'V'
:
{
struct
berval
**
array
=
va_arg
(
list
,
struct
berval
**
);
struct
berval
U
**
arrayU
;
struct
WLDAP32_berval
**
array
=
va_arg
(
list
,
struct
WLDAP32_
berval
**
);
struct
berval
**
arrayU
;
if
(
!
(
arrayU
=
bvarrayWtoU
(
array
)))
{
ret
=
-
1
;
break
;
}
params
.
arg1
=
(
ULONG_PTR
)
arrayU
;
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arrayU
);
bvarrayfreeU
(
arrayU
);
break
;
}
case
'X'
:
{
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
*
);
params
.
arg2
=
va_arg
(
list
,
int
);
char
*
arg
=
va_arg
(
list
,
char
*
);
int
arg2
=
va_arg
(
list
,
int
);
new_fmt
[
0
]
=
'B'
;
/* 'X' is deprecated */
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
,
arg
,
arg2
);
break
;
}
case
'n'
:
...
...
@@ -227,7 +230,7 @@ int WINAPIV WLDAP32_ber_printf( WLDAP32_BerElement *ber, char *fmt, ... )
case
'}'
:
case
'['
:
case
']'
:
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
ret
=
ber_printf
(
BER
(
ber
),
new_fmt
);
break
;
default:
...
...
@@ -250,78 +253,77 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... )
int
ret
=
0
;
char
new_fmt
[
2
];
TRACE
(
"%p, %s
\n
"
,
ber
,
fmt
);
new_fmt
[
1
]
=
0
;
va_start
(
list
,
fmt
);
while
(
*
fmt
)
{
struct
ber_scanf_params
params
=
{
BER
(
ber
),
new_fmt
};
new_fmt
[
0
]
=
*
fmt
++
;
switch
(
new_fmt
[
0
])
{
case
'a'
:
{
char
*
str
,
**
ptr
=
va_arg
(
list
,
char
**
);
params
.
arg1
=
&
str
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
if
((
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
&
str
))
==
-
1
)
break
;
*
ptr
=
strdupU
(
str
);
LDAP_CALL
(
ldap_memfree
,
str
);
ldap_memfree
(
str
);
break
;
}
case
'b'
:
case
'e'
:
case
'i'
:
params
.
arg1
=
va_arg
(
list
,
int
*
);
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
{
int
*
arg
=
va_arg
(
list
,
int
*
);
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
't'
:
params
.
arg1
=
va_arg
(
list
,
unsigned
int
*
);
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
{
unsigned
int
*
arg
=
va_arg
(
list
,
unsigned
int
*
);
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
arg
);
break
;
}
case
'v'
:
{
char
*
str
,
**
arrayU
,
**
ptr
,
***
array
=
va_arg
(
list
,
char
***
);
params
.
arg1
=
&
arrayU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
if
((
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
&
arrayU
))
==
-
1
)
break
;
*
array
=
strarrayUtoU
(
arrayU
);
ptr
=
arrayU
;
while
((
str
=
*
ptr
))
{
LDAP_CALL
(
ldap_memfree
,
str
);
ldap_memfree
(
str
);
ptr
++
;
}
LDAP_CALL
(
ldap_memfree
,
arrayU
);
ldap_memfree
(
arrayU
);
break
;
}
case
'B'
:
{
char
*
strU
,
**
str
=
va_arg
(
list
,
char
**
);
int
*
len
=
va_arg
(
list
,
int
*
);
params
.
arg1
=
&
strU
;
params
.
arg2
=
len
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
if
((
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
&
strU
,
len
))
==
-
1
)
break
;
*
str
=
malloc
(
*
len
);
memcpy
(
*
str
,
strU
,
*
len
);
LDAP_CALL
(
ldap_memfree
,
strU
);
ldap_memfree
(
strU
);
break
;
}
case
'O'
:
{
struct
berval
**
berval
=
va_arg
(
list
,
struct
berval
**
);
struct
bervalU
*
bervalU
;
params
.
arg1
=
&
bervalU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
struct
WLDAP32_berval
**
berval
=
va_arg
(
list
,
struct
WLDAP32_berval
**
);
struct
berval
*
bervalU
;
if
((
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
&
bervalU
))
==
-
1
)
break
;
*
berval
=
bervalUtoW
(
bervalU
);
LDAP_CALL
(
ber_bvfree
,
bervalU
);
ber_bvfree
(
bervalU
);
break
;
}
case
'V'
:
{
struct
berval
***
array
=
va_arg
(
list
,
struct
berval
***
);
struct
bervalU
**
arrayU
;
params
.
arg1
=
&
arrayU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
struct
WLDAP32_berval
***
array
=
va_arg
(
list
,
struct
WLDAP32_berval
***
);
struct
berval
**
arrayU
;
if
((
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
,
&
arrayU
))
==
-
1
)
break
;
*
array
=
bvarrayUtoW
(
arrayU
);
LDAP_CALL
(
ber_bvecfree
,
arrayU
);
ber_bvecfree
(
arrayU
);
break
;
}
case
'n'
:
...
...
@@ -330,7 +332,7 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... )
case
'}'
:
case
'['
:
case
']'
:
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
ret
=
ber_scanf
(
BER
(
ber
),
new_fmt
);
break
;
default:
...
...
dlls/wldap32/bind.c
View file @
d08d6f51
...
...
@@ -24,7 +24,6 @@
#include "winbase.h"
#include "winnls.h"
#include "rpc.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -61,7 +60,7 @@ ULONG CDECL ldap_bindW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
credU
=
NULL
;
struct
berval
U
pwd
=
{
0
,
NULL
};
struct
berval
pwd
=
{
0
,
NULL
};
int
msg
;
TRACE
(
"(%p, %s, %p, %#lx)
\n
"
,
ld
,
debugstr_w
(
dn
),
cred
,
method
);
...
...
@@ -77,10 +76,7 @@ ULONG CDECL ldap_bindW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
pwd
.
bv_val
=
credU
;
}
{
struct
ldap_sasl_bind_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind
,
&
params
));
}
ret
=
map_error
(
ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
ret
=
msg
;
else
...
...
@@ -122,6 +118,54 @@ exit:
return
ret
;
}
#define SASL_CB_LIST_END 0
#define SASL_CB_AUTHNAME 0x4002
#define SASL_CB_PASS 0x4004
#define SASL_CB_GETREALM 0x4008
struct
sasl_interact
{
unsigned
long
id
;
const
char
*
challenge
;
const
char
*
prompt
;
const
char
*
defresult
;
const
void
*
result
;
unsigned
int
len
;
};
static
int
interact_callback
(
LDAP
*
ld
,
unsigned
flags
,
void
*
defaults
,
void
*
sasl_interact
)
{
SEC_WINNT_AUTH_IDENTITY_W
*
id
=
defaults
;
struct
sasl_interact
*
ptr
=
sasl_interact
;
TRACE
(
"%p, %08xlx, %p, %p
\n
"
,
ld
,
flags
,
defaults
,
sasl_interact
);
while
(
ptr
&&
ptr
->
id
!=
SASL_CB_LIST_END
)
{
switch
(
ptr
->
id
)
{
case
SASL_CB_AUTHNAME
:
ptr
->
result
=
id
->
User
;
ptr
->
len
=
id
->
UserLength
;
break
;
case
SASL_CB_GETREALM
:
ptr
->
result
=
id
->
Domain
;
ptr
->
len
=
id
->
DomainLength
;
break
;
case
SASL_CB_PASS
:
ptr
->
result
=
id
->
Password
;
ptr
->
len
=
id
->
PasswordLength
;
break
;
default:
ERR
(
"unexpected callback %#lx
\n
"
,
ptr
->
id
);
return
-
1
;
}
ptr
++
;
}
return
0
;
}
/***********************************************************************
* ldap_bind_sW (WLDAP32.@)
*/
...
...
@@ -129,7 +173,7 @@ ULONG CDECL ldap_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
credU
=
NULL
;
struct
berval
U
pwd
=
{
0
,
NULL
};
struct
berval
pwd
=
{
0
,
NULL
};
TRACE
(
"(%p, %s, %p, %#lx)
\n
"
,
ld
,
debugstr_w
(
dn
),
cred
,
method
);
...
...
@@ -145,51 +189,28 @@ ULONG CDECL ldap_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
pwd
.
bv_val
=
credU
;
}
{
struct
ldap_sasl_bind_s_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind_s
,
&
params
));
}
ret
=
map_error
(
ldap_sasl_bind_s
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
)
);
}
else
if
(
method
==
WLDAP32_LDAP_AUTH_NEGOTIATE
)
{
SEC_WINNT_AUTH_IDENTITY_A
idU
;
SEC_WINNT_AUTH_IDENTITY_W
idW
;
SEC_WINNT_AUTH_IDENTITY_W
*
id
=
(
SEC_WINNT_AUTH_IDENTITY_W
*
)
cred
;
SEC_WINNT_AUTH_IDENTITY_W
*
id
=
(
SEC_WINNT_AUTH_IDENTITY_W
*
)
cred
,
idW
;
memset
(
&
idU
,
0
,
sizeof
(
idU
)
);
if
(
id
)
{
if
(
id
->
Flags
&
SEC_WINNT_AUTH_IDENTITY_ANSI
)
if
(
id
&&
(
id
->
Flags
&
SEC_WINNT_AUTH_IDENTITY_ANSI
))
{
idW
.
Flags
=
SEC_WINNT_AUTH_IDENTITY_UNICODE
;
idW
.
Domain
=
(
unsigned
short
*
)
strnAtoW
(
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
&
idW
.
DomainLength
);
idW
.
User
=
(
unsigned
short
*
)
strnAtoW
(
(
char
*
)
id
->
User
,
id
->
UserLength
,
&
idW
.
UserLength
);
idW
.
Domain
=
(
unsigned
short
*
)
strnAtoW
(
(
char
*
)
id
->
Domain
,
id
->
DomainLength
,
&
idW
.
DomainLength
);
idW
.
Password
=
(
unsigned
short
*
)
strnAtoW
(
(
char
*
)
id
->
Password
,
id
->
PasswordLength
,
&
idW
.
PasswordLength
);
id
=
&
idW
;
}
idU
.
Domain
=
(
unsigned
char
*
)
strnWtoU
(
id
->
Domain
,
id
->
DomainLength
,
&
idU
.
DomainLength
);
idU
.
User
=
(
unsigned
char
*
)
strnWtoU
(
id
->
User
,
id
->
UserLength
,
&
idU
.
UserLength
);
idU
.
Password
=
(
unsigned
char
*
)
strnWtoU
(
id
->
Password
,
id
->
PasswordLength
,
&
idU
.
PasswordLength
);
}
{
struct
ldap_sasl_interactive_bind_s_params
params
=
{
CTX
(
ld
),
NULL
/* server will ignore DN anyway */
,
NULL
/* query supportedSASLMechanisms */
,
NULL
,
NULL
,
2
/* LDAP_SASL_QUIET */
,
&
idU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_interactive_bind_s
,
&
params
));
}
ret
=
map_error
(
ldap_sasl_interactive_bind_s
(
CTX
(
ld
),
NULL
,
NULL
,
NULL
,
NULL
,
LDAP_SASL_QUIET
,
interact_callback
,
id
)
);
if
(
id
&&
(
id
->
Flags
&
SEC_WINNT_AUTH_IDENTITY_ANSI
))
{
free
(
(
WCHAR
*
)
idW
.
Domain
);
free
(
(
WCHAR
*
)
idW
.
User
);
free
(
(
WCHAR
*
)
idW
.
Password
);
free
(
idW
.
User
);
free
(
idW
.
Domain
);
free
(
idW
.
Password
);
}
free
(
(
char
*
)
idU
.
Domain
);
free
(
(
char
*
)
idU
.
User
);
free
(
(
char
*
)
idU
.
Password
);
}
else
{
...
...
@@ -241,8 +262,8 @@ ULONG CDECL ldap_sasl_bindW( LDAP *ld, const PWCHAR dn, const PWCHAR mechanism,
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
,
*
mechanismU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
credU
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
credU
;
TRACE
(
"(%p, %s, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
mechanism
),
cred
,
serverctrls
,
clientctrls
,
message
);
...
...
@@ -255,10 +276,9 @@ ULONG CDECL ldap_sasl_bindW( LDAP *ld, const PWCHAR dn, const PWCHAR mechanism,
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_sasl_bind_params
params
=
{
CTX
(
ld
),
dnU
,
mechanismU
,
&
credU
,
serverctrlsU
,
clientctrlsU
,
message
};
credU
.
bv_len
=
cred
->
bv_len
;
credU
.
bv_val
=
cred
->
bv_val
;
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind
,
&
params
)
);
ret
=
map_error
(
ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
mechanismU
,
&
credU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
}
exit:
...
...
@@ -307,8 +327,8 @@ ULONG CDECL ldap_sasl_bind_sW( LDAP *ld, const PWCHAR dn, const PWCHAR mechanism
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
,
*
mechanismU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
*
dataU
,
credU
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
*
dataU
,
credU
;
TRACE
(
"(%p, %s, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
mechanism
),
cred
,
serverctrls
,
clientctrls
,
serverdata
);
...
...
@@ -322,17 +342,14 @@ ULONG CDECL ldap_sasl_bind_sW( LDAP *ld, const PWCHAR dn, const PWCHAR mechanism
credU
.
bv_len
=
cred
->
bv_len
;
credU
.
bv_val
=
cred
->
bv_val
;
ret
=
map_error
(
ldap_sasl_bind_s
(
CTX
(
ld
),
dnU
,
mechanismU
,
&
credU
,
serverctrlsU
,
clientctrlsU
,
&
dataU
)
);
{
struct
ldap_sasl_bind_s_params
params
=
{
CTX
(
ld
),
dnU
,
mechanismU
,
&
credU
,
serverctrlsU
,
clientctrlsU
,
&
dataU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind_s
,
&
params
));
}
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
BERVAL
*
ptr
;
if
(
!
(
ptr
=
bervalUtoW
(
dataU
)))
ret
=
WLDAP32_LDAP_NO_MEMORY
;
else
*
serverdata
=
ptr
;
LDAP_CALL
(
ber_bvfree
,
dataU
);
ber_bvfree
(
dataU
);
}
exit:
...
...
@@ -373,7 +390,7 @@ ULONG CDECL ldap_simple_bindW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
passwdU
=
NULL
;
struct
berval
U
pwd
=
{
0
,
NULL
};
struct
berval
pwd
=
{
0
,
NULL
};
int
msg
;
TRACE
(
"(%p, %s, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
passwd
);
...
...
@@ -388,10 +405,7 @@ ULONG CDECL ldap_simple_bindW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
pwd
.
bv_val
=
passwdU
;
}
{
struct
ldap_sasl_bind_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind
,
&
params
));
}
ret
=
map_error
(
ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
ret
=
msg
;
else
...
...
@@ -433,7 +447,7 @@ ULONG CDECL ldap_simple_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
passwdU
=
NULL
;
struct
berval
U
pwd
=
{
0
,
NULL
};
struct
berval
pwd
=
{
0
,
NULL
};
TRACE
(
"(%p, %s, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
passwd
);
...
...
@@ -447,10 +461,7 @@ ULONG CDECL ldap_simple_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
pwd
.
bv_val
=
passwdU
;
}
{
struct
ldap_sasl_bind_s_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind_s
,
&
params
));
}
ret
=
map_error
(
ldap_sasl_bind_s
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
)
);
exit:
free
(
dnU
);
...
...
@@ -467,14 +478,10 @@ ULONG CDECL WLDAP32_ldap_unbind( LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
ld
)
{
struct
ldap_unbind_ext_params
params
=
{
CTX
(
ld
),
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_unbind_ext
,
&
params
));
}
if
(
ld
)
ret
=
map_error
(
ldap_unbind_ext
(
CTX
(
ld
),
NULL
,
NULL
)
);
else
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
SERVER_CTRLS
(
ld
))
LDAP_CALL
(
ldap_value_free_len
,
SERVER_CTRLS
(
ld
)
);
if
(
SERVER_CTRLS
(
ld
))
ldap_value_free_len
(
SERVER_CTRLS
(
ld
)
);
free
(
ld
);
return
ret
;
...
...
@@ -489,14 +496,10 @@ ULONG CDECL WLDAP32_ldap_unbind_s( LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
ld
)
{
struct
ldap_unbind_ext_s_params
params
=
{
CTX
(
ld
),
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_unbind_ext_s
,
&
params
));
}
if
(
ld
)
ret
=
map_error
(
ldap_unbind_ext_s
(
CTX
(
ld
),
NULL
,
NULL
)
);
else
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
SERVER_CTRLS
(
ld
))
LDAP_CALL
(
ldap_value_free_len
,
SERVER_CTRLS
(
ld
)
);
if
(
SERVER_CTRLS
(
ld
))
ldap_value_free_len
(
SERVER_CTRLS
(
ld
)
);
free
(
ld
);
return
ret
;
...
...
dlls/wldap32/compare.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -71,9 +70,8 @@ ULONG CDECL ldap_compareW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value )
/***********************************************************************
* ldap_compare_extA (WLDAP32.@)
*/
ULONG
CDECL
ldap_compare_extA
(
LDAP
*
ld
,
char
*
dn
,
char
*
attr
,
char
*
value
,
struct
berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
*
message
)
ULONG
CDECL
ldap_compare_extA
(
LDAP
*
ld
,
char
*
dn
,
char
*
attr
,
char
*
value
,
struct
WLDAP32_berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
dnW
=
NULL
,
*
attrW
=
NULL
,
*
valueW
=
NULL
;
...
...
@@ -104,13 +102,13 @@ exit:
/***********************************************************************
* ldap_compare_extW (WLDAP32.@)
*/
ULONG
CDECL
ldap_compare_extW
(
LDAP
*
ld
,
WCHAR
*
dn
,
WCHAR
*
attr
,
WCHAR
*
value
,
struct
berval
*
data
,
ULONG
CDECL
ldap_compare_extW
(
LDAP
*
ld
,
WCHAR
*
dn
,
WCHAR
*
attr
,
WCHAR
*
value
,
struct
WLDAP32_
berval
*
data
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
*
dataU
=
NULL
,
val
=
{
0
,
NULL
};
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
*
dataU
=
NULL
,
val
=
{
0
,
NULL
};
TRACE
(
"(%p, %s, %s, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
attr
),
debugstr_w
(
value
),
data
,
serverctrls
,
clientctrls
,
message
);
...
...
@@ -135,8 +133,8 @@ ULONG CDECL ldap_compare_extW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value, s
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_compare_ext_params
params
=
{
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_compare_ext
,
&
params
)
);
ret
=
map_error
(
ldap_compare_ext
(
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
...
...
@@ -152,7 +150,7 @@ exit:
/***********************************************************************
* ldap_compare_ext_sA (WLDAP32.@)
*/
ULONG
CDECL
ldap_compare_ext_sA
(
LDAP
*
ld
,
char
*
dn
,
char
*
attr
,
char
*
value
,
struct
berval
*
data
,
ULONG
CDECL
ldap_compare_ext_sA
(
LDAP
*
ld
,
char
*
dn
,
char
*
attr
,
char
*
value
,
struct
WLDAP32_
berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -184,13 +182,13 @@ exit:
/***********************************************************************
* ldap_compare_ext_sW (WLDAP32.@)
*/
ULONG
CDECL
ldap_compare_ext_sW
(
LDAP
*
ld
,
WCHAR
*
dn
,
WCHAR
*
attr
,
WCHAR
*
value
,
struct
berval
*
data
,
ULONG
CDECL
ldap_compare_ext_sW
(
LDAP
*
ld
,
WCHAR
*
dn
,
WCHAR
*
attr
,
WCHAR
*
value
,
struct
WLDAP32_
berval
*
data
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
*
dataU
=
NULL
,
val
=
{
0
,
NULL
};
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
*
dataU
=
NULL
,
val
=
{
0
,
NULL
};
TRACE
(
"(%p, %s, %s, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
attr
),
debugstr_w
(
value
),
data
,
serverctrls
,
clientctrls
);
...
...
@@ -214,8 +212,7 @@ ULONG CDECL ldap_compare_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value,
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_compare_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_compare_ext_s
,
&
params
));
ret
=
map_error
(
ldap_compare_ext_s
(
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
)
);
}
exit:
free
(
dnU
);
...
...
dlls/wldap32/control.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -103,26 +102,22 @@ ULONG CDECL ldap_create_sort_controlA( LDAP *ld, LDAPSortKeyA **sortkey, UCHAR c
ULONG
CDECL
ldap_create_sort_controlW
(
LDAP
*
ld
,
LDAPSortKeyW
**
sortkey
,
UCHAR
critical
,
LDAPControlW
**
control
)
{
ULONG
ret
;
LDAPSortKey
U
**
sortkeyU
;
LDAPControl
U
*
controlU
;
LDAPSortKey
**
sortkeyU
;
LDAPControl
*
controlU
;
TRACE
(
"(%p, %p, 0x%02x, %p)
\n
"
,
ld
,
sortkey
,
critical
,
control
);
if
(
!
ld
||
!
sortkey
||
!
control
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
((
sortkeyU
=
sortkeyarrayWtoU
(
sortkey
)))
{
struct
ldap_create_sort_control_params
params
=
{
CTX
(
ld
),
sortkeyU
,
critical
,
&
controlU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_create_sort_control
,
&
params
));
}
else
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
!
(
sortkeyU
=
sortkeyarrayWtoU
(
sortkey
)))
return
WLDAP32_LDAP_NO_MEMORY
;
ret
=
map_error
(
ldap_create_sort_control
(
CTX
(
ld
),
sortkeyU
,
critical
,
&
controlU
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
LDAPControlW
*
controlW
=
controlUtoW
(
controlU
);
if
(
controlW
)
*
control
=
controlW
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_control_free
,
controlU
);
ldap_control_free
(
controlU
);
}
sortkeyarrayfreeU
(
sortkeyU
);
...
...
@@ -132,7 +127,7 @@ ULONG CDECL ldap_create_sort_controlW( LDAP *ld, LDAPSortKeyW **sortkey, UCHAR c
/***********************************************************************
* ldap_create_vlv_controlA (WLDAP32.@)
*/
INT
CDECL
ldap_create_vlv_controlA
(
LDAP
*
ld
,
LDAPVLVInfo
*
info
,
UCHAR
critical
,
LDAPControlA
**
control
)
INT
CDECL
ldap_create_vlv_controlA
(
LDAP
*
ld
,
WLDAP32_
LDAPVLVInfo
*
info
,
UCHAR
critical
,
LDAPControlA
**
control
)
{
INT
ret
;
LDAPControlW
*
controlW
;
...
...
@@ -156,35 +151,32 @@ INT CDECL ldap_create_vlv_controlA( LDAP *ld, LDAPVLVInfo *info, UCHAR critical,
/***********************************************************************
* ldap_create_vlv_controlW (WLDAP32.@)
*/
INT
CDECL
ldap_create_vlv_controlW
(
LDAP
*
ld
,
LDAPVLVInfo
*
info
,
UCHAR
critical
,
LDAPControlW
**
control
)
INT
CDECL
ldap_create_vlv_controlW
(
LDAP
*
ld
,
WLDAP32_
LDAPVLVInfo
*
info
,
UCHAR
critical
,
LDAPControlW
**
control
)
{
ULONG
ret
;
LDAPVLVInfo
U
*
infoU
=
NULL
;
LDAPControl
U
*
controlU
;
LDAPVLVInfo
*
infoU
=
NULL
;
LDAPControl
*
controlU
;
TRACE
(
"(%p, %p, 0x%02x, %p)
\n
"
,
ld
,
info
,
critical
,
control
);
if
(
!
ld
||
!
control
)
return
~
0u
;
if
(
info
&&
!
(
infoU
=
vlvinfoWtoU
(
info
)))
return
WLDAP32_LDAP_NO_MEMORY
;
else
{
struct
ldap_create_vlv_control_params
params
=
{
CTX
(
ld
),
infoU
,
&
controlU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_create_vlv_control
,
&
params
));
}
ret
=
map_error
(
ldap_create_vlv_control
(
CTX
(
ld
),
infoU
,
&
controlU
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
LDAPControlW
*
controlW
=
controlUtoW
(
controlU
);
if
(
controlW
)
*
control
=
controlW
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_control_free
,
controlU
);
ldap_control_free
(
controlU
);
}
vlvinfofreeU
(
infoU
);
return
ret
;
}
static
inline
void
bv_val_dup
(
const
struct
berval
*
src
,
struct
berval
*
dst
)
static
inline
void
bv_val_dup
(
const
struct
WLDAP32_berval
*
src
,
struct
WLDAP32_
berval
*
dst
)
{
if
((
dst
->
bv_val
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
src
->
bv_len
)))
{
...
...
dlls/wldap32/delete.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -96,7 +95,7 @@ ULONG CDECL ldap_delete_extW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls, L
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
,
message
);
...
...
@@ -107,8 +106,7 @@ ULONG CDECL ldap_delete_extW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls, L
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_delete_ext_params
params
=
{
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_delete_ext
,
&
params
));
ret
=
map_error
(
ldap_delete_ext
(
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
...
...
@@ -151,7 +149,7 @@ ULONG CDECL ldap_delete_ext_sW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls,
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
);
...
...
@@ -162,8 +160,7 @@ ULONG CDECL ldap_delete_ext_sW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls,
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_delete_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_delete_ext_s
,
&
params
));
ret
=
map_error
(
ldap_delete_ext_s
(
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
)
);
}
exit:
...
...
dlls/wldap32/dn.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -34,16 +33,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
*/
char
*
CDECL
ldap_dn2ufnA
(
char
*
dn
)
{
char
*
ret
;
char
*
ret
=
NULL
;
WCHAR
*
dnW
,
*
retW
;
TRACE
(
"(%s)
\n
"
,
debugstr_a
(
dn
)
);
if
(
!
(
dnW
=
strAtoW
(
dn
)))
return
NULL
;
retW
=
ldap_dn2ufnW
(
dnW
);
ret
=
strWtoA
(
retW
);
if
((
retW
=
ldap_dn2ufnW
(
dnW
)))
ret
=
strWtoA
(
retW
);
free
(
dnW
);
ldap_memfreeW
(
retW
);
return
ret
;
...
...
@@ -59,16 +55,10 @@ WCHAR * CDECL ldap_dn2ufnW( WCHAR *dn )
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
dn
)
);
if
((
dnU
=
strWtoU
(
dn
)))
{
struct
ldap_dn2ufn_params
params
=
{
dnU
,
&
retU
};
LDAP_CALL
(
ldap_dn2ufn
,
&
params
);
ret
=
strUtoW
(
retU
);
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
if
((
retU
=
ldap_dn2ufn
(
dnU
)))
ret
=
strUtoW
(
retU
);
free
(
dnU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
}
ldap_memfree
(
retU
);
return
ret
;
}
...
...
@@ -77,16 +67,13 @@ WCHAR * CDECL ldap_dn2ufnW( WCHAR *dn )
*/
char
**
CDECL
ldap_explode_dnA
(
char
*
dn
,
ULONG
notypes
)
{
char
**
ret
;
char
**
ret
=
NULL
;
WCHAR
*
dnW
,
**
retW
;
TRACE
(
"(%s, %#lx)
\n
"
,
debugstr_a
(
dn
),
notypes
);
if
(
!
(
dnW
=
strAtoW
(
dn
)))
return
NULL
;
retW
=
ldap_explode_dnW
(
dnW
,
notypes
);
ret
=
strarrayWtoA
(
retW
);
if
((
retW
=
ldap_explode_dnW
(
dnW
,
notypes
)))
ret
=
strarrayWtoA
(
retW
);
free
(
dnW
);
ldap_value_freeW
(
retW
);
return
ret
;
...
...
@@ -102,15 +89,10 @@ WCHAR ** CDECL ldap_explode_dnW( WCHAR *dn, ULONG notypes )
TRACE
(
"(%s, %#lx)
\n
"
,
debugstr_w
(
dn
),
notypes
);
if
((
dnU
=
strWtoU
(
dn
)))
{
struct
ldap_explode_dn_params
params
=
{
dnU
,
notypes
,
&
retU
};
LDAP_CALL
(
ldap_explode_dn
,
&
params
);
ret
=
strarrayUtoW
(
retU
);
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
if
((
retU
=
ldap_explode_dn
(
dnU
,
notypes
)))
ret
=
strarrayUtoW
(
retU
);
free
(
dnU
);
LDAP_CALL
(
ldap_memvfree
,
retU
);
}
ldap_memvfree
(
(
void
**
)
retU
);
return
ret
;
}
...
...
@@ -119,16 +101,14 @@ WCHAR ** CDECL ldap_explode_dnW( WCHAR *dn, ULONG notypes )
*/
char
*
CDECL
ldap_get_dnA
(
LDAP
*
ld
,
LDAPMessage
*
entry
)
{
char
*
ret
;
char
*
ret
=
NULL
;
WCHAR
*
retW
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
entry
);
if
(
!
ld
||
!
entry
)
return
NULL
;
retW
=
ldap_get_dnW
(
ld
,
entry
);
ret
=
strWtoA
(
retW
);
if
((
retW
=
ldap_get_dnW
(
ld
,
entry
)))
ret
=
strWtoA
(
retW
);
ldap_memfreeW
(
retW
);
return
ret
;
}
...
...
@@ -145,11 +125,8 @@ WCHAR * CDECL ldap_get_dnW( LDAP *ld, LDAPMessage *entry )
if
(
ld
&&
entry
)
{
struct
ldap_get_dn_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
retU
};
LDAP_CALL
(
ldap_get_dn
,
&
params
);
ret
=
strUtoW
(
retU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
if
((
retU
=
ldap_get_dn
(
CTX
(
ld
),
MSG
(
entry
)
)))
ret
=
strUtoW
(
retU
);
ldap_memfree
(
retU
);
}
return
ret
;
}
...
...
dlls/wldap32/error.c
View file @
d08d6f51
...
...
@@ -23,7 +23,6 @@
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -36,25 +35,69 @@ ULONG map_error( int error )
{
switch
(
error
)
{
case
0
:
return
WLDAP32_LDAP_SUCCESS
;
case
-
1
:
return
WLDAP32_LDAP_SERVER_DOWN
;
case
-
2
:
return
WLDAP32_LDAP_LOCAL_ERROR
;
case
-
3
:
return
WLDAP32_LDAP_ENCODING_ERROR
;
case
-
4
:
return
WLDAP32_LDAP_DECODING_ERROR
;
case
-
5
:
return
WLDAP32_LDAP_TIMEOUT
;
case
-
6
:
return
WLDAP32_LDAP_AUTH_UNKNOWN
;
case
-
7
:
return
WLDAP32_LDAP_FILTER_ERROR
;
case
-
8
:
return
WLDAP32_LDAP_USER_CANCELLED
;
case
-
9
:
return
WLDAP32_LDAP_PARAM_ERROR
;
case
-
10
:
return
WLDAP32_LDAP_NO_MEMORY
;
case
-
11
:
return
WLDAP32_LDAP_CONNECT_ERROR
;
case
-
12
:
return
WLDAP32_LDAP_NOT_SUPPORTED
;
case
-
13
:
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
case
-
14
:
return
WLDAP32_LDAP_NO_RESULTS_RETURNED
;
case
-
15
:
return
WLDAP32_LDAP_MORE_RESULTS_TO_RETURN
;
case
-
16
:
return
WLDAP32_LDAP_CLIENT_LOOP
;
case
-
17
:
return
WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED
;
default:
return
error
;
case
LDAP_SUCCESS
:
return
WLDAP32_LDAP_SUCCESS
;
case
LDAP_OPERATIONS_ERROR
:
return
WLDAP32_LDAP_OPERATIONS_ERROR
;
case
LDAP_PROTOCOL_ERROR
:
return
WLDAP32_LDAP_PROTOCOL_ERROR
;
case
LDAP_TIMELIMIT_EXCEEDED
:
return
WLDAP32_LDAP_TIMELIMIT_EXCEEDED
;
case
LDAP_SIZELIMIT_EXCEEDED
:
return
WLDAP32_LDAP_SIZELIMIT_EXCEEDED
;
case
LDAP_COMPARE_FALSE
:
return
WLDAP32_LDAP_COMPARE_FALSE
;
case
LDAP_COMPARE_TRUE
:
return
WLDAP32_LDAP_COMPARE_TRUE
;
case
LDAP_AUTH_METHOD_NOT_SUPPORTED
:
return
WLDAP32_LDAP_AUTH_METHOD_NOT_SUPPORTED
;
case
LDAP_STRONG_AUTH_REQUIRED
:
return
WLDAP32_LDAP_STRONG_AUTH_REQUIRED
;
case
LDAP_PARTIAL_RESULTS
:
return
WLDAP32_LDAP_PARTIAL_RESULTS
;
case
LDAP_REFERRAL
:
return
WLDAP32_LDAP_REFERRAL
;
case
LDAP_ADMINLIMIT_EXCEEDED
:
return
WLDAP32_LDAP_ADMIN_LIMIT_EXCEEDED
;
case
LDAP_UNAVAILABLE_CRITICAL_EXTENSION
:
return
WLDAP32_LDAP_UNAVAILABLE_CRIT_EXTENSION
;
case
LDAP_CONFIDENTIALITY_REQUIRED
:
return
WLDAP32_LDAP_CONFIDENTIALITY_REQUIRED
;
case
LDAP_SASL_BIND_IN_PROGRESS
:
return
WLDAP32_LDAP_SASL_BIND_IN_PROGRESS
;
case
LDAP_NO_SUCH_ATTRIBUTE
:
return
WLDAP32_LDAP_NO_SUCH_ATTRIBUTE
;
case
LDAP_UNDEFINED_TYPE
:
return
WLDAP32_LDAP_UNDEFINED_TYPE
;
case
LDAP_INAPPROPRIATE_MATCHING
:
return
WLDAP32_LDAP_INAPPROPRIATE_MATCHING
;
case
LDAP_CONSTRAINT_VIOLATION
:
return
WLDAP32_LDAP_CONSTRAINT_VIOLATION
;
case
LDAP_TYPE_OR_VALUE_EXISTS
:
return
WLDAP32_LDAP_ATTRIBUTE_OR_VALUE_EXISTS
;
case
LDAP_INVALID_SYNTAX
:
return
WLDAP32_LDAP_INVALID_SYNTAX
;
case
LDAP_NO_SUCH_OBJECT
:
return
WLDAP32_LDAP_NO_SUCH_OBJECT
;
case
LDAP_ALIAS_PROBLEM
:
return
WLDAP32_LDAP_ALIAS_PROBLEM
;
case
LDAP_INVALID_DN_SYNTAX
:
return
WLDAP32_LDAP_INVALID_DN_SYNTAX
;
case
LDAP_IS_LEAF
:
return
WLDAP32_LDAP_IS_LEAF
;
case
LDAP_ALIAS_DEREF_PROBLEM
:
return
WLDAP32_LDAP_ALIAS_DEREF_PROBLEM
;
case
LDAP_INAPPROPRIATE_AUTH
:
return
WLDAP32_LDAP_INAPPROPRIATE_AUTH
;
case
LDAP_INVALID_CREDENTIALS
:
return
WLDAP32_LDAP_INVALID_CREDENTIALS
;
case
LDAP_INSUFFICIENT_ACCESS
:
return
WLDAP32_LDAP_INSUFFICIENT_RIGHTS
;
case
LDAP_BUSY
:
return
WLDAP32_LDAP_BUSY
;
case
LDAP_UNAVAILABLE
:
return
WLDAP32_LDAP_UNAVAILABLE
;
case
LDAP_UNWILLING_TO_PERFORM
:
return
WLDAP32_LDAP_UNWILLING_TO_PERFORM
;
case
LDAP_LOOP_DETECT
:
return
WLDAP32_LDAP_LOOP_DETECT
;
case
LDAP_NAMING_VIOLATION
:
return
WLDAP32_LDAP_NAMING_VIOLATION
;
case
LDAP_OBJECT_CLASS_VIOLATION
:
return
WLDAP32_LDAP_OBJECT_CLASS_VIOLATION
;
case
LDAP_NOT_ALLOWED_ON_NONLEAF
:
return
WLDAP32_LDAP_NOT_ALLOWED_ON_NONLEAF
;
case
LDAP_NOT_ALLOWED_ON_RDN
:
return
WLDAP32_LDAP_NOT_ALLOWED_ON_RDN
;
case
LDAP_ALREADY_EXISTS
:
return
WLDAP32_LDAP_ALREADY_EXISTS
;
case
LDAP_NO_OBJECT_CLASS_MODS
:
return
WLDAP32_LDAP_NO_OBJECT_CLASS_MODS
;
case
LDAP_RESULTS_TOO_LARGE
:
return
WLDAP32_LDAP_RESULTS_TOO_LARGE
;
case
LDAP_AFFECTS_MULTIPLE_DSAS
:
return
WLDAP32_LDAP_AFFECTS_MULTIPLE_DSAS
;
case
LDAP_VLV_ERROR
:
return
WLDAP32_LDAP_VIRTUAL_LIST_VIEW_ERROR
;
case
LDAP_OTHER
:
return
WLDAP32_LDAP_OTHER
;
case
LDAP_SERVER_DOWN
:
return
WLDAP32_LDAP_SERVER_DOWN
;
case
LDAP_LOCAL_ERROR
:
return
WLDAP32_LDAP_LOCAL_ERROR
;
case
LDAP_ENCODING_ERROR
:
return
WLDAP32_LDAP_ENCODING_ERROR
;
case
LDAP_DECODING_ERROR
:
return
WLDAP32_LDAP_DECODING_ERROR
;
case
LDAP_TIMEOUT
:
return
WLDAP32_LDAP_TIMEOUT
;
case
LDAP_AUTH_UNKNOWN
:
return
WLDAP32_LDAP_AUTH_UNKNOWN
;
case
LDAP_FILTER_ERROR
:
return
WLDAP32_LDAP_FILTER_ERROR
;
case
LDAP_USER_CANCELLED
:
return
WLDAP32_LDAP_USER_CANCELLED
;
case
LDAP_PARAM_ERROR
:
return
WLDAP32_LDAP_PARAM_ERROR
;
case
LDAP_NO_MEMORY
:
return
WLDAP32_LDAP_NO_MEMORY
;
case
LDAP_CONNECT_ERROR
:
return
WLDAP32_LDAP_CONNECT_ERROR
;
case
LDAP_NOT_SUPPORTED
:
return
WLDAP32_LDAP_NOT_SUPPORTED
;
case
LDAP_CONTROL_NOT_FOUND
:
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
case
LDAP_NO_RESULTS_RETURNED
:
return
WLDAP32_LDAP_NO_RESULTS_RETURNED
;
case
LDAP_MORE_RESULTS_TO_RETURN
:
return
WLDAP32_LDAP_MORE_RESULTS_TO_RETURN
;
case
LDAP_CLIENT_LOOP
:
return
WLDAP32_LDAP_CLIENT_LOOP
;
case
LDAP_REFERRAL_LIMIT_EXCEEDED
:
return
WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED
;
default:
FIXME
(
"no mapping for %d
\n
"
,
error
);
return
error
;
}
}
...
...
@@ -109,11 +152,9 @@ ULONG CDECL WLDAP32_ldap_result2error( LDAP *ld, LDAPMessage *res, ULONG free )
TRACE
(
"(%p, %p, %#lx)
\n
"
,
ld
,
res
,
free
);
if
(
ld
&&
res
)
{
struct
ldap_parse_result_params
params
=
{
CTX
(
ld
),
MSG
(
res
),
&
error
,
NULL
,
NULL
,
NULL
,
NULL
,
free
};
if
(
!
LDAP_CALL
(
ldap_parse_result
,
&
params
))
return
error
;
}
if
(
ld
&&
res
&&
!
ldap_parse_result
(
CTX
(
ld
),
MSG
(
res
),
&
error
,
NULL
,
NULL
,
NULL
,
NULL
,
free
))
return
error
;
return
~
0u
;
}
...
...
dlls/wldap32/extended.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -43,7 +42,7 @@ ULONG CDECL ldap_close_extended_op( LDAP *ld, ULONG msgid )
/***********************************************************************
* ldap_extended_operationA (WLDAP32.@)
*/
ULONG
CDECL
ldap_extended_operationA
(
LDAP
*
ld
,
char
*
oid
,
struct
berval
*
data
,
LDAPControlA
**
serverctrls
,
ULONG
CDECL
ldap_extended_operationA
(
LDAP
*
ld
,
char
*
oid
,
struct
WLDAP32_
berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -70,13 +69,13 @@ exit:
/***********************************************************************
* ldap_extended_operationW (WLDAP32.@)
*/
ULONG
CDECL
ldap_extended_operationW
(
LDAP
*
ld
,
WCHAR
*
oid
,
struct
berval
*
data
,
LDAPControlW
**
serverctrls
,
ULONG
CDECL
ldap_extended_operationW
(
LDAP
*
ld
,
WCHAR
*
oid
,
struct
WLDAP32_
berval
*
data
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
oidU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
*
dataU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
*
dataU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
oid
),
data
,
serverctrls
,
clientctrls
,
message
);
...
...
@@ -88,8 +87,7 @@ ULONG CDECL ldap_extended_operationW( LDAP *ld, WCHAR *oid, struct berval *data,
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_extended_operation_params
params
=
{
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_extended_operation
,
&
params
));
ret
=
map_error
(
ldap_extended_operation
(
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
...
...
@@ -103,8 +101,8 @@ exit:
/***********************************************************************
* ldap_extended_operation_sA (WLDAP32.@)
*/
ULONG
CDECL
ldap_extended_operation_sA
(
LDAP
*
ld
,
char
*
oid
,
struct
berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
char
**
retoid
,
struct
berval
**
retdata
)
ULONG
CDECL
ldap_extended_operation_sA
(
LDAP
*
ld
,
char
*
oid
,
struct
WLDAP32_
berval
*
data
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
char
**
retoid
,
struct
WLDAP32_
berval
**
retdata
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
oidW
=
NULL
,
*
retoidW
=
NULL
;
...
...
@@ -137,13 +135,13 @@ exit:
/***********************************************************************
* ldap_extended_operation_sW (WLDAP32.@)
*/
ULONG
CDECL
ldap_extended_operation_sW
(
LDAP
*
ld
,
WCHAR
*
oid
,
struct
berval
*
data
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
WCHAR
**
retoid
,
struct
berval
**
retdata
)
ULONG
CDECL
ldap_extended_operation_sW
(
LDAP
*
ld
,
WCHAR
*
oid
,
struct
WLDAP32_
berval
*
data
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
WCHAR
**
retoid
,
struct
WLDAP32_
berval
**
retdata
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
oidU
=
NULL
,
*
retoidU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
U
*
retdataU
,
*
dataU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
*
retdataU
,
*
dataU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
oid
),
data
,
serverctrls
,
clientctrls
,
retoid
,
retdata
);
...
...
@@ -155,8 +153,8 @@ ULONG CDECL ldap_extended_operation_sW( LDAP *ld, WCHAR *oid, struct berval *dat
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_extended_operation_s_params
params
=
{
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
&
retoidU
,
&
retdataU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_extended_operation_s
,
&
params
)
);
ret
=
map_error
(
ldap_extended_operation_s
(
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
&
retoidU
,
&
retdataU
)
);
}
if
(
retoid
&&
retoidU
)
...
...
@@ -164,14 +162,14 @@ ULONG CDECL ldap_extended_operation_sW( LDAP *ld, WCHAR *oid, struct berval *dat
WCHAR
*
str
=
strUtoW
(
retoidU
);
if
(
str
)
*
retoid
=
str
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_memfree
,
retoidU
);
ldap_memfree
(
retoidU
);
}
if
(
retdata
&&
retdataU
)
{
struct
berval
*
bv
=
bervalUtoW
(
retdataU
);
struct
WLDAP32_
berval
*
bv
=
bervalUtoW
(
retdataU
);
if
(
bv
)
*
retdata
=
bv
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ber_bvfree
,
retdataU
);
ber_bvfree
(
retdataU
);
}
exit:
...
...
dlls/wldap32/init.c
View file @
d08d6f51
...
...
@@ -24,7 +24,6 @@
#include "winbase.h"
#include "winnls.h"
#include "winternl.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -194,15 +193,11 @@ static LDAP *create_context( const char *url )
{
LDAP
*
ld
;
int
version
=
WLDAP32_LDAP_VERSION3
;
struct
ldap_initialize_params
params
;
if
(
!
(
ld
=
calloc
(
1
,
sizeof
(
*
ld
))))
return
NULL
;
params
.
ld
=
&
CTX
(
ld
);
params
.
url
=
url
;
if
(
map_error
(
LDAP_CALL
(
ldap_initialize
,
&
params
))
==
WLDAP32_LDAP_SUCCESS
)
if
(
map_error
(
ldap_initialize
(
&
CTX
(
ld
),
url
)
)
==
WLDAP32_LDAP_SUCCESS
)
{
struct
ldap_set_option_params
opt_params
=
{
CTX
(
ld
),
WLDAP32_LDAP_OPT_PROTOCOL_VERSION
,
&
version
};
LDAP_CALL
(
ldap_set_option
,
&
opt_params
);
ldap_set_option
(
CTX
(
ld
),
WLDAP32_LDAP_OPT_PROTOCOL_VERSION
,
&
version
);
return
ld
;
}
free
(
ld
);
...
...
@@ -412,7 +407,7 @@ ULONG CDECL ldap_start_tls_sW( LDAP *ld, ULONG *retval, LDAPMessage **result, LD
LDAPControlW
**
clientctrls
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %p, %p, %p, %p)
\n
"
,
ld
,
retval
,
result
,
serverctrls
,
clientctrls
);
if
(
result
)
...
...
@@ -427,8 +422,7 @@ ULONG CDECL ldap_start_tls_sW( LDAP *ld, ULONG *retval, LDAPMessage **result, LD
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_start_tls_s_params
params
=
{
CTX
(
ld
),
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_start_tls_s
,
&
params
));
ret
=
map_error
(
ldap_start_tls_s
(
CTX
(
ld
),
serverctrlsU
,
clientctrlsU
)
);
}
exit:
...
...
dlls/wldap32/libldap.c
deleted
100644 → 0
View file @
17021e53
/*
* Unix interface for libldap
*
* Copyright 2021 Hans Leidekker for CodeWeavers
*
* 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
*/
#if 0
#pragma makedep unix
#endif
#include "config.h"
#ifdef HAVE_LDAP
#include <assert.h>
#include <stdarg.h>
#include <sys/time.h>
#ifdef HAVE_LDAP_H
# include <ldap.h>
#endif
#ifdef HAVE_SASL_SASL_H
# include <sasl/sasl.h>
#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "winbase.h"
#include "wine/debug.h"
#include "libldap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
C_ASSERT
(
sizeof
(
BerValueU
)
==
sizeof
(
BerValue
)
);
C_ASSERT
(
sizeof
(
LDAPModU
)
==
sizeof
(
LDAPMod
)
);
C_ASSERT
(
sizeof
(
LDAPControlU
)
==
sizeof
(
LDAPControl
)
);
C_ASSERT
(
sizeof
(
LDAPSortKeyU
)
==
sizeof
(
LDAPSortKey
)
);
C_ASSERT
(
sizeof
(
LDAPVLVInfoU
)
==
sizeof
(
LDAPVLVInfo
)
);
C_ASSERT
(
sizeof
(
LDAPAPIInfoU
)
==
sizeof
(
LDAPAPIInfo
)
);
C_ASSERT
(
sizeof
(
LDAPAPIFeatureInfoU
)
==
sizeof
(
LDAPAPIFeatureInfo
)
);
static
struct
timeval
*
convert_timeval
(
const
struct
timevalU
*
tvu
,
struct
timeval
*
tv
)
{
if
(
!
tvu
)
return
NULL
;
tv
->
tv_sec
=
tvu
->
tv_sec
;
tv
->
tv_usec
=
tvu
->
tv_usec
;
return
tv
;
}
#define WLDAP32_LBER_ERROR (~0l)
static
LDAPMod
*
nullmods
[]
=
{
NULL
};
static
NTSTATUS
wrap_ber_alloc_t
(
void
*
args
)
{
struct
ber_alloc_t_params
*
params
=
args
;
*
params
->
ret
=
ber_alloc_t
(
params
->
options
);
return
*
params
->
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
NTSTATUS
wrap_ber_bvecfree
(
void
*
args
)
{
ber_bvecfree
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ber_bvfree
(
void
*
args
)
{
ber_bvfree
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ber_first_element
(
void
*
args
)
{
struct
ber_first_element_params
*
params
=
args
;
ber_len_t
len
;
ber_tag_t
ret
;
if
((
ret
=
ber_first_element
(
params
->
ber
,
&
len
,
params
->
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
ret
>
~
0u
)
{
ERR
(
"ret too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
if
(
len
>
~
0u
)
{
ERR
(
"len too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
*
params
->
ret_len
=
len
;
return
ret
;
}
static
NTSTATUS
wrap_ber_flatten
(
void
*
args
)
{
struct
ber_flatten_params
*
params
=
args
;
return
ber_flatten
(
params
->
ber
,
(
struct
berval
**
)
params
->
berval
);
}
static
NTSTATUS
wrap_ber_free
(
void
*
args
)
{
struct
ber_free_params
*
params
=
args
;
ber_free
(
params
->
ber
,
params
->
freebuf
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ber_init
(
void
*
args
)
{
struct
ber_init_params
*
params
=
args
;
*
params
->
ret
=
ber_init
(
(
struct
berval
*
)
params
->
berval
);
return
*
params
->
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
NTSTATUS
wrap_ber_next_element
(
void
*
args
)
{
struct
ber_next_element_params
*
params
=
args
;
ber_len_t
len
;
ber_tag_t
ret
;
if
((
ret
=
ber_next_element
(
params
->
ber
,
&
len
,
params
->
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
ret
>
~
0u
)
{
ERR
(
"ret too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
if
(
len
>
~
0u
)
{
ERR
(
"len too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
*
params
->
ret_len
=
len
;
return
ret
;
}
static
NTSTATUS
wrap_ber_peek_tag
(
void
*
args
)
{
struct
ber_peek_tag_params
*
params
=
args
;
ber_len_t
len
;
ber_tag_t
ret
;
if
((
ret
=
ber_peek_tag
(
params
->
ber
,
&
len
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
len
>
~
0u
)
{
ERR
(
"len too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
*
params
->
ret_len
=
len
;
return
ret
;
}
static
NTSTATUS
wrap_ber_skip_tag
(
void
*
args
)
{
struct
ber_skip_tag_params
*
params
=
args
;
ber_len_t
len
;
ber_tag_t
ret
;
if
((
ret
=
ber_skip_tag
(
params
->
ber
,
&
len
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
len
>
~
0u
)
{
ERR
(
"len too large
\n
"
);
return
WLDAP32_LBER_ERROR
;
}
*
params
->
ret_len
=
len
;
return
ret
;
}
static
NTSTATUS
wrap_ber_printf
(
void
*
args
)
{
struct
ber_printf_params
*
params
=
args
;
assert
(
strlen
(
params
->
fmt
)
==
1
);
return
ber_printf
(
params
->
ber
,
params
->
fmt
,
params
->
arg1
,
params
->
arg2
);
}
static
NTSTATUS
wrap_ber_scanf
(
void
*
args
)
{
struct
ber_scanf_params
*
params
=
args
;
assert
(
strlen
(
params
->
fmt
)
==
1
);
return
ber_scanf
(
params
->
ber
,
params
->
fmt
,
params
->
arg1
,
params
->
arg2
);
}
static
NTSTATUS
wrap_ldap_abandon_ext
(
void
*
args
)
{
struct
ldap_abandon_ext_params
*
params
=
args
;
return
ldap_abandon_ext
(
params
->
ld
,
params
->
msgid
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_add_ext
(
void
*
args
)
{
struct
ldap_add_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_add_ext
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
attrs
?
(
LDAPMod
**
)
params
->
attrs
:
nullmods
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
NTSTATUS
wrap_ldap_add_ext_s
(
void
*
args
)
{
struct
ldap_add_ext_s_params
*
params
=
args
;
return
ldap_add_ext_s
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
attrs
?
(
LDAPMod
**
)
params
->
attrs
:
nullmods
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_compare_ext
(
void
*
args
)
{
struct
ldap_compare_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_compare_ext
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
attrs
?
params
->
attrs
:
""
,
(
struct
berval
*
)
params
->
value
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
NTSTATUS
wrap_ldap_compare_ext_s
(
void
*
args
)
{
struct
ldap_compare_ext_s_params
*
params
=
args
;
return
ldap_compare_ext_s
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
attrs
?
params
->
attrs
:
""
,
(
struct
berval
*
)
params
->
value
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_control_free
(
void
*
args
)
{
ldap_control_free
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ldap_controls_free
(
void
*
args
)
{
ldap_controls_free
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ldap_count_entries
(
void
*
args
)
{
struct
ldap_count_entries_params
*
params
=
args
;
return
ldap_count_entries
(
params
->
ld
,
params
->
chain
);
}
static
NTSTATUS
wrap_ldap_count_references
(
void
*
args
)
{
struct
ldap_count_references_params
*
params
=
args
;
return
ldap_count_references
(
params
->
ld
,
params
->
chain
);
}
static
NTSTATUS
wrap_ldap_count_values_len
(
void
*
args
)
{
return
ldap_count_values_len
(
args
);
}
static
NTSTATUS
wrap_ldap_create_sort_control
(
void
*
args
)
{
struct
ldap_create_sort_control_params
*
params
=
args
;
return
ldap_create_sort_control
(
params
->
ld
,
(
LDAPSortKey
**
)
params
->
keylist
,
params
->
critical
,
(
LDAPControl
**
)
params
->
control
);
}
static
NTSTATUS
wrap_ldap_create_vlv_control
(
void
*
args
)
{
struct
ldap_create_vlv_control_params
*
params
=
args
;
return
ldap_create_vlv_control
(
params
->
ld
,
(
LDAPVLVInfo
*
)
params
->
info
,
(
LDAPControl
**
)
params
->
control
);
}
static
NTSTATUS
wrap_ldap_delete_ext
(
void
*
args
)
{
struct
ldap_delete_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_delete_ext
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
NTSTATUS
wrap_ldap_delete_ext_s
(
void
*
args
)
{
struct
ldap_delete_ext_s_params
*
params
=
args
;
return
ldap_delete_ext_s
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_dn2ufn
(
void
*
args
)
{
struct
ldap_dn2ufn_params
*
params
=
args
;
*
params
->
ret
=
ldap_dn2ufn
(
params
->
dn
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_explode_dn
(
void
*
args
)
{
struct
ldap_explode_dn_params
*
params
=
args
;
*
params
->
ret
=
ldap_explode_dn
(
params
->
dn
,
params
->
notypes
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_extended_operation
(
void
*
args
)
{
struct
ldap_extended_operation_params
*
params
=
args
;
int
dummy
;
return
ldap_extended_operation
(
params
->
ld
,
params
->
oid
?
params
->
oid
:
""
,
(
struct
berval
*
)
params
->
data
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
NTSTATUS
wrap_ldap_extended_operation_s
(
void
*
args
)
{
struct
ldap_extended_operation_s_params
*
params
=
args
;
return
ldap_extended_operation_s
(
params
->
ld
,
params
->
oid
?
params
->
oid
:
""
,
(
struct
berval
*
)
params
->
data
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
retoid
,
(
struct
berval
**
)
params
->
retdata
);
}
static
NTSTATUS
wrap_ldap_get_dn
(
void
*
args
)
{
struct
ldap_get_dn_params
*
params
=
args
;
*
params
->
ret
=
ldap_get_dn
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_first_attribute
(
void
*
args
)
{
struct
ldap_first_attribute_params
*
params
=
args
;
*
params
->
ret
=
ldap_first_attribute
(
params
->
ld
,
params
->
entry
,
(
BerElement
**
)
params
->
ber
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_first_entry
(
void
*
args
)
{
struct
ldap_first_entry_params
*
params
=
args
;
*
params
->
ret
=
ldap_first_entry
(
params
->
ld
,
params
->
chain
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_first_reference
(
void
*
args
)
{
struct
ldap_first_reference_params
*
params
=
args
;
*
params
->
ret
=
ldap_first_reference
(
params
->
ld
,
params
->
chain
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_get_option
(
void
*
args
)
{
struct
ldap_get_option_params
*
params
=
args
;
return
ldap_get_option
(
params
->
ld
,
params
->
option
,
params
->
value
);
}
static
NTSTATUS
wrap_ldap_get_values_len
(
void
*
args
)
{
struct
ldap_get_values_len_params
*
params
=
args
;
*
params
->
ret
=
(
struct
bervalU
**
)
ldap_get_values_len
(
params
->
ld
,
params
->
entry
,
params
->
attr
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_initialize
(
void
*
args
)
{
struct
ldap_initialize_params
*
params
=
args
;
return
ldap_initialize
(
(
LDAP
**
)
params
->
ld
,
params
->
url
);
}
static
NTSTATUS
wrap_ldap_memfree
(
void
*
args
)
{
ldap_memfree
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ldap_memvfree
(
void
*
args
)
{
ldap_memvfree
(
args
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
wrap_ldap_modify_ext
(
void
*
args
)
{
struct
ldap_modify_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_modify_ext
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
mods
?
(
LDAPMod
**
)
params
->
mods
:
nullmods
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
NTSTATUS
wrap_ldap_modify_ext_s
(
void
*
args
)
{
struct
ldap_modify_ext_s_params
*
params
=
args
;
return
ldap_modify_ext_s
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
mods
?
(
LDAPMod
**
)
params
->
mods
:
nullmods
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_msgfree
(
void
*
args
)
{
return
ldap_msgfree
(
args
);
}
static
NTSTATUS
wrap_ldap_next_attribute
(
void
*
args
)
{
struct
ldap_next_attribute_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_attribute
(
params
->
ld
,
params
->
entry
,
params
->
ber
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_next_entry
(
void
*
args
)
{
struct
ldap_next_entry_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_entry
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_next_reference
(
void
*
args
)
{
struct
ldap_next_reference_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_reference
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
NTSTATUS
wrap_ldap_parse_extended_result
(
void
*
args
)
{
struct
ldap_parse_extended_result_params
*
params
=
args
;
return
ldap_parse_extended_result
(
params
->
ld
,
params
->
result
,
params
->
retoid
,
(
struct
berval
**
)
params
->
retdata
,
params
->
free
);
}
static
NTSTATUS
wrap_ldap_parse_reference
(
void
*
args
)
{
struct
ldap_parse_reference_params
*
params
=
args
;
return
ldap_parse_reference
(
params
->
ld
,
params
->
ref
,
params
->
referrals
,
(
LDAPControl
***
)
params
->
serverctrls
,
params
->
free
);
}
static
NTSTATUS
wrap_ldap_parse_result
(
void
*
args
)
{
struct
ldap_parse_result_params
*
params
=
args
;
return
ldap_parse_result
(
params
->
ld
,
params
->
res
,
params
->
errcode
,
params
->
matcheddn
,
params
->
errmsg
,
params
->
referrals
,
(
LDAPControl
***
)
params
->
serverctrls
,
params
->
free
);
}
static
NTSTATUS
wrap_ldap_parse_sortresponse_control
(
void
*
args
)
{
struct
ldap_parse_sortresponse_control_params
*
params
=
args
;
return
ldap_parse_sortresponse_control
(
params
->
ld
,
(
LDAPControl
*
)
params
->
ctrl
,
params
->
result
,
params
->
attr
);
}
static
NTSTATUS
wrap_ldap_parse_vlvresponse_control
(
void
*
args
)
{
struct
ldap_parse_vlvresponse_control_params
*
params
=
args
;
return
ldap_parse_vlvresponse_control
(
params
->
ld
,
(
LDAPControl
*
)
params
->
ctrls
,
params
->
target_pos
,
params
->
list_count
,
(
struct
berval
**
)
params
->
ctx
,
params
->
errcode
);
}
static
NTSTATUS
wrap_ldap_rename
(
void
*
args
)
{
struct
ldap_rename_params
*
params
=
args
;
return
ldap_rename
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
newrdn
,
params
->
newparent
,
params
->
delete
,
(
LDAPControl
**
)
params
->
clientctrls
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
int
*
)
params
->
msg
);
}
static
NTSTATUS
wrap_ldap_rename_s
(
void
*
args
)
{
struct
ldap_rename_s_params
*
params
=
args
;
return
ldap_rename_s
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
params
->
newrdn
,
params
->
newparent
,
params
->
delete
,
(
LDAPControl
**
)
params
->
clientctrls
,
(
LDAPControl
**
)
params
->
serverctrls
);
}
static
NTSTATUS
wrap_ldap_result
(
void
*
args
)
{
struct
ldap_result_params
*
params
=
args
;
struct
timeval
tv
;
return
ldap_result
(
params
->
ld
,
params
->
msgid
,
params
->
all
,
convert_timeval
(
params
->
timeout
,
&
tv
),
(
LDAPMessage
**
)
params
->
result
);
}
static
NTSTATUS
wrap_ldap_sasl_bind
(
void
*
args
)
{
struct
ldap_sasl_bind_params
*
params
=
args
;
return
ldap_sasl_bind
(
params
->
ld
,
params
->
dn
,
params
->
mech
,
(
struct
berval
*
)
params
->
cred
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msgid
);
}
static
NTSTATUS
wrap_ldap_sasl_bind_s
(
void
*
args
)
{
struct
ldap_sasl_bind_s_params
*
params
=
args
;
return
ldap_sasl_bind_s
(
params
->
ld
,
params
->
dn
,
params
->
mech
,
(
struct
berval
*
)
params
->
cred
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
(
struct
berval
**
)
params
->
servercred
);
}
static
int
wrap_sasl_interact
(
LDAP
*
ld
,
unsigned
int
flags
,
void
*
defaults
,
void
*
interact
)
{
#ifdef HAVE_SASL_SASL_H
struct
sasl_interactive_bind_id
*
id
=
defaults
;
struct
sasl_interact
*
sasl
=
interact
;
TRACE
(
"(%p, 0x%08x, %p, %p)
\n
"
,
ld
,
flags
,
defaults
,
interact
);
while
(
sasl
->
id
!=
SASL_CB_LIST_END
)
{
TRACE
(
"sasl->id = %04lx
\n
"
,
sasl
->
id
);
if
(
sasl
->
id
==
SASL_CB_GETREALM
)
{
sasl
->
result
=
id
->
domain
;
sasl
->
len
=
id
->
domain_len
;
}
else
if
(
sasl
->
id
==
SASL_CB_USER
)
{
sasl
->
result
=
id
->
user
;
sasl
->
len
=
id
->
user_len
;
}
else
if
(
sasl
->
id
==
SASL_CB_PASS
)
{
sasl
->
result
=
id
->
password
;
sasl
->
len
=
id
->
password_len
;
}
sasl
++
;
}
return
LDAP_SUCCESS
;
#endif
return
-
1
;
}
static
NTSTATUS
wrap_ldap_sasl_interactive_bind_s
(
void
*
args
)
{
struct
ldap_sasl_interactive_bind_s_params
*
params
=
args
;
return
ldap_sasl_interactive_bind_s
(
params
->
ld
,
params
->
dn
,
params
->
mech
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
flags
,
wrap_sasl_interact
,
params
->
defaults
);
}
static
NTSTATUS
wrap_ldap_search_ext
(
void
*
args
)
{
struct
ldap_search_ext_params
*
params
=
args
;
struct
timeval
tv
;
return
ldap_search_ext
(
params
->
ld
,
params
->
base
,
params
->
scope
,
params
->
filter
,
params
->
attrs
,
params
->
attrsonly
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
convert_timeval
(
params
->
timeout
,
&
tv
),
params
->
sizelimit
,
(
int
*
)
params
->
msg
);
}
static
NTSTATUS
wrap_ldap_search_ext_s
(
void
*
args
)
{
struct
ldap_search_ext_s_params
*
params
=
args
;
struct
timeval
tv
;
return
ldap_search_ext_s
(
params
->
ld
,
params
->
base
,
params
->
scope
,
params
->
filter
,
params
->
attrs
,
params
->
attrsonly
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
convert_timeval
(
params
->
timeout
,
&
tv
),
params
->
sizelimit
,
(
LDAPMessage
**
)
params
->
result
);
}
static
NTSTATUS
wrap_ldap_set_option
(
void
*
args
)
{
struct
ldap_set_option_params
*
params
=
args
;
return
ldap_set_option
(
params
->
ld
,
params
->
option
,
params
->
value
);
}
static
NTSTATUS
wrap_ldap_start_tls_s
(
void
*
args
)
{
struct
ldap_start_tls_s_params
*
params
=
args
;
return
ldap_start_tls_s
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_unbind_ext
(
void
*
args
)
{
struct
ldap_unbind_ext_params
*
params
=
args
;
return
ldap_unbind_ext
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_unbind_ext_s
(
void
*
args
)
{
struct
ldap_unbind_ext_s_params
*
params
=
args
;
return
ldap_unbind_ext_s
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
NTSTATUS
wrap_ldap_value_free_len
(
void
*
args
)
{
ldap_value_free_len
(
args
);
return
STATUS_SUCCESS
;
}
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
wrap_ber_alloc_t
,
wrap_ber_bvecfree
,
wrap_ber_bvfree
,
wrap_ber_first_element
,
wrap_ber_flatten
,
wrap_ber_free
,
wrap_ber_init
,
wrap_ber_next_element
,
wrap_ber_peek_tag
,
wrap_ber_printf
,
wrap_ber_scanf
,
wrap_ber_skip_tag
,
wrap_ldap_abandon_ext
,
wrap_ldap_add_ext
,
wrap_ldap_add_ext_s
,
wrap_ldap_compare_ext
,
wrap_ldap_compare_ext_s
,
wrap_ldap_control_free
,
wrap_ldap_controls_free
,
wrap_ldap_count_entries
,
wrap_ldap_count_references
,
wrap_ldap_count_values_len
,
wrap_ldap_create_sort_control
,
wrap_ldap_create_vlv_control
,
wrap_ldap_delete_ext
,
wrap_ldap_delete_ext_s
,
wrap_ldap_dn2ufn
,
wrap_ldap_explode_dn
,
wrap_ldap_extended_operation
,
wrap_ldap_extended_operation_s
,
wrap_ldap_first_attribute
,
wrap_ldap_first_entry
,
wrap_ldap_first_reference
,
wrap_ldap_get_dn
,
wrap_ldap_get_option
,
wrap_ldap_get_values_len
,
wrap_ldap_initialize
,
wrap_ldap_memfree
,
wrap_ldap_memvfree
,
wrap_ldap_modify_ext
,
wrap_ldap_modify_ext_s
,
wrap_ldap_msgfree
,
wrap_ldap_next_attribute
,
wrap_ldap_next_entry
,
wrap_ldap_next_reference
,
wrap_ldap_parse_extended_result
,
wrap_ldap_parse_reference
,
wrap_ldap_parse_result
,
wrap_ldap_parse_sortresponse_control
,
wrap_ldap_parse_vlvresponse_control
,
wrap_ldap_rename
,
wrap_ldap_rename_s
,
wrap_ldap_result
,
wrap_ldap_sasl_bind
,
wrap_ldap_sasl_bind_s
,
wrap_ldap_sasl_interactive_bind_s
,
wrap_ldap_search_ext
,
wrap_ldap_search_ext_s
,
wrap_ldap_set_option
,
wrap_ldap_start_tls_s
,
wrap_ldap_unbind_ext
,
wrap_ldap_unbind_ext_s
,
wrap_ldap_value_free_len
,
};
#endif
/* HAVE_LDAP */
dlls/wldap32/libldap.h
deleted
100644 → 0
View file @
17021e53
/*
* Copyright 2021 Hans Leidekker for CodeWeavers
*
* 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 "wine/unixlib.h"
/* compatible with structures defined in ldap.h */
typedef
struct
bervalU
{
ULONG_PTR
bv_len
;
char
*
bv_val
;
}
BerValueU
;
typedef
struct
{
int
mod_op
;
char
*
mod_type
;
union
{
char
**
modv_strvals
;
struct
bervalU
**
modv_bvals
;
}
mod_vals
;
}
LDAPModU
;
typedef
struct
{
char
*
ldctl_oid
;
struct
bervalU
ldctl_value
;
char
ldctl_iscritical
;
}
LDAPControlU
;
typedef
struct
{
char
*
attributeType
;
char
*
orderingRule
;
int
reverseOrder
;
}
LDAPSortKeyU
;
typedef
struct
{
int
ldvlv_version
;
int
ldvlv_before_count
;
int
ldvlv_after_count
;
int
ldvlv_offset
;
int
ldvlv_count
;
struct
bervalU
*
ldvlv_attrvalue
;
struct
bervalU
*
ldvlv_context
;
void
*
ldvlv_extradata
;
}
LDAPVLVInfoU
;
typedef
struct
{
int
ldapai_info_version
;
int
ldapai_api_version
;
int
ldapai_protocol_version
;
char
**
ldapai_extensions
;
char
*
ldapai_vendor_name
;
int
ldapai_vendor_version
;
}
LDAPAPIInfoU
;
typedef
struct
{
int
ldapaif_info_version
;
char
*
ldapaif_name
;
int
ldapaif_version
;
}
LDAPAPIFeatureInfoU
;
typedef
struct
timevalU
{
LONG_PTR
tv_sec
;
LONG_PTR
tv_usec
;
}
LDAP_TIMEVALU
;
struct
sasl_interactive_bind_id
{
unsigned
char
*
user
;
ULONG
user_len
;
unsigned
char
*
domain
;
ULONG
domain_len
;
unsigned
char
*
password
;
ULONG
password_len
;
};
/* FIXME: we should not be directly returning pointers allocated by the Unix libldap */
struct
ber_alloc_t_params
{
int
options
;
void
**
ret
;
};
struct
ber_first_element_params
{
void
*
ber
;
unsigned
int
*
ret_len
;
char
**
last
;
};
struct
ber_flatten_params
{
void
*
ber
;
struct
bervalU
**
berval
;
};
struct
ber_free_params
{
void
*
ber
;
int
freebuf
;
};
struct
ber_init_params
{
struct
bervalU
*
berval
;
void
**
ret
;
};
struct
ber_next_element_params
{
void
*
ber
;
unsigned
int
*
ret_len
;
char
*
last
;
};
struct
ber_peek_tag_params
{
void
*
ber
;
unsigned
int
*
ret_len
;
};
struct
ber_printf_params
{
void
*
ber
;
char
*
fmt
;
ULONG_PTR
arg1
;
ULONG_PTR
arg2
;
};
struct
ber_scanf_params
{
void
*
ber
;
char
*
fmt
;
void
*
arg1
;
void
*
arg2
;
};
struct
ber_skip_tag_params
{
void
*
ber
;
unsigned
int
*
ret_len
;
};
struct
ldap_abandon_ext_params
{
void
*
ld
;
int
msgid
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_add_ext_params
{
void
*
ld
;
const
char
*
dn
;
LDAPModU
**
attrs
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
ULONG
*
msg
;
};
struct
ldap_add_ext_s_params
{
void
*
ld
;
const
char
*
dn
;
LDAPModU
**
attrs
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_compare_ext_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
attrs
;
struct
bervalU
*
value
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
ULONG
*
msg
;
};
struct
ldap_compare_ext_s_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
attrs
;
struct
bervalU
*
value
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_count_entries_params
{
void
*
ld
;
void
*
chain
;
};
struct
ldap_count_references_params
{
void
*
ld
;
void
*
chain
;
};
struct
ldap_create_sort_control_params
{
void
*
ld
;
LDAPSortKeyU
**
keylist
;
int
critical
;
LDAPControlU
**
control
;
};
struct
ldap_create_vlv_control_params
{
void
*
ld
;
LDAPVLVInfoU
*
info
;
LDAPControlU
**
control
;
};
struct
ldap_delete_ext_params
{
void
*
ld
;
const
char
*
dn
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
ULONG
*
msg
;
};
struct
ldap_delete_ext_s_params
{
void
*
ld
;
const
char
*
dn
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_dn2ufn_params
{
const
char
*
dn
;
char
**
ret
;
};
struct
ldap_explode_dn_params
{
const
char
*
dn
;
int
notypes
;
char
***
ret
;
};
struct
ldap_extended_operation_params
{
void
*
ld
;
const
char
*
oid
;
struct
bervalU
*
data
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
ULONG
*
msg
;
};
struct
ldap_extended_operation_s_params
{
void
*
ld
;
const
char
*
oid
;
struct
bervalU
*
data
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
char
**
retoid
;
struct
bervalU
**
retdata
;
};
struct
ldap_first_attribute_params
{
void
*
ld
;
void
*
entry
;
void
**
ber
;
char
**
ret
;
};
struct
ldap_first_entry_params
{
void
*
ld
;
void
*
chain
;
void
**
ret
;
};
struct
ldap_first_reference_params
{
void
*
ld
;
void
*
chain
;
void
**
ret
;
};
struct
ldap_get_dn_params
{
void
*
ld
;
void
*
entry
;
char
**
ret
;
};
struct
ldap_get_option_params
{
void
*
ld
;
int
option
;
void
*
value
;
};
struct
ldap_get_values_len_params
{
void
*
ld
;
void
*
entry
;
const
char
*
attr
;
struct
bervalU
***
ret
;
};
struct
ldap_initialize_params
{
void
**
ld
;
const
char
*
url
;
};
struct
ldap_modify_ext_params
{
void
*
ld
;
const
char
*
dn
;
LDAPModU
**
mods
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
ULONG
*
msg
;
};
struct
ldap_modify_ext_s_params
{
void
*
ld
;
const
char
*
dn
;
LDAPModU
**
mods
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_next_attribute_params
{
void
*
ld
;
void
*
entry
;
void
*
ber
;
char
**
ret
;
};
struct
ldap_next_entry_params
{
void
*
ld
;
void
*
entry
;
void
**
ret
;
};
struct
ldap_next_reference_params
{
void
*
ld
;
void
*
entry
;
void
**
ret
;
};
struct
ldap_parse_extended_result_params
{
void
*
ld
;
void
*
result
;
char
**
retoid
;
struct
bervalU
**
retdata
;
int
free
;
};
struct
ldap_parse_reference_params
{
void
*
ld
;
void
*
ref
;
char
***
referrals
;
LDAPControlU
***
serverctrls
;
int
free
;
};
struct
ldap_parse_result_params
{
void
*
ld
;
void
*
res
;
int
*
errcode
;
char
**
matcheddn
;
char
**
errmsg
;
char
***
referrals
;
LDAPControlU
***
serverctrls
;
int
free
;
};
struct
ldap_parse_sortresponse_control_params
{
void
*
ld
;
LDAPControlU
*
ctrl
;
int
*
result
;
char
**
attr
;
};
struct
ldap_parse_vlvresponse_control_params
{
void
*
ld
;
LDAPControlU
*
ctrls
;
int
*
target_pos
;
int
*
list_count
;
struct
bervalU
**
ctx
;
int
*
errcode
;
};
struct
ldap_rename_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
newrdn
;
const
char
*
newparent
;
int
delete
;
LDAPControlU
**
clientctrls
;
LDAPControlU
**
serverctrls
;
ULONG
*
msg
;
};
struct
ldap_rename_s_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
newrdn
;
const
char
*
newparent
;
int
delete
;
LDAPControlU
**
clientctrls
;
LDAPControlU
**
serverctrls
;
};
struct
ldap_result_params
{
void
*
ld
;
int
msgid
;
int
all
;
struct
timevalU
*
timeout
;
void
**
result
;
};
struct
ldap_sasl_bind_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
mech
;
struct
bervalU
*
cred
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
int
*
msgid
;
};
struct
ldap_sasl_bind_s_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
mech
;
struct
bervalU
*
cred
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
struct
bervalU
**
servercred
;
};
struct
ldap_sasl_interactive_bind_s_params
{
void
*
ld
;
const
char
*
dn
;
const
char
*
mech
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
unsigned
int
flags
;
void
*
defaults
;
};
struct
ldap_search_ext_params
{
void
*
ld
;
const
char
*
base
;
int
scope
;
const
char
*
filter
;
char
**
attrs
;
int
attrsonly
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
struct
timevalU
*
timeout
;
int
sizelimit
;
ULONG
*
msg
;
};
struct
ldap_search_ext_s_params
{
void
*
ld
;
const
char
*
base
;
int
scope
;
const
char
*
filter
;
char
**
attrs
;
int
attrsonly
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
struct
timevalU
*
timeout
;
int
sizelimit
;
void
**
result
;
};
struct
ldap_set_option_params
{
void
*
ld
;
int
option
;
const
void
*
value
;
};
struct
ldap_start_tls_s_params
{
void
*
ld
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_unbind_ext_params
{
void
*
ld
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
struct
ldap_unbind_ext_s_params
{
void
*
ld
;
LDAPControlU
**
serverctrls
;
LDAPControlU
**
clientctrls
;
};
enum
unix_ldap_funcs
{
unix_ber_alloc_t
,
unix_ber_bvecfree
,
unix_ber_bvfree
,
unix_ber_first_element
,
unix_ber_flatten
,
unix_ber_free
,
unix_ber_init
,
unix_ber_next_element
,
unix_ber_peek_tag
,
unix_ber_printf
,
unix_ber_scanf
,
unix_ber_skip_tag
,
unix_ldap_abandon_ext
,
unix_ldap_add_ext
,
unix_ldap_add_ext_s
,
unix_ldap_compare_ext
,
unix_ldap_compare_ext_s
,
unix_ldap_control_free
,
unix_ldap_controls_free
,
unix_ldap_count_entries
,
unix_ldap_count_references
,
unix_ldap_count_values_len
,
unix_ldap_create_sort_control
,
unix_ldap_create_vlv_control
,
unix_ldap_delete_ext
,
unix_ldap_delete_ext_s
,
unix_ldap_dn2ufn
,
unix_ldap_explode_dn
,
unix_ldap_extended_operation
,
unix_ldap_extended_operation_s
,
unix_ldap_first_attribute
,
unix_ldap_first_entry
,
unix_ldap_first_reference
,
unix_ldap_get_dn
,
unix_ldap_get_option
,
unix_ldap_get_values_len
,
unix_ldap_initialize
,
unix_ldap_memfree
,
unix_ldap_memvfree
,
unix_ldap_modify_ext
,
unix_ldap_modify_ext_s
,
unix_ldap_msgfree
,
unix_ldap_next_attribute
,
unix_ldap_next_entry
,
unix_ldap_next_reference
,
unix_ldap_parse_extended_result
,
unix_ldap_parse_reference
,
unix_ldap_parse_result
,
unix_ldap_parse_sortresponse_control
,
unix_ldap_parse_vlvresponse_control
,
unix_ldap_rename
,
unix_ldap_rename_s
,
unix_ldap_result
,
unix_ldap_sasl_bind
,
unix_ldap_sasl_bind_s
,
unix_ldap_sasl_interactive_bind_s
,
unix_ldap_search_ext
,
unix_ldap_search_ext_s
,
unix_ldap_set_option
,
unix_ldap_start_tls_s
,
unix_ldap_unbind_ext
,
unix_ldap_unbind_ext_s
,
unix_ldap_value_free_len
,
};
extern
unixlib_handle_t
ldap_handle
DECLSPEC_HIDDEN
;
#define LDAP_CALL( func, params ) __wine_unix_call( ldap_handle, unix_ ## func, params )
dlls/wldap32/main.c
View file @
d08d6f51
...
...
@@ -24,14 +24,11 @@
#include "winbase.h"
#include "wine/debug.h"
#include "libldap.h"
HINSTANCE
hwldap32
;
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
unixlib_handle_t
ldap_handle
=
0
;
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
LPVOID
reserved
)
{
TRACE
(
"(%p, %#lx, %p)
\n
"
,
hinst
,
reason
,
reserved
);
...
...
@@ -41,9 +38,6 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
case
DLL_PROCESS_ATTACH
:
hwldap32
=
hinst
;
DisableThreadLibraryCalls
(
hinst
);
if
(
NtQueryVirtualMemory
(
GetCurrentProcess
(),
hinst
,
MemoryWineUnixFuncs
,
&
ldap_handle
,
sizeof
(
ldap_handle
),
NULL
))
ERR
(
"No libldap support, expect problems
\n
"
);
break
;
}
return
TRUE
;
...
...
dlls/wldap32/misc.c
View file @
d08d6f51
...
...
@@ -23,7 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "win
ldap
.h"
#include "win
sock2
.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -38,11 +38,7 @@ ULONG CDECL WLDAP32_ldap_abandon( LDAP *ld, ULONG msgid )
TRACE
(
"(%p, %#lx)
\n
"
,
ld
,
msgid
);
if
(
!
ld
)
return
~
0u
;
else
{
struct
ldap_abandon_ext_params
params
=
{
CTX
(
ld
),
msgid
};
return
map_error
(
LDAP_CALL
(
ldap_abandon_ext
,
&
params
));
}
return
map_error
(
ldap_abandon_ext
(
CTX
(
ld
),
msgid
,
NULL
,
NULL
)
);
}
/***********************************************************************
...
...
@@ -87,7 +83,7 @@ ULONG CDECL ldap_cleanup( HANDLE instance )
/***********************************************************************
* ldap_conn_from_msg (WLDAP32.@)
*/
LDAP
*
CDECL
ldap_conn_from_msg
(
LDAP
*
ld
,
LDAPMessage
*
res
)
LDAP
*
CDECL
ldap_conn_from_msg
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
res
)
{
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
...
...
@@ -98,31 +94,23 @@ LDAP * CDECL ldap_conn_from_msg( LDAP *ld, LDAPMessage *res )
/***********************************************************************
* ldap_count_entries (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_count_entries
(
LDAP
*
ld
,
LDAPMessage
*
res
)
ULONG
CDECL
WLDAP32_ldap_count_entries
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
res
)
{
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
)
return
~
0u
;
else
{
struct
ldap_count_entries_params
params
=
{
CTX
(
ld
),
MSG
(
res
)
};
return
LDAP_CALL
(
ldap_count_entries
,
&
params
);
}
return
ldap_count_entries
(
CTX
(
ld
),
MSG
(
res
)
);
}
/***********************************************************************
* ldap_count_references (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_count_references
(
LDAP
*
ld
,
LDAPMessage
*
res
)
ULONG
CDECL
WLDAP32_ldap_count_references
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
res
)
{
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
)
return
0
;
else
{
struct
ldap_count_references_params
params
=
{
CTX
(
ld
),
MSG
(
res
)
};
return
LDAP_CALL
(
ldap_count_references
,
&
params
);
}
return
ldap_count_references
(
CTX
(
ld
),
MSG
(
res
)
);
}
static
ULONG
get_escape_size
(
PCHAR
src
,
ULONG
srclen
)
...
...
@@ -196,7 +184,7 @@ ULONG CDECL ldap_escape_filter_elementW( char *src, ULONG srclen, WCHAR *dst, UL
/***********************************************************************
* ldap_first_attributeA (WLDAP32.@)
*/
char
*
CDECL
ldap_first_attributeA
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
BerElement
**
ber
)
char
*
CDECL
ldap_first_attributeA
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
entry
,
WLDAP32_
BerElement
**
ber
)
{
char
*
ret
=
NULL
;
WCHAR
*
retW
;
...
...
@@ -218,72 +206,60 @@ char * CDECL ldap_first_attributeA( LDAP *ld, LDAPMessage *entry, BerElement **b
/***********************************************************************
* ldap_first_attributeW (WLDAP32.@)
*/
WCHAR
*
CDECL
ldap_first_attributeW
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
BerElement
**
ptr
)
WCHAR
*
CDECL
ldap_first_attributeW
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
entry
,
WLDAP32_
BerElement
**
ptr
)
{
WCHAR
*
ret
=
NULL
;
BerElement
*
ber
;
WLDAP32_
BerElement
*
ber
;
char
*
retU
;
void
*
berU
;
BerElement
*
berU
;
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
entry
,
ptr
);
if
(
ld
&&
entry
)
{
struct
ldap_first_attribute_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
berU
,
&
retU
};
LDAP_CALL
(
ldap_first_attribute
,
&
params
);
}
if
(
ld
&&
entry
)
retU
=
ldap_first_attribute
(
CTX
(
ld
),
MSG
(
entry
),
&
berU
);
else
return
NULL
;
if
(
retU
&&
(
ber
=
malloc
(
sizeof
(
*
ber
)
)))
{
BER
(
ber
)
=
(
char
*
)
berU
;
ber
->
opaque
=
(
char
*
)
berU
;
*
ptr
=
ber
;
ret
=
strUtoW
(
retU
);
}
LDAP_CALL
(
ldap_memfree
,
retU
);
ldap_memfree
(
retU
);
return
ret
;
}
/***********************************************************************
* ldap_first_entry (WLDAP32.@)
*/
LDAPMessage
*
CDECL
WLDAP32_ldap_first_entry
(
LDAP
*
ld
,
LDAPMessage
*
res
)
*/
WLDAP32_LDAPMessage
*
CDECL
WLDAP32_ldap_first_entry
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
res
)
{
void
*
msgU
;
LDAPMessage
*
msgU
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
ld
&&
res
)
{
struct
ldap_first_entry_params
params
=
{
CTX
(
ld
),
MSG
(
res
),
&
msgU
};
if
(
!
LDAP_CALL
(
ldap_first_entry
,
&
params
))
if
(
ld
&&
res
&&
(
msgU
=
ldap_first_entry
(
CTX
(
ld
),
MSG
(
res
)
)))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
}
}
return
NULL
;
}
/***********************************************************************
* ldap_first_reference (WLDAP32.@)
*/
LDAPMessage
*
CDECL
WLDAP32_ldap_first_reference
(
LDAP
*
ld
,
LDAPMessage
*
res
)
WLDAP32_LDAPMessage
*
CDECL
WLDAP32_ldap_first_reference
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
res
)
{
void
*
msgU
;
LDAPMessage
*
msgU
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
ld
)
{
struct
ldap_first_reference_params
params
=
{
CTX
(
ld
),
MSG
(
res
),
&
msgU
};
if
(
!
LDAP_CALL
(
ldap_first_reference
,
&
params
))
if
(
ld
&&
(
msgU
=
ldap_first_reference
(
CTX
(
ld
),
MSG
(
res
)
)))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
}
}
return
NULL
;
}
...
...
@@ -308,15 +284,15 @@ void CDECL ldap_memfreeW( WCHAR *block )
/***********************************************************************
* ldap_msgfree (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_msgfree
(
LDAPMessage
*
res
)
ULONG
CDECL
WLDAP32_ldap_msgfree
(
WLDAP32_
LDAPMessage
*
res
)
{
LDAPMessage
*
entry
,
*
list
=
res
;
WLDAP32_
LDAPMessage
*
entry
,
*
list
=
res
;
TRACE
(
"(%p)
\n
"
,
res
);
if
(
!
res
)
return
WLDAP32_LDAP_SUCCESS
;
LDAP_CALL
(
ldap_msgfree
,
MSG
(
res
)
);
ldap_msgfree
(
MSG
(
res
)
);
while
(
list
)
{
entry
=
list
;
...
...
@@ -330,7 +306,7 @@ ULONG CDECL WLDAP32_ldap_msgfree( LDAPMessage *res )
/***********************************************************************
* ldap_next_attributeA (WLDAP32.@)
*/
char
*
CDECL
ldap_next_attributeA
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
BerElement
*
ptr
)
char
*
CDECL
ldap_next_attributeA
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
entry
,
WLDAP32_
BerElement
*
ptr
)
{
char
*
ret
=
NULL
;
WCHAR
*
retW
;
...
...
@@ -352,21 +328,17 @@ char * CDECL ldap_next_attributeA( LDAP *ld, LDAPMessage *entry, BerElement *ptr
/***********************************************************************
* ldap_next_attributeW (WLDAP32.@)
*/
WCHAR
*
CDECL
ldap_next_attributeW
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
BerElement
*
ptr
)
WCHAR
*
CDECL
ldap_next_attributeW
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
entry
,
WLDAP32_
BerElement
*
ptr
)
{
WCHAR
*
ret
=
NULL
;
char
*
retU
;
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
entry
,
ptr
);
if
(
ld
&&
entry
&&
ptr
)
{
struct
ldap_next_attribute_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
),
&
retU
};
if
(
!
LDAP_CALL
(
ldap_next_attribute
,
&
params
))
if
(
ld
&&
entry
&&
ptr
&&
(
retU
=
ldap_next_attribute
(
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
)
)))
{
ret
=
strUtoW
(
retU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
}
ldap_memfree
(
retU
);
}
return
ret
;
}
...
...
@@ -374,22 +346,18 @@ WCHAR * CDECL ldap_next_attributeW( LDAP *ld, LDAPMessage *entry, BerElement *pt
/***********************************************************************
* ldap_next_entry (WLDAP32.@)
*/
LDAPMessage
*
CDECL
WLDAP32_ldap_next_entry
(
LDAP
*
ld
,
LDAPMessage
*
entry
)
WLDAP32_LDAPMessage
*
CDECL
WLDAP32_ldap_next_entry
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
entry
)
{
LDAPMessage
*
msg
=
NULL
;
void
*
msgU
;
WLDAP32_
LDAPMessage
*
msg
=
NULL
;
LDAPMessage
*
msgU
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
entry
);
if
(
!
ld
||
!
entry
)
return
NULL
;
if
(
entry
->
lm_next
)
return
entry
->
lm_next
;
else
{
struct
ldap_next_entry_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
msgU
};
LDAP_CALL
(
ldap_next_entry
,
&
params
);
}
msgU
=
ldap_next_entry
(
CTX
(
ld
),
MSG
(
entry
)
);
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
@@ -402,21 +370,18 @@ LDAPMessage * CDECL WLDAP32_ldap_next_entry( LDAP *ld, LDAPMessage *entry )
/***********************************************************************
* ldap_next_reference (WLDAP32.@)
*/
LDAPMessage
*
CDECL
WLDAP32_ldap_next_reference
(
LDAP
*
ld
,
LDAPMessage
*
entry
)
WLDAP32_LDAPMessage
*
CDECL
WLDAP32_ldap_next_reference
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
entry
)
{
LDAPMessage
*
msg
=
NULL
;
void
*
msgU
;
WLDAP32_
LDAPMessage
*
msg
=
NULL
;
LDAPMessage
*
msgU
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
entry
);
if
(
!
ld
||
!
entry
)
return
NULL
;
if
(
entry
->
lm_next
)
return
entry
->
lm_next
;
else
{
struct
ldap_next_reference_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
msgU
};
LDAP_CALL
(
ldap_next_reference
,
&
params
);
}
msgU
=
ldap_next_reference
(
CTX
(
ld
),
MSG
(
entry
)
);
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
@@ -429,26 +394,24 @@ LDAPMessage * CDECL WLDAP32_ldap_next_reference( LDAP *ld, LDAPMessage *entry )
/***********************************************************************
* ldap_result (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_result
(
LDAP
*
ld
,
ULONG
msgid
,
ULONG
all
,
struct
l_timeval
*
timeout
,
LDAPMessage
**
res
)
ULONG
CDECL
WLDAP32_ldap_result
(
LDAP
*
ld
,
ULONG
msgid
,
ULONG
all
,
struct
l_timeval
*
timeout
,
WLDAP32_
LDAPMessage
**
res
)
{
LDAPMessage
*
msg
;
struct
timeval
U
timeval
;
void
*
msgU
=
NULL
;
WLDAP32_
LDAPMessage
*
msg
;
struct
timeval
timeval
;
LDAPMessage
*
msgU
=
NULL
;
ULONG
ret
=
~
0u
;
TRACE
(
"(%p, %#lx, %#lx, %p, %p)
\n
"
,
ld
,
msgid
,
all
,
timeout
,
res
);
if
(
ld
&&
res
&&
msgid
!=
~
0u
)
{
struct
ldap_result_params
params
=
{
CTX
(
ld
),
msgid
,
all
,
timeout
?
&
timeval
:
NULL
,
&
msgU
};
if
(
timeout
)
{
timeval
.
tv_sec
=
timeout
->
tv_sec
;
timeval
.
tv_usec
=
timeout
->
tv_usec
;
}
ret
=
LDAP_CALL
(
ldap_result
,
&
params
);
ret
=
ldap_result
(
CTX
(
ld
),
msgid
,
all
,
timeout
?
&
timeval
:
NULL
,
&
msgU
);
}
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
...
...
dlls/wldap32/modify.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -105,8 +104,8 @@ ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPMod
U
**
modsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPMod
**
modsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
mods
,
serverctrls
,
clientctrls
,
message
);
...
...
@@ -118,8 +117,7 @@ ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_modify_ext_params
params
=
{
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_modify_ext
,
&
params
));
ret
=
map_error
(
ldap_modify_ext
(
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
...
...
@@ -168,8 +166,8 @@ ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPContro
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPMod
U
**
modsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPMod
**
modsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
mods
,
serverctrls
,
clientctrls
);
...
...
@@ -181,8 +179,7 @@ ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPContro
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_modify_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_modify_ext_s
,
&
params
));
ret
=
map_error
(
ldap_modify_ext_s
(
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
)
);
}
exit:
...
...
dlls/wldap32/modrdn.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -91,7 +90,7 @@ ULONG CDECL ldap_modrdn2W( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
newdnU
=
NULL
;
ULONG
msg
;
int
msg
;
TRACE
(
"(%p, %s, %p, 0x%02x)
\n
"
,
ld
,
debugstr_w
(
dn
),
newdn
,
delete
);
...
...
@@ -101,8 +100,7 @@ ULONG CDECL ldap_modrdn2W( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
if
((
newdnU
=
strWtoU
(
newdn
)))
{
struct
ldap_rename_params
params
=
{
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
,
&
msg
};
ret
=
LDAP_CALL
(
ldap_rename
,
&
params
);
ret
=
ldap_rename
(
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
ret
=
msg
;
else
...
...
@@ -152,8 +150,7 @@ ULONG CDECL ldap_modrdn2_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
if
((
newdnU
=
strWtoU
(
newdn
)))
{
struct
ldap_rename_s_params
params
=
{
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_rename_s
,
&
params
));
ret
=
map_error
(
ldap_rename_s
(
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
)
);
free
(
newdnU
);
}
free
(
dnU
);
...
...
dlls/wldap32/option.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -161,7 +160,7 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
{
case
WLDAP32_LDAP_OPT_API_FEATURE_INFO
:
{
LDAPAPIFeatureInfo
U
featureU
;
LDAPAPIFeatureInfo
featureU
;
LDAPAPIFeatureInfoW
*
featureW
=
value
;
if
(
!
featureW
->
ldapaif_name
)
return
WLDAP32_LDAP_PARAM_ERROR
;
...
...
@@ -169,9 +168,8 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
featureU
.
ldapaif_info_version
=
featureW
->
ldapaif_info_version
;
if
((
featureU
.
ldapaif_name
=
strWtoU
(
featureW
->
ldapaif_name
)))
{
struct
ldap_get_option_params
params
=
{
CTX
(
ld
),
option
,
&
featureU
};
featureU
.
ldapaif_version
=
0
;
ret
=
map_error
(
LDAP_CALL
(
ldap_get_option
,
&
params
)
);
ret
=
map_error
(
ldap_get_option
(
CTX
(
ld
),
option
,
&
featureU
)
);
}
else
return
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -181,14 +179,13 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
}
case
WLDAP32_LDAP_OPT_API_INFO
:
{
LDAPAPIInfo
U
infoU
;
LDAPAPIInfo
infoU
;
LDAPAPIInfoW
*
infoW
=
value
;
struct
ldap_get_option_params
params
=
{
CTX
(
ld
),
option
,
&
infoU
};
memset
(
&
infoU
,
0
,
sizeof
(
infoU
)
);
infoU
.
ldapai_info_version
=
infoW
->
ldapai_info_version
;
ret
=
map_error
(
LDAP_CALL
(
ldap_get_option
,
&
params
)
);
ret
=
map_error
(
ldap_get_option
(
CTX
(
ld
),
option
,
&
infoU
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
infoW
->
ldapai_api_version
=
infoU
.
ldapai_api_version
;
...
...
@@ -198,13 +195,13 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
infoU
.
ldapai_vendor_name
&&
!
(
infoW
->
ldapai_vendor_name
=
strUtoW
(
infoU
.
ldapai_vendor_name
)))
{
LDAP_CALL
(
ldap_memvfree
,
infoU
.
ldapai_extensions
);
ldap_memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
return
WLDAP32_LDAP_NO_MEMORY
;
}
infoW
->
ldapai_vendor_version
=
infoU
.
ldapai_vendor_version
;
LDAP_CALL
(
ldap_memvfree
,
infoU
.
ldapai_extensions
);
LDAP_CALL
(
ldap_memfree
,
infoU
.
ldapai_vendor_name
);
ldap_memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
ldap_memfree
(
infoU
.
ldapai_vendor_name
);
}
return
ret
;
}
...
...
@@ -216,10 +213,7 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
case
WLDAP32_LDAP_OPT_REFERRALS
:
case
WLDAP32_LDAP_OPT_SIZELIMIT
:
case
WLDAP32_LDAP_OPT_TIMELIMIT
:
{
struct
ldap_get_option_params
params
=
{
CTX
(
ld
),
option
,
value
};
return
map_error
(
LDAP_CALL
(
ldap_get_option
,
&
params
));
}
return
map_error
(
ldap_get_option
(
CTX
(
ld
),
option
,
value
)
);
case
WLDAP32_LDAP_OPT_CACHE_ENABLE
:
case
WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
...
...
@@ -355,38 +349,32 @@ ULONG CDECL ldap_set_optionA( LDAP *ld, int option, void *value )
static
BOOL
query_supported_server_ctrls
(
LDAP
*
ld
)
{
char
*
attrs
[]
=
{
(
char
*
)
"supportedControl"
,
NULL
};
void
*
res
,
*
entry
;
struct
berval
U
**
ctrls
=
SERVER_CTRLS
(
ld
);
LDAPMessage
*
res
,
*
entry
;
struct
berval
**
ctrls
=
SERVER_CTRLS
(
ld
);
ULONG
ret
;
if
(
!
ctrls
)
{
struct
ldap_search_ext_s_params
params
=
{
CTX
(
ld
),
(
char
*
)
""
,
LDAP_SCOPE_BASE
,
(
char
*
)
"(objectClass=*)"
,
attrs
,
FALSE
,
NULL
,
NULL
,
NULL
,
0
,
&
res
};
ret
=
map_error
(
LDAP_CALL
(
ldap_search_ext_s
,
&
params
));
}
else
return
TRUE
;
if
(
ctrls
)
return
TRUE
;
ret
=
map_error
(
ldap_search_ext_s
(
CTX
(
ld
),
(
char
*
)
""
,
WLDAP32_LDAP_SCOPE_BASE
,
(
char
*
)
"(objectClass=*)"
,
attrs
,
FALSE
,
NULL
,
NULL
,
NULL
,
0
,
&
res
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
struct
ldap_first_entry_params
params
=
{
CTX
(
ld
),
res
,
&
entry
};
if
(
!
LDAP_CALL
(
ldap_first_entry
,
&
params
))
if
((
entry
=
ldap_first_entry
(
CTX
(
ld
),
res
)))
{
ULONG
count
,
i
;
struct
ldap_get_values_len_params
get_params
=
{
CTX
(
ld
),
entry
,
attrs
[
0
],
&
ctrls
};
LDAP_CALL
(
ldap_get_values_len
,
&
get_params
);
count
=
LDAP_CALL
(
ldap_count_values_len
,
ctrls
);
ctrls
=
ldap_get_values_len
(
CTX
(
ld
),
entry
,
attrs
[
0
]
);
count
=
ldap_count_values_len
(
ctrls
);
for
(
i
=
0
;
i
<
count
;
i
++
)
TRACE
(
"%lu: %s
\n
"
,
i
,
debugstr_an
(
ctrls
[
i
]
->
bv_val
,
ctrls
[
i
]
->
bv_len
)
);
*
(
struct
berval
U
***
)
&
SERVER_CTRLS
(
ld
)
=
ctrls
;
*
(
struct
berval
***
)
&
SERVER_CTRLS
(
ld
)
=
ctrls
;
}
}
else
return
FALSE
;
LDAP_CALL
(
ldap_msgfree
,
res
);
ldap_msgfree
(
res
);
return
ctrls
!=
NULL
;
}
static
BOOL
is_supported_server_ctrls
(
LDAP
*
ld
,
LDAPControl
U
**
ctrls
)
static
BOOL
is_supported_server_ctrls
(
LDAP
*
ld
,
LDAPControl
**
ctrls
)
{
ULONG
user_count
,
server_count
,
i
,
n
,
supported
=
0
;
...
...
@@ -394,7 +382,7 @@ static BOOL is_supported_server_ctrls( LDAP *ld, LDAPControlU **ctrls )
return
TRUE
;
/* can't verify, let the server handle it on next query */
user_count
=
controlarraylenU
(
ctrls
);
server_count
=
LDAP_CALL
(
ldap_count_values_len
,
SERVER_CTRLS
(
ld
)
);
server_count
=
ldap_count_values_len
(
SERVER_CTRLS
(
ld
)
);
for
(
n
=
0
;
n
<
user_count
;
n
++
)
{
...
...
@@ -402,7 +390,7 @@ static BOOL is_supported_server_ctrls( LDAP *ld, LDAPControlU **ctrls )
for
(
i
=
0
;
i
<
server_count
;
i
++
)
{
struct
berval
U
**
server_ctrls
=
SERVER_CTRLS
(
ld
);
struct
berval
**
server_ctrls
=
SERVER_CTRLS
(
ld
);
if
(
!
strncmp
(
ctrls
[
n
]
->
ldctl_oid
,
server_ctrls
[
i
]
->
bv_val
,
server_ctrls
[
i
]
->
bv_len
))
{
supported
++
;
...
...
@@ -429,28 +417,27 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
{
case
WLDAP32_LDAP_OPT_SERVER_CONTROLS
:
{
LDAPControl
U
**
ctrlsU
;
LDAPControl
**
ctrlsU
;
if
(
!
(
ctrlsU
=
controlarrayWtoU
(
value
)))
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
!
is_supported_server_ctrls
(
ld
,
ctrlsU
))
ret
=
WLDAP32_LDAP_PARAM_ERROR
;
else
{
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
ctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
));
}
ret
=
map_error
(
ldap_set_option
(
CTX
(
ld
),
option
,
ctrlsU
)
);
controlarrayfreeU
(
ctrlsU
);
return
ret
;
}
case
WLDAP32_LDAP_OPT_REFERRALS
:
{
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
LDAP_OPT_ON
};
if
(
value
==
WLDAP32_LDAP_OPT_OFF
)
params
.
value
=
LDAP_OPT_OFF
;
else
FIXME
(
"upgrading referral value %p to WLDAP32_LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)
\n
"
,
value
);
return
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
));
if
(
value
==
WLDAP32_LDAP_OPT_OFF
)
value
=
LDAP_OPT_OFF
;
else
if
(
value
!=
WLDAP32_LDAP_OPT_ON
)
{
FIXME
(
"upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)
\n
"
,
value
);
value
=
LDAP_OPT_ON
;
}
return
map_error
(
ldap_set_option
(
CTX
(
ld
),
option
,
value
)
);
}
case
WLDAP32_LDAP_OPT_DEREF
:
case
WLDAP32_LDAP_OPT_DESC
:
...
...
@@ -458,10 +445,7 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
case
WLDAP32_LDAP_OPT_PROTOCOL_VERSION
:
case
WLDAP32_LDAP_OPT_SIZELIMIT
:
case
WLDAP32_LDAP_OPT_TIMELIMIT
:
{
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
value
};
return
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
));
}
return
map_error
(
ldap_set_option
(
CTX
(
ld
),
option
,
value
)
);
case
WLDAP32_LDAP_OPT_CACHE_ENABLE
:
case
WLDAP32_LDAP_OPT_CACHE_FN_PTRS
:
...
...
dlls/wldap32/page.c
View file @
d08d6f51
...
...
@@ -24,20 +24,18 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "winber.h"
#include "wine/debug.h"
#include "winldap_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
static
struct
berval
null_cookieW
=
{
0
,
NULL
};
static
struct
WLDAP32_
berval
null_cookieW
=
{
0
,
NULL
};
/***********************************************************************
* ldap_create_page_controlA (WLDAP32.@)
*/
ULONG
CDECL
ldap_create_page_controlA
(
LDAP
*
ld
,
ULONG
pagesize
,
struct
berval
*
cookie
,
UCHAR
critical
,
ULONG
CDECL
ldap_create_page_controlA
(
LDAP
*
ld
,
ULONG
pagesize
,
struct
WLDAP32_
berval
*
cookie
,
UCHAR
critical
,
LDAPControlA
**
control
)
{
ULONG
ret
;
...
...
@@ -57,15 +55,16 @@ ULONG CDECL ldap_create_page_controlA( LDAP *ld, ULONG pagesize, struct berval *
}
/* create a page control by hand */
static
ULONG
create_page_control
(
ULONG
pagesize
,
struct
berval
*
cookie
,
UCHAR
critical
,
LDAPControlW
**
control
)
static
ULONG
create_page_control
(
ULONG
pagesize
,
struct
WLDAP32_berval
*
cookie
,
UCHAR
critical
,
LDAPControlW
**
control
)
{
LDAPControlW
*
ctrl
;
WLDAP32_BerElement
*
ber
;
struct
berval
*
berval
,
*
vec
[
2
];
struct
WLDAP32_
berval
*
berval
,
*
vec
[
2
];
int
ret
,
len
;
char
*
val
;
if
(
!
(
ber
=
WLDAP32_ber_alloc_t
(
LBER_USE_DER
)))
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
!
(
ber
=
WLDAP32_ber_alloc_t
(
WLDAP32_
LBER_USE_DER
)))
return
WLDAP32_LDAP_NO_MEMORY
;
vec
[
1
]
=
NULL
;
if
(
cookie
)
...
...
@@ -109,7 +108,7 @@ static ULONG create_page_control( ULONG pagesize, struct berval *cookie, UCHAR c
/***********************************************************************
* ldap_create_page_controlW (WLDAP32.@)
*/
ULONG
CDECL
ldap_create_page_controlW
(
LDAP
*
ld
,
ULONG
pagesize
,
struct
berval
*
cookie
,
UCHAR
critical
,
ULONG
CDECL
ldap_create_page_controlW
(
LDAP
*
ld
,
ULONG
pagesize
,
struct
WLDAP32_
berval
*
cookie
,
UCHAR
critical
,
LDAPControlW
**
control
)
{
TRACE
(
"(%p, %#lx, %p, 0x%02x, %p)
\n
"
,
ld
,
pagesize
,
cookie
,
critical
,
control
);
...
...
@@ -127,7 +126,7 @@ ULONG CDECL ldap_get_next_page( LDAP *ld, LDAPSearch *search, ULONG pagesize, UL
}
ULONG
CDECL
ldap_get_next_page_s
(
LDAP
*
ld
,
LDAPSearch
*
search
,
struct
l_timeval
*
timeout
,
ULONG
pagesize
,
ULONG
*
count
,
LDAPMessage
**
results
)
ULONG
*
count
,
WLDAP32_
LDAPMessage
**
results
)
{
ULONG
ret
;
...
...
@@ -161,7 +160,7 @@ ULONG CDECL ldap_get_next_page_s( LDAP *ld, LDAPSearch *search, struct l_timeval
return
ldap_get_paged_count
(
ld
,
search
,
count
,
*
results
);
}
ULONG
CDECL
ldap_get_paged_count
(
LDAP
*
ld
,
LDAPSearch
*
search
,
ULONG
*
count
,
LDAPMessage
*
results
)
ULONG
CDECL
ldap_get_paged_count
(
LDAP
*
ld
,
LDAPSearch
*
search
,
ULONG
*
count
,
WLDAP32_
LDAPMessage
*
results
)
{
ULONG
ret
;
LDAPControlW
**
server_ctrls
=
NULL
;
...
...
@@ -196,7 +195,7 @@ ULONG CDECL ldap_get_paged_count( LDAP *ld, LDAPSearch *search, ULONG *count, LD
/***********************************************************************
* ldap_parse_page_controlA (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_page_controlA
(
LDAP
*
ld
,
LDAPControlA
**
ctrls
,
ULONG
*
count
,
struct
berval
**
cookie
)
ULONG
CDECL
ldap_parse_page_controlA
(
LDAP
*
ld
,
LDAPControlA
**
ctrls
,
ULONG
*
count
,
struct
WLDAP32_
berval
**
cookie
)
{
ULONG
ret
;
LDAPControlW
**
ctrlsW
=
NULL
;
...
...
@@ -214,12 +213,13 @@ ULONG CDECL ldap_parse_page_controlA( LDAP *ld, LDAPControlA **ctrls, ULONG *cou
/***********************************************************************
* ldap_parse_page_controlW (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_page_controlW
(
LDAP
*
ld
,
LDAPControlW
**
ctrls
,
ULONG
*
ret_count
,
struct
berval
**
ret_cookie
)
ULONG
CDECL
ldap_parse_page_controlW
(
LDAP
*
ld
,
LDAPControlW
**
ctrls
,
ULONG
*
ret_count
,
struct
WLDAP32_berval
**
ret_cookie
)
{
ULONG
ret
,
count
;
LDAPControlW
*
control
=
NULL
;
WLDAP32_BerElement
*
ber
;
struct
berval
*
cookie
=
NULL
;
struct
WLDAP32_
berval
*
cookie
=
NULL
;
int
tag
;
ULONG
i
;
...
...
@@ -273,8 +273,8 @@ ULONG CDECL ldap_search_abandon_page( LDAP *ld, LDAPSearch *search )
}
LDAPSearch
*
CDECL
ldap_search_init_pageA
(
LDAP
*
ld
,
char
*
dn
,
ULONG
scope
,
char
*
filter
,
char
**
attrs
,
ULONG
attrsonly
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
LDAPSortKeyA
**
sortkeys
)
ULONG
attrsonly
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
LDAPSortKeyA
**
sortkeys
)
{
FIXME
(
"(%p, %s, %#lx, %s, %p, %#lx, %p, %p, %#lx, %#lx, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
scope
,
debugstr_a
(
filter
),
attrs
,
attrsonly
,
serverctrls
,
clientctrls
,
timelimit
,
sizelimit
,
sortkeys
);
...
...
@@ -282,8 +282,8 @@ LDAPSearch * CDECL ldap_search_init_pageA( LDAP *ld, char *dn, ULONG scope, char
}
LDAPSearch
*
CDECL
ldap_search_init_pageW
(
LDAP
*
ld
,
WCHAR
*
dn
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
LDAPSortKeyW
**
sortkeys
)
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
LDAPSortKeyW
**
sortkeys
)
{
LDAPSearch
*
search
;
DWORD
i
,
len
;
...
...
dlls/wldap32/parse.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -32,8 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_parse_extended_resultA (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_extended_resultA
(
LDAP
*
ld
,
LDAPMessage
*
result
,
char
**
oid
,
struct
berval
**
data
,
BOOLEAN
free
)
ULONG
CDECL
ldap_parse_extended_resultA
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
result
,
char
**
oid
,
struct
WLDAP32_berval
**
data
,
BOOLEAN
free
)
{
ULONG
ret
;
WCHAR
*
oidW
=
NULL
;
...
...
@@ -57,12 +56,12 @@ ULONG CDECL ldap_parse_extended_resultA( LDAP *ld, LDAPMessage *result, char **o
/***********************************************************************
* ldap_parse_extended_resultW (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_extended_resultW
(
LDAP
*
ld
,
LDAPMessage
*
result
,
WCHAR
**
oid
,
struct
berval
**
data
,
BOOLEAN
free
)
ULONG
CDECL
ldap_parse_extended_resultW
(
LDAP
*
ld
,
WLDAP32_LDAPMessage
*
result
,
WCHAR
**
oid
,
struct
WLDAP32_berval
**
data
,
BOOLEAN
free
)
{
ULONG
ret
;
char
*
oidU
=
NULL
;
struct
berval
U
*
dataU
=
NULL
;
struct
berval
*
dataU
=
NULL
;
TRACE
(
"(%p, %p, %p, %p, 0x%02x)
\n
"
,
ld
,
result
,
oid
,
data
,
free
);
...
...
@@ -70,22 +69,21 @@ ULONG CDECL ldap_parse_extended_resultW( LDAP *ld, LDAPMessage *result, WCHAR **
if
(
!
result
)
return
WLDAP32_LDAP_NO_RESULTS_RETURNED
;
else
{
struct
ldap_parse_extended_result_params
params
=
{
CTX
(
ld
),
result
,
&
oidU
,
&
dataU
,
free
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_extended_result
,
&
params
));
ret
=
map_error
(
ldap_parse_extended_result
(
CTX
(
ld
),
result
,
&
oidU
,
&
dataU
,
free
)
);
}
if
(
oid
&&
oidU
)
{
WCHAR
*
str
;
if
((
str
=
strUtoW
(
oidU
)))
*
oid
=
str
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_memfree
,
oidU
);
ldap_memfree
(
oidU
);
}
if
(
data
&&
dataU
)
{
struct
berval
*
bv
;
struct
WLDAP32_
berval
*
bv
;
if
((
bv
=
bervalUtoW
(
dataU
)))
*
data
=
bv
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ber_bvfree
,
dataU
);
ber_bvfree
(
dataU
);
}
return
ret
;
...
...
@@ -94,7 +92,7 @@ ULONG CDECL ldap_parse_extended_resultW( LDAP *ld, LDAPMessage *result, WCHAR **
/***********************************************************************
* ldap_parse_referenceA (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_referenceA
(
LDAP
*
ld
,
LDAPMessage
*
message
,
char
***
referrals
)
ULONG
CDECL
ldap_parse_referenceA
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
message
,
char
***
referrals
)
{
ULONG
ret
;
WCHAR
**
referralsW
=
NULL
;
...
...
@@ -117,24 +115,21 @@ ULONG CDECL ldap_parse_referenceA( LDAP *ld, LDAPMessage *message, char ***refer
/***********************************************************************
* ldap_parse_referenceW (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_referenceW
(
LDAP
*
ld
,
LDAPMessage
*
message
,
WCHAR
***
referrals
)
ULONG
CDECL
ldap_parse_referenceW
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
message
,
WCHAR
***
referrals
)
{
ULONG
ret
=
~
0u
;
char
**
referralsU
=
NULL
;
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
message
,
referrals
);
if
(
ld
)
{
struct
ldap_parse_reference_params
params
=
{
CTX
(
ld
),
message
,
&
referralsU
,
NULL
,
0
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_reference
,
&
params
));
}
if
(
ld
)
ret
=
map_error
(
ldap_parse_reference
(
CTX
(
ld
),
message
,
&
referralsU
,
NULL
,
0
)
);
if
(
referralsU
)
{
WCHAR
**
ref
;
if
((
ref
=
strarrayUtoW
(
referralsU
)))
*
referrals
=
ref
;
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_memfree
,
referralsU
);
ldap_memfree
(
referralsU
);
}
return
ret
;
}
...
...
@@ -142,7 +137,7 @@ ULONG CDECL ldap_parse_referenceW( LDAP *ld, LDAPMessage *message, WCHAR ***refe
/***********************************************************************
* ldap_parse_resultA (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_resultA
(
LDAP
*
ld
,
LDAPMessage
*
result
,
ULONG
*
retcode
,
char
**
matched
,
char
**
error
,
ULONG
CDECL
ldap_parse_resultA
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
result
,
ULONG
*
retcode
,
char
**
matched
,
char
**
error
,
char
***
referrals
,
LDAPControlA
***
serverctrls
,
BOOLEAN
free
)
{
ULONG
ret
;
...
...
@@ -171,33 +166,30 @@ ULONG CDECL ldap_parse_resultA( LDAP *ld, LDAPMessage *result, ULONG *retcode, c
/***********************************************************************
* ldap_parse_resultW (WLDAP32.@)
*/
ULONG
CDECL
ldap_parse_resultW
(
LDAP
*
ld
,
LDAPMessage
*
result
,
ULONG
*
retcode
,
WCHAR
**
matched
,
WCHAR
**
error
,
ULONG
CDECL
ldap_parse_resultW
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
result
,
ULONG
*
retcode
,
WCHAR
**
matched
,
WCHAR
**
error
,
WCHAR
***
referrals
,
LDAPControlW
***
serverctrls
,
BOOLEAN
free
)
{
ULONG
ret
;
char
*
matchedU
=
NULL
,
*
errorU
=
NULL
,
**
referralsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
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
)
{
struct
ldap_parse_result_params
params
=
{
CTX
(
ld
),
MSG
(
result
),
(
int
*
)
retcode
,
&
matchedU
,
&
errorU
,
&
referralsU
,
&
serverctrlsU
,
free
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_result
,
&
params
));
}
else
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
ret
=
map_error
(
ldap_parse_result
(
CTX
(
ld
),
MSG
(
result
),
(
int
*
)
retcode
,
&
matchedU
,
&
errorU
,
&
referralsU
,
&
serverctrlsU
,
free
)
);
if
(
matched
)
*
matched
=
strUtoW
(
matchedU
);
if
(
error
)
*
error
=
strUtoW
(
errorU
);
if
(
referrals
)
*
referrals
=
strarrayUtoW
(
referralsU
);
if
(
serverctrls
)
*
serverctrls
=
controlarrayUtoW
(
serverctrlsU
);
LDAP_CALL
(
ldap_memfree
,
matchedU
);
LDAP_CALL
(
ldap_memfree
,
errorU
);
LDAP_CALL
(
ldap_memvfree
,
referralsU
);
LDAP_CALL
(
ldap_controls_free
,
serverctrlsU
);
ldap_memfree
(
matchedU
);
ldap_memfree
(
errorU
);
ldap_memfree
(
referralsU
);
ldap_controls_free
(
serverctrlsU
);
return
ret
;
}
...
...
@@ -230,7 +222,7 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
{
ULONG
ret
;
char
*
attrU
=
NULL
;
LDAPControl
U
**
controlU
,
*
sortcontrol
=
NULL
;
LDAPControl
**
controlU
,
*
sortcontrol
=
NULL
;
int
res
;
unsigned
int
i
;
...
...
@@ -250,11 +242,8 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
controlarrayfreeU
(
controlU
);
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
}
else
{
struct
ldap_parse_sortresponse_control_params
params
=
{
CTX
(
ld
),
sortcontrol
,
&
res
,
&
attrU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_sortresponse_control
,
&
params
));
}
ret
=
map_error
(
ldap_parse_sortresponse_control
(
CTX
(
ld
),
sortcontrol
,
&
res
,
&
attrU
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
WCHAR
*
str
;
...
...
@@ -264,7 +253,7 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
*
result
=
res
;
}
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ldap_memfree
,
attrU
);
ldap_memfree
(
attrU
);
}
controlarrayfreeU
(
controlU
);
...
...
@@ -275,7 +264,7 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
* ldap_parse_vlv_controlA (WLDAP32.@)
*/
int
CDECL
ldap_parse_vlv_controlA
(
LDAP
*
ld
,
LDAPControlA
**
control
,
ULONG
*
targetpos
,
ULONG
*
listcount
,
struct
berval
**
context
,
int
*
errcode
)
struct
WLDAP32_
berval
**
context
,
int
*
errcode
)
{
int
ret
;
LDAPControlW
**
controlW
=
NULL
;
...
...
@@ -294,11 +283,11 @@ int CDECL ldap_parse_vlv_controlA( LDAP *ld, LDAPControlA **control, ULONG *targ
* ldap_parse_vlv_controlW (WLDAP32.@)
*/
int
CDECL
ldap_parse_vlv_controlW
(
LDAP
*
ld
,
LDAPControlW
**
control
,
ULONG
*
targetpos
,
ULONG
*
listcount
,
struct
berval
**
context
,
int
*
errcode
)
struct
WLDAP32_
berval
**
context
,
int
*
errcode
)
{
int
ret
,
pos
,
count
;
LDAPControl
U
**
controlU
,
*
vlvcontrolU
=
NULL
;
struct
berval
U
*
ctxU
;
LDAPControl
**
controlU
,
*
vlvcontrolU
=
NULL
;
struct
berval
*
ctxU
;
unsigned
int
i
;
TRACE
(
"(%p, %p, %p, %p, %p, %p)
\n
"
,
ld
,
control
,
targetpos
,
listcount
,
context
,
errcode
);
...
...
@@ -317,14 +306,11 @@ int CDECL ldap_parse_vlv_controlW( LDAP *ld, LDAPControlW **control, ULONG *targ
controlarrayfreeU
(
controlU
);
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
}
else
{
struct
ldap_parse_vlvresponse_control_params
params
=
{
CTX
(
ld
),
vlvcontrolU
,
&
pos
,
&
count
,
&
ctxU
,
errcode
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_vlvresponse_control
,
&
params
));
}
ret
=
map_error
(
ldap_parse_vlvresponse_control
(
CTX
(
ld
),
vlvcontrolU
,
&
pos
,
&
count
,
&
ctxU
,
errcode
)
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
{
struct
berval
*
bv
;
struct
WLDAP32_
berval
*
bv
;
if
((
bv
=
bervalUtoW
(
ctxU
)))
{
*
context
=
bv
;
...
...
@@ -332,7 +318,7 @@ int CDECL ldap_parse_vlv_controlW( LDAP *ld, LDAPControlW **control, ULONG *targ
*
listcount
=
count
;
}
else
ret
=
WLDAP32_LDAP_NO_MEMORY
;
LDAP_CALL
(
ber_bvfree
,
ctxU
);
ber_bvfree
(
ctxU
);
}
controlarrayfreeU
(
controlU
);
...
...
dlls/wldap32/rename.c
View file @
d08d6f51
...
...
@@ -22,7 +22,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -69,7 +68,7 @@ ULONG CDECL ldap_rename_extW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpare
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
,
*
newrdnU
=
NULL
,
*
newparentU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
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
);
...
...
@@ -83,8 +82,8 @@ ULONG CDECL ldap_rename_extW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpare
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_rename_params
params
=
{
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_rename
,
&
params
)
);
ret
=
map_error
(
ldap_rename
(
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
)
);
}
exit:
free
(
dnU
);
...
...
@@ -135,7 +134,7 @@ ULONG CDECL ldap_rename_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpa
{
ULONG
ret
=
WLDAP32_LDAP_PARAM_ERROR
;
char
*
dnU
=
NULL
,
*
newrdnU
=
NULL
,
*
newparentU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %s, %s, 0x%02x, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
newrdn
),
debugstr_w
(
newparent
),
delete
,
serverctrls
,
clientctrls
);
...
...
@@ -149,8 +148,7 @@ ULONG CDECL ldap_rename_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpa
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
else
{
struct
ldap_rename_s_params
params
=
{
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_rename_s
,
&
params
));
ret
=
map_error
(
ldap_rename_s
(
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
)
);
}
exit:
free
(
dnU
);
...
...
dlls/wldap32/search.c
View file @
d08d6f51
...
...
@@ -23,7 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "win
ldap
.h"
#include "win
sock2
.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -72,7 +72,8 @@ ULONG CDECL ldap_searchW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filter, WCH
* ldap_search_extA (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_extA
(
LDAP
*
ld
,
char
*
base
,
ULONG
scope
,
char
*
filter
,
char
**
attrs
,
ULONG
attrsonly
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
ULONG
*
message
)
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
ULONG
timelimit
,
ULONG
sizelimit
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
baseW
=
NULL
,
*
filterW
=
NULL
,
**
attrsW
=
NULL
;
...
...
@@ -104,14 +105,14 @@ exit:
/***********************************************************************
* ldap_search_extW (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_extW
(
LDAP
*
ld
,
WCHAR
*
base
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
timelimit
,
ULONG
siz
elimit
,
ULONG
*
message
)
ULONG
CDECL
ldap_search_extW
(
LDAP
*
ld
,
WCHAR
*
base
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
ULONG
tim
elimit
,
ULONG
sizelimit
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
baseU
=
NULL
,
*
filterU
=
NULL
,
**
attrsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
timeval
U
timevalU
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
timeval
timevalU
;
TRACE
(
"(%p, %s, %#lx, %s, %p, %#lx, %p, %p, %#lx, %#lx, %p)
\n
"
,
ld
,
debugstr_w
(
base
),
scope
,
debugstr_w
(
filter
),
attrs
,
attrsonly
,
serverctrls
,
clientctrls
,
timelimit
,
sizelimit
,
message
);
...
...
@@ -127,11 +128,8 @@ ULONG CDECL ldap_search_extW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filter,
timevalU
.
tv_sec
=
timelimit
;
timevalU
.
tv_usec
=
0
;
{
struct
ldap_search_ext_params
params
=
{
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timelimit
?
&
timevalU
:
NULL
,
sizelimit
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_search_ext
,
&
params
));
}
ret
=
map_error
(
ldap_search_ext
(
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timelimit
?
&
timevalU
:
NULL
,
sizelimit
,
(
int
*
)
message
)
);
exit:
free
(
baseU
);
free
(
filterU
);
...
...
@@ -144,9 +142,9 @@ exit:
/***********************************************************************
* ldap_search_ext_sA (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_ext_sA
(
LDAP
*
ld
,
char
*
base
,
ULONG
scope
,
char
*
filter
,
char
**
attrs
,
ULONG
attrsonly
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
struct
l_timeval
*
timeout
,
ULONG
sizelimit
,
LDAPMessage
**
res
)
ULONG
CDECL
ldap_search_ext_sA
(
LDAP
*
ld
,
char
*
base
,
ULONG
scope
,
char
*
filter
,
char
**
attrs
,
ULONG
attrsonly
,
LDAPControlA
**
serverctrls
,
LDAPControlA
**
clientctrls
,
struct
l_timeval
*
timeout
,
ULONG
sizelimit
,
WLDAP32_
LDAPMessage
**
res
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
baseW
=
NULL
,
*
filterW
=
NULL
,
**
attrsW
=
NULL
;
...
...
@@ -178,15 +176,15 @@ exit:
/***********************************************************************
* ldap_search_ext_sW (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_ext_sW
(
LDAP
*
ld
,
WCHAR
*
base
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
struct
l_timeval
*
timeout
,
ULONG
CDECL
ldap_search_ext_sW
(
LDAP
*
ld
,
WCHAR
*
base
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPControlW
**
serverctrls
,
LDAPControlW
**
clientctrls
,
struct
l_timeval
*
timeout
,
ULONG
sizelimit
,
LDAPMessage
**
res
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
baseU
=
NULL
,
*
filterU
=
NULL
,
**
attrsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
timeval
U
timevalU
;
void
*
msgU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
timeval
timevalU
;
LDAPMessage
*
msgU
=
NULL
;
TRACE
(
"(%p, %s, %#lx, %s, %p, %#lx, %p, %p, %p, %#lx, %p)
\n
"
,
ld
,
debugstr_w
(
base
),
scope
,
debugstr_w
(
filter
),
attrs
,
attrsonly
,
serverctrls
,
clientctrls
,
timeout
,
sizelimit
,
res
);
...
...
@@ -205,11 +203,8 @@ ULONG CDECL ldap_search_ext_sW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filte
timevalU
.
tv_usec
=
timeout
->
tv_usec
;
}
{
struct
ldap_search_ext_s_params
params
=
{
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timeout
?
&
timevalU
:
NULL
,
sizelimit
,
&
msgU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_search_ext_s
,
&
params
));
}
ret
=
map_error
(
ldap_search_ext_s
(
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timeout
?
&
timevalU
:
NULL
,
sizelimit
,
&
msgU
)
);
if
(
msgU
)
{
...
...
@@ -221,7 +216,7 @@ ULONG CDECL ldap_search_ext_sW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filte
}
else
{
LDAP_CALL
(
ldap_msgfree
,
msgU
);
ldap_msgfree
(
msgU
);
ret
=
WLDAP32_LDAP_NO_MEMORY
;
}
}
...
...
@@ -239,7 +234,7 @@ exit:
* ldap_search_sA (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_sA
(
LDAP
*
ld
,
char
*
base
,
ULONG
scope
,
char
*
filter
,
char
**
attrs
,
ULONG
attrsonly
,
LDAPMessage
**
res
)
WLDAP32_
LDAPMessage
**
res
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
baseW
=
NULL
,
*
filterW
=
NULL
,
**
attrsW
=
NULL
;
...
...
@@ -266,7 +261,7 @@ exit:
* ldap_search_sW (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_sW
(
LDAP
*
ld
,
WCHAR
*
base
,
ULONG
scope
,
WCHAR
*
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
LDAPMessage
**
res
)
WLDAP32_
LDAPMessage
**
res
)
{
TRACE
(
"(%p, %s, %#lx, %s, %p, %#lx, %p)
\n
"
,
ld
,
debugstr_w
(
base
),
scope
,
debugstr_w
(
filter
),
attrs
,
attrsonly
,
res
);
...
...
@@ -277,7 +272,7 @@ ULONG CDECL ldap_search_sW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filter, W
* ldap_search_stA (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_stA
(
LDAP
*
ld
,
const
PCHAR
base
,
ULONG
scope
,
const
PCHAR
filter
,
char
**
attrs
,
ULONG
attrsonly
,
struct
l_timeval
*
timeout
,
LDAPMessage
**
res
)
ULONG
attrsonly
,
struct
l_timeval
*
timeout
,
WLDAP32_
LDAPMessage
**
res
)
{
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
baseW
=
NULL
,
*
filterW
=
NULL
,
**
attrsW
=
NULL
;
...
...
@@ -304,7 +299,7 @@ exit:
* ldap_search_stW (WLDAP32.@)
*/
ULONG
CDECL
ldap_search_stW
(
LDAP
*
ld
,
const
PWCHAR
base
,
ULONG
scope
,
const
PWCHAR
filter
,
WCHAR
**
attrs
,
ULONG
attrsonly
,
struct
l_timeval
*
timeout
,
LDAPMessage
**
res
)
ULONG
attrsonly
,
struct
l_timeval
*
timeout
,
WLDAP32_
LDAPMessage
**
res
)
{
TRACE
(
"(%p, %s, %#lx, %s, %p, %#lx, %p, %p)
\n
"
,
ld
,
debugstr_w
(
base
),
scope
,
debugstr_w
(
filter
),
attrs
,
attrsonly
,
timeout
,
res
);
...
...
dlls/wldap32/tests/ber.c
View file @
d08d6f51
...
...
@@ -31,7 +31,7 @@ static void test_ber_printf(void)
struct
berval
*
bv
;
ber
=
ber_alloc_t
(
0
);
todo_wine
ok
(
ber
==
NULL
,
"ber_alloc_t succeeded
\n
"
);
ok
(
ber
==
NULL
,
"ber_alloc_t succeeded
\n
"
);
ber
=
ber_alloc_t
(
LBER_USE_DER
);
ok
(
ber
!=
NULL
,
"ber_alloc_t failed
\n
"
);
...
...
dlls/wldap32/value.c
View file @
d08d6f51
...
...
@@ -23,7 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap.h"
#include "wine/debug.h"
#include "winldap_private.h"
...
...
@@ -33,10 +32,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
/***********************************************************************
* ldap_count_values_len (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_count_values_len
(
struct
berval
**
values
)
ULONG
CDECL
WLDAP32_ldap_count_values_len
(
struct
WLDAP32_
berval
**
values
)
{
ULONG
ret
=
0
;
struct
berval
**
ptr
=
values
;
struct
WLDAP32_
berval
**
ptr
=
values
;
TRACE
(
"(%p)
\n
"
,
values
);
...
...
@@ -78,7 +77,7 @@ ULONG CDECL ldap_count_valuesW( WCHAR **values )
/***********************************************************************
* ldap_get_valuesA (WLDAP32.@)
*/
char
**
CDECL
ldap_get_valuesA
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
char
*
attr
)
char
**
CDECL
ldap_get_valuesA
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
entry
,
char
*
attr
)
{
char
**
ret
;
WCHAR
*
attrW
=
NULL
,
**
retW
;
...
...
@@ -95,7 +94,7 @@ char ** CDECL ldap_get_valuesA( LDAP *ld, LDAPMessage *entry, char *attr )
return
ret
;
}
static
char
*
bv2str
(
struct
berval
U
*
bv
)
static
char
*
bv2str
(
struct
berval
*
bv
)
{
char
*
str
=
NULL
;
unsigned
int
len
=
bv
->
bv_len
;
...
...
@@ -108,10 +107,10 @@ static char *bv2str( struct bervalU *bv )
return
str
;
}
static
char
**
bv2str_array
(
struct
berval
U
**
bv
)
static
char
**
bv2str_array
(
struct
berval
**
bv
)
{
unsigned
int
len
=
0
,
i
=
0
;
struct
berval
U
**
p
=
bv
;
struct
berval
**
p
=
bv
;
char
**
str
;
while
(
*
p
)
...
...
@@ -141,24 +140,22 @@ static char **bv2str_array( struct bervalU **bv )
/***********************************************************************
* ldap_get_valuesW (WLDAP32.@)
*/
WCHAR
**
CDECL
ldap_get_valuesW
(
LDAP
*
ld
,
LDAPMessage
*
entry
,
WCHAR
*
attr
)
WCHAR
**
CDECL
ldap_get_valuesW
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
entry
,
WCHAR
*
attr
)
{
WCHAR
**
ret
=
NULL
;
char
*
attrU
,
**
retU
;
struct
berval
U
**
bv
;
struct
berval
**
bv
;
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
entry
,
debugstr_w
(
attr
)
);
if
(
ld
&&
entry
&&
attr
&&
(
attrU
=
strWtoU
(
attr
)))
{
struct
ldap_get_values_len_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
attrU
,
&
bv
};
if
(
!
LDAP_CALL
(
ldap_get_values_len
,
&
params
))
if
((
bv
=
ldap_get_values_len
(
CTX
(
ld
),
MSG
(
entry
),
attrU
)))
{
retU
=
bv2str_array
(
bv
);
ret
=
strarrayUtoW
(
retU
);
LDAP_CALL
(
ldap_value_free_len
,
bv
);
ldap_value_free_len
(
bv
);
strarrayfreeU
(
retU
);
}
free
(
attrU
);
...
...
@@ -169,10 +166,10 @@ WCHAR ** CDECL ldap_get_valuesW( LDAP *ld, LDAPMessage *entry, WCHAR *attr )
/***********************************************************************
* ldap_get_values_lenA (WLDAP32.@)
*/
struct
berval
**
CDECL
ldap_get_values_lenA
(
LDAP
*
ld
,
LDAPMessage
*
message
,
char
*
attr
)
struct
WLDAP32_
berval
**
CDECL
ldap_get_values_lenA
(
LDAP
*
ld
,
LDAPMessage
*
message
,
char
*
attr
)
{
WCHAR
*
attrW
;
struct
berval
**
ret
;
struct
WLDAP32_
berval
**
ret
;
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
message
,
debugstr_a
(
attr
)
);
...
...
@@ -187,24 +184,21 @@ struct berval ** CDECL ldap_get_values_lenA( LDAP *ld, LDAPMessage *message, cha
/***********************************************************************
* ldap_get_values_lenW (WLDAP32.@)
*/
struct
berval
**
CDECL
ldap_get_values_lenW
(
LDAP
*
ld
,
LDAPMessage
*
message
,
WCHAR
*
attr
)
struct
WLDAP32_berval
**
CDECL
ldap_get_values_lenW
(
LDAP
*
ld
,
WLDAP32_
LDAPMessage
*
message
,
WCHAR
*
attr
)
{
char
*
attrU
=
NULL
;
struct
berval
U
**
retU
;
struct
berval
**
ret
=
NULL
;
struct
berval
**
retU
;
struct
WLDAP32_
berval
**
ret
=
NULL
;
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
message
,
debugstr_w
(
attr
)
);
if
(
ld
&&
message
&&
attr
&&
(
attrU
=
strWtoU
(
attr
)))
{
struct
ldap_get_values_len_params
params
=
{
CTX
(
ld
),
MSG
(
message
),
attrU
,
&
retU
};
if
(
!
LDAP_CALL
(
ldap_get_values_len
,
&
params
))
if
((
retU
=
ldap_get_values_len
(
CTX
(
ld
),
MSG
(
message
),
attrU
)))
{
ret
=
bvarrayUtoW
(
retU
);
bvarrayfreeU
(
retU
);
}
free
(
attrU
);
}
return
ret
;
...
...
@@ -213,7 +207,7 @@ struct berval ** CDECL ldap_get_values_lenW( LDAP *ld, LDAPMessage *message, WCH
/***********************************************************************
* ldap_value_free_len (WLDAP32.@)
*/
ULONG
CDECL
WLDAP32_ldap_value_free_len
(
struct
berval
**
values
)
ULONG
CDECL
WLDAP32_ldap_value_free_len
(
struct
WLDAP32_
berval
**
values
)
{
TRACE
(
"(%p)
\n
"
,
values
);
...
...
dlls/wldap32/winldap_private.h
View file @
d08d6f51
...
...
@@ -22,7 +22,9 @@
#include <stdlib.h>
#include "winternl.h"
#include "winnls.h"
#include "libldap.h"
#include <lber.h>
#include <ldap.h>
#define WLDAP32_LBER_ERROR (~0l)
...
...
@@ -176,11 +178,175 @@ typedef enum {
#define WLDAP32_LDAP_AUTH_DPA (WLDAP32_LDAP_AUTH_OTHERKIND | 0x2000)
#define WLDAP32_LDAP_AUTH_DIGEST (WLDAP32_LDAP_AUTH_OTHERKIND | 0x4000)
typedef
struct
WLDAP32_berval
{
ULONG
bv_len
;
char
*
bv_val
;
}
LDAP_BERVAL
,
*
PLDAP_BERVAL
,
BERVAL
,
*
PBERVAL
;
typedef
struct
WLDAP32_berelement
{
char
*
opaque
;
}
WLDAP32_BerElement
;
typedef
struct
ldap
{
struct
{
UINT_PTR
sb_sd
;
UCHAR
Reserved1
[
41
];
ULONG_PTR
sb_naddr
;
UCHAR
Reserved2
[
24
];
}
ld_sb
;
char
*
ld_host
;
ULONG
ld_version
;
UCHAR
ld_lberoptions
;
ULONG
ld_deref
;
ULONG
ld_timelimit
;
ULONG
ld_sizelimit
;
ULONG
ld_errno
;
char
*
ld_matched
;
char
*
ld_error
;
ULONG
ld_msgid
;
UCHAR
Reserved3
[
25
];
ULONG
ld_cldaptries
;
ULONG
ld_cldaptimeout
;
ULONG
ld_refhoplimit
;
ULONG
ld_options
;
}
LDAP
,
*
PLDAP
;
typedef
struct
l_timeval
{
LONG
tv_sec
;
LONG
tv_usec
;
}
LDAP_TIMEVAL
,
*
PLDAP_TIMEVAL
;
#define LDAP_PAGED_RESULT_OID_STRING "1.2.840.113556.1.4.319"
#define LDAP_SERVER_RESP_SORT_OID "1.2.840.113556.1.4.474"
#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10"
#define LDAP_PAGED_RESULT_OID_STRING_W L"1.2.840.113556.1.4.319"
#define LDAP_SERVER_RESP_SORT_OID_W L"1.2.840.113556.1.4.474"
#define LDAP_CONTROL_VLVRESPONSE_W L"2.16.840.1.113730.3.4.10"
typedef
struct
ldapcontrolA
{
char
*
ldctl_oid
;
struct
WLDAP32_berval
ldctl_value
;
BOOLEAN
ldctl_iscritical
;
}
LDAPControlA
,
*
PLDAPControlA
;
typedef
struct
ldapcontrolW
{
WCHAR
*
ldctl_oid
;
struct
WLDAP32_berval
ldctl_value
;
BOOLEAN
ldctl_iscritical
;
}
LDAPControlW
,
*
PLDAPControlW
;
typedef
struct
ldapmodA
{
ULONG
mod_op
;
char
*
mod_type
;
union
{
char
**
modv_strvals
;
struct
WLDAP32_berval
**
modv_bvals
;
}
mod_vals
;
}
LDAPModA
,
*
PLDAPModA
;
typedef
struct
ldapmodW
{
ULONG
mod_op
;
WCHAR
*
mod_type
;
union
{
WCHAR
**
modv_strvals
;
struct
WLDAP32_berval
**
modv_bvals
;
}
mod_vals
;
}
LDAPModW
,
*
PLDAPModW
;
typedef
struct
ldapsortkeyA
{
char
*
sk_attrtype
;
char
*
sk_matchruleoid
;
BOOLEAN
sk_reverseorder
;
}
LDAPSortKeyA
,
*
PLDAPSortKeyA
;
typedef
struct
ldapsortkeyW
{
WCHAR
*
sk_attrtype
;
WCHAR
*
sk_matchruleoid
;
BOOLEAN
sk_reverseorder
;
}
LDAPSortKeyW
,
*
PLDAPSortKeyW
;
typedef
struct
WLDAP32_ldapvlvinfo
{
int
ldvlv_version
;
ULONG
ldvlv_before_count
;
ULONG
ldvlv_after_count
;
ULONG
ldvlv_offset
;
ULONG
ldvlv_count
;
BERVAL
*
ldvlv_attrvalue
;
BERVAL
*
ldvlv_context
;
void
*
ldvlv_extradata
;
}
WLDAP32_LDAPVLVInfo
,
*
WLDAP32_PLDAPVLVInfo
;
typedef
struct
ldapmsg
{
ULONG
lm_msgid
;
ULONG
lm_msgtype
;
void
*
lm_ber
;
struct
ldapmsg
*
lm_chain
;
struct
ldapmsg
*
lm_next
;
ULONG
lm_time
;
LDAP
*
Connection
;
void
*
Request
;
ULONG
lm_returncode
;
USHORT
lm_referral
;
BOOLEAN
lm_chased
;
BOOLEAN
lm_eom
;
BOOLEAN
ConnectionReferenced
;
}
WLDAP32_LDAPMessage
,
*
WLDAP32_PLDAPMessage
;
typedef
struct
ldap_version_info
{
ULONG
lv_size
;
ULONG
lv_major
;
ULONG
lv_minor
;
}
LDAP_VERSION_INFO
,
*
PLDAP_VERSION_INFO
;
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
;
WCHAR
*
ldapaif_name
;
int
ldapaif_version
;
}
LDAPAPIFeatureInfoW
;
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
;
WCHAR
**
ldapai_extensions
;
WCHAR
*
ldapai_vendor_name
;
int
ldapai_vendor_version
;
}
LDAPAPIInfoW
;
typedef
struct
ldapsearch
{
WCHAR
*
dn
;
...
...
@@ -192,13 +358,13 @@ typedef struct ldapsearch
LDAPControlW
**
clientctrls
;
struct
l_timeval
timeout
;
ULONG
sizelimit
;
struct
berval
*
cookie
;
struct
WLDAP32_
berval
*
cookie
;
}
LDAPSearch
;
#define CTX(ld) (*(
void
**)ld->Reserved3)
#define SERVER_CTRLS(ld) (*(
void **)(ld->Reserved3 + sizeof(void
*)))
#define CTX(ld) (*(
LDAP
**)ld->Reserved3)
#define SERVER_CTRLS(ld) (*(
struct berval ***)(ld->Reserved3 + sizeof(LDAP
*)))
#define MSG(entry) (entry->Request)
#define BER(ber) (
ber->opaque
)
#define BER(ber) (
(BerElement *)((ber)->opaque)
)
WLDAP32_BerElement
*
CDECL
WLDAP32_ber_alloc_t
(
int
);
BERVAL
*
CDECL
WLDAP32_ber_bvdup
(
BERVAL
*
);
...
...
@@ -214,6 +380,158 @@ ULONG CDECL WLDAP32_ber_skip_tag( WLDAP32_BerElement *, ULONG * );
int
WINAPIV
WLDAP32_ber_printf
(
WLDAP32_BerElement
*
,
char
*
,
...
);
ULONG
WINAPIV
WLDAP32_ber_scanf
(
WLDAP32_BerElement
*
,
char
*
,
...
);
ULONG
CDECL
ldap_addA
(
LDAP
*
,
char
*
,
LDAPModA
**
);
ULONG
CDECL
ldap_addW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
);
ULONG
CDECL
ldap_add_extA
(
LDAP
*
,
char
*
,
LDAPModA
**
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_add_extW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_add_ext_sA
(
LDAP
*
,
char
*
,
LDAPModA
**
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_add_ext_sW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_add_sA
(
LDAP
*
,
char
*
,
LDAPModA
**
);
ULONG
CDECL
ldap_add_sW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
);
ULONG
CDECL
ldap_bindA
(
LDAP
*
,
char
*
,
char
*
,
ULONG
);
ULONG
CDECL
ldap_bindW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
ULONG
);
ULONG
CDECL
ldap_bind_sA
(
LDAP
*
,
char
*
,
char
*
,
ULONG
);
ULONG
CDECL
ldap_bind_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
ULONG
);
ULONG
CDECL
ldap_sasl_bindA
(
LDAP
*
,
const
PCHAR
,
const
PCHAR
,
const
BERVAL
*
,
LDAPControlA
**
,
LDAPControlA
**
,
int
*
);
ULONG
CDECL
ldap_sasl_bindW
(
LDAP
*
,
const
PWCHAR
,
const
PWCHAR
,
const
BERVAL
*
,
LDAPControlW
**
,
LDAPControlW
**
,
int
*
);
ULONG
CDECL
ldap_sasl_bind_sA
(
LDAP
*
,
const
PCHAR
,
const
PCHAR
,
const
BERVAL
*
,
LDAPControlA
**
,
LDAPControlA
**
,
BERVAL
**
);
ULONG
CDECL
ldap_sasl_bind_sW
(
LDAP
*
,
const
PWCHAR
,
const
PWCHAR
,
const
BERVAL
*
,
LDAPControlW
**
,
LDAPControlW
**
,
BERVAL
**
);
ULONG
CDECL
ldap_simple_bindA
(
LDAP
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_simple_bindW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_simple_bind_sA
(
LDAP
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_simple_bind_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_compareA
(
LDAP
*
,
char
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_compareW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_compare_extA
(
LDAP
*
,
char
*
,
char
*
,
char
*
,
struct
WLDAP32_berval
*
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_compare_extW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
,
struct
WLDAP32_berval
*
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_compare_ext_sA
(
LDAP
*
,
char
*
,
char
*
,
char
*
,
struct
WLDAP32_berval
*
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_compare_ext_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
,
struct
WLDAP32_berval
*
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_compare_sA
(
LDAP
*
,
char
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_compare_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_create_sort_controlA
(
LDAP
*
,
LDAPSortKeyA
**
,
UCHAR
,
LDAPControlA
**
);
ULONG
CDECL
ldap_create_sort_controlW
(
LDAP
*
,
LDAPSortKeyW
**
,
UCHAR
,
LDAPControlW
**
);
int
CDECL
ldap_create_vlv_controlA
(
LDAP
*
,
WLDAP32_LDAPVLVInfo
*
,
UCHAR
,
LDAPControlA
**
);
int
CDECL
ldap_create_vlv_controlW
(
LDAP
*
,
WLDAP32_LDAPVLVInfo
*
,
UCHAR
,
LDAPControlW
**
);
ULONG
CDECL
ldap_deleteA
(
LDAP
*
,
char
*
);
ULONG
CDECL
ldap_deleteW
(
LDAP
*
,
WCHAR
*
);
ULONG
CDECL
ldap_delete_extA
(
LDAP
*
,
char
*
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_delete_extW
(
LDAP
*
,
WCHAR
*
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_delete_ext_sA
(
LDAP
*
,
char
*
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_delete_ext_sW
(
LDAP
*
,
WCHAR
*
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_delete_sA
(
LDAP
*
,
char
*
);
ULONG
CDECL
ldap_delete_sW
(
LDAP
*
,
WCHAR
*
);
char
*
CDECL
ldap_dn2ufnA
(
char
*
);
WCHAR
*
CDECL
ldap_dn2ufnW
(
WCHAR
*
);
void
CDECL
ldap_memfreeA
(
char
*
);
void
CDECL
ldap_memfreeW
(
WCHAR
*
);
char
**
CDECL
ldap_explode_dnA
(
char
*
,
ULONG
);
WCHAR
**
CDECL
ldap_explode_dnW
(
WCHAR
*
,
ULONG
);
ULONG
CDECL
ldap_value_freeA
(
char
**
);
ULONG
CDECL
ldap_value_freeW
(
WCHAR
**
);
char
*
CDECL
ldap_get_dnA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
);
WCHAR
*
CDECL
ldap_get_dnW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
);
ULONG
CDECL
ldap_ufn2dnA
(
char
*
,
char
**
);
ULONG
CDECL
ldap_ufn2dnW
(
WCHAR
*
,
WCHAR
**
);
ULONG
CDECL
ldap_extended_operationA
(
LDAP
*
,
char
*
,
struct
WLDAP32_berval
*
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_extended_operationW
(
LDAP
*
,
WCHAR
*
,
struct
WLDAP32_berval
*
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_extended_operation_sA
(
LDAP
*
,
char
*
,
struct
WLDAP32_berval
*
,
LDAPControlA
**
,
LDAPControlA
**
,
char
**
,
struct
WLDAP32_berval
**
);
ULONG
CDECL
ldap_extended_operation_sW
(
LDAP
*
,
WCHAR
*
,
struct
WLDAP32_berval
*
,
LDAPControlW
**
,
LDAPControlW
**
,
WCHAR
**
,
struct
WLDAP32_berval
**
);
LDAP
*
CDECL
cldap_openA
(
char
*
,
ULONG
);
LDAP
*
CDECL
cldap_openW
(
WCHAR
*
,
ULONG
);
LDAP
*
CDECL
ldap_initA
(
const
PCHAR
,
ULONG
);
LDAP
*
CDECL
ldap_initW
(
const
PWCHAR
,
ULONG
);
LDAP
*
CDECL
ldap_openA
(
char
*
,
ULONG
);
LDAP
*
CDECL
ldap_openW
(
WCHAR
*
,
ULONG
);
LDAP
*
CDECL
ldap_sslinitA
(
char
*
,
ULONG
,
int
);
LDAP
*
CDECL
ldap_sslinitW
(
WCHAR
*
,
ULONG
,
int
);
ULONG
CDECL
ldap_start_tls_sA
(
LDAP
*
,
ULONG
*
,
WLDAP32_LDAPMessage
**
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_start_tls_sW
(
LDAP
*
,
ULONG
*
,
WLDAP32_LDAPMessage
**
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_check_filterA
(
LDAP
*
,
char
*
);
ULONG
CDECL
ldap_check_filterW
(
LDAP
*
,
WCHAR
*
);
char
*
CDECL
ldap_first_attributeA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WLDAP32_BerElement
**
);
WCHAR
*
CDECL
ldap_first_attributeW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WLDAP32_BerElement
**
);
ULONG
CDECL
WLDAP32_ldap_msgfree
(
WLDAP32_LDAPMessage
*
);
char
*
CDECL
ldap_next_attributeA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WLDAP32_BerElement
*
);
WCHAR
*
CDECL
ldap_next_attributeW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WLDAP32_BerElement
*
);
ULONG
CDECL
WLDAP32_ldap_result
(
LDAP
*
,
ULONG
,
ULONG
,
struct
l_timeval
*
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_modifyA
(
LDAP
*
,
char
*
,
LDAPModA
**
);
ULONG
CDECL
ldap_modifyW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
);
ULONG
CDECL
ldap_modify_extA
(
LDAP
*
,
char
*
,
LDAPModA
**
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_modify_extW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_modify_ext_sA
(
LDAP
*
,
char
*
,
LDAPModA
**
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_modify_ext_sW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_modify_sA
(
LDAP
*
,
char
*
,
LDAPModA
**
);
ULONG
CDECL
ldap_modify_sW
(
LDAP
*
,
WCHAR
*
,
LDAPModW
**
);
ULONG
CDECL
ldap_modrdnA
(
LDAP
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_modrdnW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_modrdn2A
(
LDAP
*
,
char
*
,
char
*
,
int
);
ULONG
CDECL
ldap_modrdn2W
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
int
);
ULONG
CDECL
ldap_modrdn2_sA
(
LDAP
*
,
char
*
,
char
*
,
int
);
ULONG
CDECL
ldap_modrdn2_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
int
);
ULONG
CDECL
ldap_modrdn_sA
(
LDAP
*
,
char
*
,
char
*
);
ULONG
CDECL
ldap_modrdn_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
);
ULONG
CDECL
ldap_get_optionA
(
LDAP
*
,
int
,
void
*
);
ULONG
CDECL
ldap_get_optionW
(
LDAP
*
,
int
,
void
*
);
ULONG
CDECL
ldap_set_optionA
(
LDAP
*
,
int
,
void
*
);
ULONG
CDECL
ldap_set_optionW
(
LDAP
*
,
int
,
void
*
);
ULONG
CDECL
ldap_create_page_controlA
(
LDAP
*
,
ULONG
,
struct
WLDAP32_berval
*
,
UCHAR
,
LDAPControlA
**
);
ULONG
CDECL
ldap_create_page_controlW
(
LDAP
*
,
ULONG
,
struct
WLDAP32_berval
*
,
UCHAR
,
LDAPControlW
**
);
ULONG
CDECL
ldap_control_freeA
(
LDAPControlA
*
);
ULONG
CDECL
ldap_control_freeW
(
LDAPControlW
*
);
ULONG
CDECL
ldap_search_ext_sA
(
LDAP
*
,
char
*
,
ULONG
,
char
*
,
char
**
,
ULONG
,
LDAPControlA
**
,
LDAPControlA
**
,
struct
l_timeval
*
,
ULONG
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_search_ext_sW
(
LDAP
*
,
WCHAR
*
,
ULONG
,
WCHAR
*
,
WCHAR
**
,
ULONG
,
LDAPControlW
**
,
LDAPControlW
**
,
struct
l_timeval
*
,
ULONG
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_get_paged_count
(
LDAP
*
,
LDAPSearch
*
,
ULONG
*
,
WLDAP32_LDAPMessage
*
);
ULONG
CDECL
ldap_parse_resultA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
ULONG
*
,
char
**
,
char
**
,
char
***
,
LDAPControlA
***
,
BOOLEAN
);
ULONG
CDECL
ldap_parse_resultW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
ULONG
*
,
WCHAR
**
,
WCHAR
**
,
WCHAR
***
,
LDAPControlW
***
,
BOOLEAN
);
ULONG
CDECL
ldap_parse_page_controlA
(
LDAP
*
,
LDAPControlA
**
,
ULONG
*
,
struct
WLDAP32_berval
**
);
ULONG
CDECL
ldap_parse_page_controlW
(
LDAP
*
,
LDAPControlW
**
,
ULONG
*
,
struct
WLDAP32_berval
**
);
ULONG
CDECL
ldap_controls_freeA
(
LDAPControlA
**
);
ULONG
CDECL
ldap_controls_freeW
(
LDAPControlW
**
);
ULONG
CDECL
ldap_parse_extended_resultA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
char
**
,
struct
WLDAP32_berval
**
,
BOOLEAN
);
ULONG
CDECL
ldap_parse_extended_resultW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WCHAR
**
,
struct
WLDAP32_berval
**
,
BOOLEAN
);
ULONG
CDECL
ldap_parse_referenceA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
char
***
);
ULONG
CDECL
ldap_parse_referenceW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WCHAR
***
);
ULONG
CDECL
ldap_parse_sort_controlA
(
LDAP
*
,
LDAPControlA
**
,
ULONG
*
,
char
**
);
ULONG
CDECL
ldap_parse_sort_controlW
(
LDAP
*
,
LDAPControlW
**
,
ULONG
*
,
WCHAR
**
);
int
CDECL
ldap_parse_vlv_controlA
(
LDAP
*
,
LDAPControlA
**
,
ULONG
*
,
ULONG
*
,
struct
WLDAP32_berval
**
,
int
*
);
int
CDECL
ldap_parse_vlv_controlW
(
LDAP
*
,
LDAPControlW
**
,
ULONG
*
,
ULONG
*
,
struct
WLDAP32_berval
**
,
int
*
);
ULONG
CDECL
ldap_rename_extA
(
LDAP
*
,
char
*
,
char
*
,
char
*
,
int
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
*
);
ULONG
CDECL
ldap_rename_extW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
,
int
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
*
);
ULONG
CDECL
ldap_rename_ext_sA
(
LDAP
*
,
char
*
,
char
*
,
char
*
,
int
,
LDAPControlA
**
,
LDAPControlA
**
);
ULONG
CDECL
ldap_rename_ext_sW
(
LDAP
*
,
WCHAR
*
,
WCHAR
*
,
WCHAR
*
,
int
,
LDAPControlW
**
,
LDAPControlW
**
);
ULONG
CDECL
ldap_searchA
(
LDAP
*
,
char
*
,
ULONG
,
char
*
,
char
**
,
ULONG
);
ULONG
CDECL
ldap_searchW
(
LDAP
*
,
WCHAR
*
,
ULONG
,
WCHAR
*
,
WCHAR
**
,
ULONG
);
ULONG
CDECL
ldap_search_extA
(
LDAP
*
,
char
*
,
ULONG
,
char
*
,
char
**
,
ULONG
,
LDAPControlA
**
,
LDAPControlA
**
,
ULONG
,
ULONG
,
ULONG
*
);
ULONG
CDECL
ldap_search_extW
(
LDAP
*
,
PWCHAR
,
ULONG
,
PWCHAR
,
PWCHAR
[],
ULONG
,
LDAPControlW
**
,
LDAPControlW
**
,
ULONG
,
ULONG
,
ULONG
*
);
ULONG
CDECL
ldap_search_sA
(
LDAP
*
,
char
*
,
ULONG
,
char
*
,
char
**
,
ULONG
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_search_sW
(
LDAP
*
,
WCHAR
*
,
ULONG
,
WCHAR
*
,
WCHAR
**
,
ULONG
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_search_stA
(
LDAP
*
,
const
PCHAR
,
ULONG
,
const
PCHAR
,
char
**
,
ULONG
,
struct
l_timeval
*
,
WLDAP32_LDAPMessage
**
);
ULONG
CDECL
ldap_search_stW
(
LDAP
*
,
const
PWCHAR
,
ULONG
,
const
PWCHAR
,
WCHAR
**
,
ULONG
,
struct
l_timeval
*
,
WLDAP32_LDAPMessage
**
);
char
**
CDECL
ldap_get_valuesA
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
char
*
);
WCHAR
**
CDECL
ldap_get_valuesW
(
LDAP
*
,
WLDAP32_LDAPMessage
*
,
WCHAR
*
);
struct
WLDAP32_berval
**
CDECL
ldap_get_values_lenA
(
LDAP
*
,
LDAPMessage
*
,
char
*
);
struct
WLDAP32_berval
**
CDECL
ldap_get_values_lenW
(
LDAP
*
,
LDAPMessage
*
,
WCHAR
*
);
ULONG
map_error
(
int
)
DECLSPEC_HIDDEN
;
static
inline
char
*
strdupU
(
const
char
*
src
)
...
...
@@ -288,9 +606,9 @@ static inline WCHAR *strnAtoW( const char *str, DWORD in_len, DWORD *out_len )
return
ret
;
}
static
inline
DWORD
bvarraylenW
(
struct
berval
**
bv
)
static
inline
DWORD
bvarraylenW
(
struct
WLDAP32_
berval
**
bv
)
{
struct
berval
**
p
=
bv
;
struct
WLDAP32_
berval
**
p
=
bv
;
while
(
*
p
)
p
++
;
return
p
-
bv
;
}
...
...
@@ -304,42 +622,41 @@ static inline DWORD strarraylenW( WCHAR **strarray )
static
inline
char
**
strarrayWtoU
(
WCHAR
**
strarray
)
{
char
**
strarrayU
=
NULL
;
char
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
char
*
)
*
(
strarraylenW
(
strarray
)
+
1
);
if
((
strarrayU
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
WCHAR
**
p
=
strarray
;
char
**
q
=
strarrayU
;
char
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strWtoU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayU
;
return
ret
;
}
static
inline
WCHAR
**
strarraydupW
(
WCHAR
**
strarray
)
{
WCHAR
**
strarrayW
=
NULL
;
WCHAR
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
WCHAR
*
)
*
(
strarraylenW
(
strarray
)
+
1
);
if
((
strarrayW
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
WCHAR
**
p
=
strarray
;
WCHAR
**
q
=
strarrayW
;
WCHAR
**
p
=
strarray
,
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strdupW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayW
;
return
ret
;
}
static
inline
char
*
strWtoA
(
const
WCHAR
*
str
)
...
...
@@ -355,22 +672,22 @@ static inline char *strWtoA( const WCHAR *str )
static
inline
char
**
strarrayWtoA
(
WCHAR
**
strarray
)
{
char
**
strarrayA
=
NULL
;
char
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
char
*
)
*
(
strarraylenW
(
strarray
)
+
1
);
if
((
strarrayA
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
WCHAR
**
p
=
strarray
;
char
**
q
=
strarrayA
;
char
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strWtoA
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayA
;
return
ret
;
}
static
inline
DWORD
modarraylenW
(
LDAPModW
**
modarray
)
...
...
@@ -380,132 +697,132 @@ static inline DWORD modarraylenW( LDAPModW **modarray )
return
p
-
modarray
;
}
static
inline
struct
berval
U
*
bervalWtoU
(
const
struct
berval
*
bv
)
static
inline
struct
berval
*
bervalWtoU
(
const
struct
WLDAP32_
berval
*
bv
)
{
struct
berval
U
*
berval
;
DWORD
size
=
sizeof
(
*
berval
)
+
bv
->
bv_len
;
struct
berval
*
ret
;
DWORD
size
=
sizeof
(
*
ret
)
+
bv
->
bv_len
;
if
((
berval
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
char
*
val
=
(
char
*
)(
berval
+
1
);
char
*
val
=
(
char
*
)(
ret
+
1
);
berval
->
bv_len
=
bv
->
bv_len
;
berval
->
bv_val
=
val
;
ret
->
bv_len
=
bv
->
bv_len
;
ret
->
bv_val
=
val
;
memcpy
(
val
,
bv
->
bv_val
,
bv
->
bv_len
);
}
return
berval
;
return
ret
;
}
static
inline
DWORD
bvarraylenU
(
struct
berval
U
**
bv
)
static
inline
DWORD
bvarraylenU
(
struct
berval
**
bv
)
{
struct
berval
U
**
p
=
bv
;
struct
berval
**
p
=
bv
;
while
(
*
p
)
p
++
;
return
p
-
bv
;
}
static
inline
struct
berval
*
bervalUtoW
(
const
struct
bervalU
*
bv
)
static
inline
struct
WLDAP32_berval
*
bervalUtoW
(
const
struct
berval
*
bv
)
{
struct
berval
*
berval
;
DWORD
size
=
sizeof
(
*
berval
)
+
bv
->
bv_len
;
struct
WLDAP32_berval
*
ret
;
DWORD
size
=
sizeof
(
*
ret
)
+
bv
->
bv_len
;
assert
(
bv
->
bv_len
<=
~
0u
);
if
((
berval
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
char
*
val
=
(
char
*
)(
berval
+
1
);
char
*
val
=
(
char
*
)(
ret
+
1
);
berval
->
bv_len
=
bv
->
bv_len
;
berval
->
bv_val
=
val
;
ret
->
bv_len
=
bv
->
bv_len
;
ret
->
bv_val
=
val
;
memcpy
(
val
,
bv
->
bv_val
,
bv
->
bv_len
);
}
return
berval
;
return
ret
;
}
static
inline
struct
berval
**
bvarrayUtoW
(
struct
bervalU
**
bv
)
static
inline
struct
WLDAP32_berval
**
bvarrayUtoW
(
struct
berval
**
bv
)
{
struct
berval
**
berval
=
NULL
;
struct
WLDAP32_berval
**
ret
=
NULL
;
DWORD
size
;
if
(
bv
)
{
size
=
sizeof
(
*
berval
)
*
(
bvarraylenU
(
bv
)
+
1
);
if
((
berval
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
bvarraylenU
(
bv
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
struct
berval
U
**
p
=
bv
;
struct
berval
**
q
=
berval
;
struct
berval
**
p
=
bv
;
struct
WLDAP32_berval
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
bervalUtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
berval
;
return
ret
;
}
static
inline
void
bvfreeU
(
struct
berval
U
*
berval
)
static
inline
void
bvfreeU
(
struct
berval
*
berval
)
{
free
(
berval
);
}
static
inline
struct
berval
U
**
bvarrayWtoU
(
struct
berval
**
bv
)
static
inline
struct
berval
**
bvarrayWtoU
(
struct
WLDAP32_
berval
**
bv
)
{
struct
berval
U
**
berval
=
NULL
;
struct
berval
**
ret
=
NULL
;
DWORD
size
;
if
(
bv
)
{
size
=
sizeof
(
*
berval
)
*
(
bvarraylenW
(
bv
)
+
1
);
if
((
berval
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
bvarraylenW
(
bv
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
struct
berval
**
p
=
bv
;
struct
berval
U
**
q
=
berval
;
struct
WLDAP32_
berval
**
p
=
bv
;
struct
berval
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
bervalWtoU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
berval
;
return
ret
;
}
static
inline
LDAPMod
U
*
modWtoU
(
const
LDAPModW
*
mod
)
static
inline
LDAPMod
*
modWtoU
(
const
LDAPModW
*
mod
)
{
LDAPMod
U
*
modU
;
LDAPMod
*
ret
;
if
((
modU
=
malloc
(
sizeof
(
*
modU
)
)))
if
((
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
modU
->
mod_op
=
mod
->
mod_op
;
modU
->
mod_type
=
strWtoU
(
mod
->
mod_type
);
ret
->
mod_op
=
mod
->
mod_op
;
ret
->
mod_type
=
strWtoU
(
mod
->
mod_type
);
if
(
mod
->
mod_op
&
LDAP_MOD_BVALUES
)
modU
->
mod_vals
.
modv_bvals
=
bvarrayWtoU
(
mod
->
mod_vals
.
modv_bvals
);
ret
->
mod_vals
.
modv_bvals
=
bvarrayWtoU
(
mod
->
mod_vals
.
modv_bvals
);
else
modU
->
mod_vals
.
modv_strvals
=
strarrayWtoU
(
mod
->
mod_vals
.
modv_strvals
);
ret
->
mod_vals
.
modv_strvals
=
strarrayWtoU
(
mod
->
mod_vals
.
modv_strvals
);
}
return
modU
;
return
ret
;
}
static
inline
LDAPMod
U
**
modarrayWtoU
(
LDAPModW
**
modarray
)
static
inline
LDAPMod
**
modarrayWtoU
(
LDAPModW
**
modarray
)
{
LDAPMod
U
**
modarrayU
=
NULL
;
LDAPMod
**
ret
=
NULL
;
DWORD
size
;
if
(
modarray
)
{
size
=
sizeof
(
LDAPModU
*
)
*
(
modarraylenW
(
modarray
)
+
1
);
if
((
modarrayU
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
modarraylenW
(
modarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPModW
**
p
=
modarray
;
LDAPMod
U
**
q
=
modarrayU
;
LDAPMod
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
modWtoU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
modarrayU
;
return
ret
;
}
static
inline
void
bvarrayfreeU
(
struct
berval
U
**
bv
)
static
inline
void
bvarrayfreeU
(
struct
berval
**
bv
)
{
struct
berval
U
**
p
=
bv
;
struct
berval
**
p
=
bv
;
while
(
*
p
)
free
(
*
p
++
);
free
(
bv
);
}
...
...
@@ -520,7 +837,7 @@ static inline void strarrayfreeU( char **strarray )
}
}
static
inline
void
modfreeU
(
LDAPMod
U
*
mod
)
static
inline
void
modfreeU
(
LDAPMod
*
mod
)
{
if
(
mod
->
mod_op
&
LDAP_MOD_BVALUES
)
bvarrayfreeU
(
mod
->
mod_vals
.
modv_bvals
);
...
...
@@ -529,11 +846,11 @@ static inline void modfreeU( LDAPModU *mod )
free
(
mod
);
}
static
inline
void
modarrayfreeU
(
LDAPMod
U
**
modarray
)
static
inline
void
modarrayfreeU
(
LDAPMod
**
modarray
)
{
if
(
modarray
)
{
LDAPMod
U
**
p
=
modarray
;
LDAPMod
**
p
=
modarray
;
while
(
*
p
)
modfreeU
(
*
p
++
);
free
(
modarray
);
}
...
...
@@ -546,40 +863,39 @@ static inline DWORD modarraylenA( LDAPModA **modarray )
return
p
-
modarray
;
}
static
inline
struct
berval
*
bervalWtoW
(
const
struct
berval
*
bv
)
static
inline
struct
WLDAP32_berval
*
bervalWtoW
(
const
struct
WLDAP32_
berval
*
bv
)
{
struct
berval
*
berval
;
DWORD
size
=
sizeof
(
*
berval
)
+
bv
->
bv_len
;
struct
WLDAP32_berval
*
ret
;
DWORD
size
=
sizeof
(
*
ret
)
+
bv
->
bv_len
;
if
((
berval
=
malloc
(
size
)))
if
((
ret
=
malloc
(
size
)))
{
char
*
val
=
(
char
*
)(
berval
+
1
);
char
*
val
=
(
char
*
)(
ret
+
1
);
berval
->
bv_len
=
bv
->
bv_len
;
berval
->
bv_val
=
val
;
ret
->
bv_len
=
bv
->
bv_len
;
ret
->
bv_val
=
val
;
memcpy
(
val
,
bv
->
bv_val
,
bv
->
bv_len
);
}
return
berval
;
return
ret
;
}
static
inline
struct
berval
**
bvarrayWtoW
(
struct
berval
**
bv
)
static
inline
struct
WLDAP32_berval
**
bvarrayWtoW
(
struct
WLDAP32_
berval
**
bv
)
{
struct
berval
**
berval
=
NULL
;
struct
WLDAP32_berval
**
ret
=
NULL
;
DWORD
size
;
if
(
bv
)
{
size
=
sizeof
(
*
berval
)
*
(
bvarraylenW
(
bv
)
+
1
);
if
((
berval
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
bvarraylenW
(
bv
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
struct
berval
**
p
=
bv
;
struct
berval
**
q
=
berval
;
struct
WLDAP32_berval
**
p
=
bv
,
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
bervalWtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
berval
;
return
ret
;
}
static
inline
DWORD
strarraylenA
(
char
**
strarray
)
...
...
@@ -591,64 +907,64 @@ static inline DWORD strarraylenA( char **strarray )
static
inline
WCHAR
**
strarrayAtoW
(
char
**
strarray
)
{
WCHAR
**
strarrayW
=
NULL
;
WCHAR
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
WCHAR
*
)
*
(
strarraylenA
(
strarray
)
+
1
);
if
((
strarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
strarraylenA
(
strarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
char
**
p
=
strarray
;
WCHAR
**
q
=
strarrayW
;
WCHAR
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strAtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayW
;
return
ret
;
}
static
inline
LDAPModW
*
modAtoW
(
const
LDAPModA
*
mod
)
{
LDAPModW
*
modW
;
LDAPModW
*
ret
;
if
((
modW
=
malloc
(
sizeof
(
*
modW
)
)))
if
((
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
modW
->
mod_op
=
mod
->
mod_op
;
modW
->
mod_type
=
strAtoW
(
mod
->
mod_type
);
ret
->
mod_op
=
mod
->
mod_op
;
ret
->
mod_type
=
strAtoW
(
mod
->
mod_type
);
if
(
mod
->
mod_op
&
LDAP_MOD_BVALUES
)
modW
->
mod_vals
.
modv_bvals
=
bvarrayWtoW
(
mod
->
mod_vals
.
modv_bvals
);
ret
->
mod_vals
.
modv_bvals
=
bvarrayWtoW
(
mod
->
mod_vals
.
modv_bvals
);
else
modW
->
mod_vals
.
modv_strvals
=
strarrayAtoW
(
mod
->
mod_vals
.
modv_strvals
);
ret
->
mod_vals
.
modv_strvals
=
strarrayAtoW
(
mod
->
mod_vals
.
modv_strvals
);
}
return
modW
;
return
ret
;
}
static
inline
LDAPModW
**
modarrayAtoW
(
LDAPModA
**
modarray
)
{
LDAPModW
**
modarrayW
=
NULL
;
LDAPModW
**
ret
=
NULL
;
DWORD
size
;
if
(
modarray
)
{
size
=
sizeof
(
LDAPModW
*
)
*
(
modarraylenA
(
modarray
)
+
1
);
if
((
modarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
modarraylenA
(
modarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPModA
**
p
=
modarray
;
LDAPModW
**
q
=
modarrayW
;
LDAPModW
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
modAtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
modarrayW
;
return
ret
;
}
static
inline
void
bvarrayfreeW
(
struct
berval
**
bv
)
static
inline
void
bvarrayfreeW
(
struct
WLDAP32_
berval
**
bv
)
{
struct
berval
**
p
=
bv
;
struct
WLDAP32_
berval
**
p
=
bv
;
while
(
*
p
)
free
(
*
p
++
);
free
(
bv
);
}
...
...
@@ -691,7 +1007,7 @@ static inline DWORD controlarraylenA( LDAPControlA **controlarray )
static
inline
LDAPControlW
*
controlAtoW
(
const
LDAPControlA
*
control
)
{
LDAPControlW
*
controlW
;
LDAPControlW
*
ret
;
DWORD
len
=
control
->
ldctl_value
.
bv_len
;
char
*
val
=
NULL
;
...
...
@@ -701,38 +1017,38 @@ static inline LDAPControlW *controlAtoW( const LDAPControlA *control )
memcpy
(
val
,
control
->
ldctl_value
.
bv_val
,
len
);
}
if
(
!
(
controlW
=
malloc
(
sizeof
(
*
controlW
)
)))
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
free
(
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
;
ret
->
ldctl_oid
=
strAtoW
(
control
->
ldctl_oid
);
ret
->
ldctl_value
.
bv_len
=
len
;
ret
->
ldctl_value
.
bv_val
=
val
;
ret
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
return
controlW
;
return
ret
;
}
static
inline
LDAPControlW
**
controlarrayAtoW
(
LDAPControlA
**
controlarray
)
{
LDAPControlW
**
controlarrayW
=
NULL
;
LDAPControlW
**
ret
=
NULL
;
DWORD
size
;
if
(
controlarray
)
{
size
=
sizeof
(
LDAPControlW
*
)
*
(
controlarraylenA
(
controlarray
)
+
1
);
if
((
controlarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
controlarraylenA
(
controlarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPControlA
**
p
=
controlarray
;
LDAPControlW
**
q
=
controlarrayW
;
LDAPControlW
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
controlAtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
controlarrayW
;
return
ret
;
}
static
inline
void
controlfreeW
(
LDAPControlW
*
control
)
...
...
@@ -764,7 +1080,7 @@ static inline DWORD controlarraylenW( LDAPControlW **controlarray )
static
inline
LDAPControlA
*
controlWtoA
(
const
LDAPControlW
*
control
)
{
LDAPControlA
*
controlA
;
LDAPControlA
*
ret
;
DWORD
len
=
control
->
ldctl_value
.
bv_len
;
char
*
val
=
NULL
;
...
...
@@ -774,18 +1090,18 @@ static inline LDAPControlA *controlWtoA( const LDAPControlW *control )
memcpy
(
val
,
control
->
ldctl_value
.
bv_val
,
len
);
}
if
(
!
(
controlA
=
malloc
(
sizeof
(
*
controlA
)
)))
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
free
(
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
;
ret
->
ldctl_oid
=
strWtoA
(
control
->
ldctl_oid
);
ret
->
ldctl_value
.
bv_len
=
len
;
ret
->
ldctl_value
.
bv_val
=
val
;
ret
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
return
controlA
;
return
ret
;
}
static
inline
void
strarrayfreeA
(
char
**
strarray
)
...
...
@@ -818,9 +1134,9 @@ static inline void controlarrayfreeA( LDAPControlA **controlarray )
}
}
static
inline
LDAPControl
U
*
controlWtoU
(
const
LDAPControlW
*
control
)
static
inline
LDAPControl
*
controlWtoU
(
const
LDAPControlW
*
control
)
{
LDAPControl
U
*
controlU
;
LDAPControl
*
ret
;
DWORD
len
=
control
->
ldctl_value
.
bv_len
;
char
*
val
=
NULL
;
...
...
@@ -830,41 +1146,41 @@ static inline LDAPControlU *controlWtoU( const LDAPControlW *control )
memcpy
(
val
,
control
->
ldctl_value
.
bv_val
,
len
);
}
if
(
!
(
controlU
=
malloc
(
sizeof
(
*
controlU
)
)))
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
free
(
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
;
ret
->
ldctl_oid
=
strWtoU
(
control
->
ldctl_oid
);
ret
->
ldctl_value
.
bv_len
=
len
;
ret
->
ldctl_value
.
bv_val
=
val
;
ret
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
return
controlU
;
return
ret
;
}
static
inline
LDAPControl
U
**
controlarrayWtoU
(
LDAPControlW
**
controlarray
)
static
inline
LDAPControl
**
controlarrayWtoU
(
LDAPControlW
**
controlarray
)
{
LDAPControl
U
**
controlarrayU
=
NULL
;
LDAPControl
**
ret
=
NULL
;
DWORD
size
;
if
(
controlarray
)
{
size
=
sizeof
(
LDAPControlU
*
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
controlarrayU
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPControlW
**
p
=
controlarray
;
LDAPControl
U
**
q
=
controlarrayU
;
LDAPControl
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
controlWtoU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
controlarrayU
;
return
ret
;
}
static
inline
void
controlfreeU
(
LDAPControl
U
*
control
)
static
inline
void
controlfreeU
(
LDAPControl
*
control
)
{
if
(
control
)
{
...
...
@@ -874,26 +1190,26 @@ static inline void controlfreeU( LDAPControlU *control )
}
}
static
inline
void
controlarrayfreeU
(
LDAPControl
U
**
controlarray
)
static
inline
void
controlarrayfreeU
(
LDAPControl
**
controlarray
)
{
if
(
controlarray
)
{
LDAPControl
U
**
p
=
controlarray
;
LDAPControl
**
p
=
controlarray
;
while
(
*
p
)
controlfreeU
(
*
p
++
);
free
(
controlarray
);
}
}
static
inline
DWORD
controlarraylenU
(
LDAPControl
U
**
controlarray
)
static
inline
DWORD
controlarraylenU
(
LDAPControl
**
controlarray
)
{
LDAPControl
U
**
p
=
controlarray
;
LDAPControl
**
p
=
controlarray
;
while
(
*
p
)
p
++
;
return
p
-
controlarray
;
}
static
inline
LDAPControlW
*
controldupW
(
LDAPControlW
*
control
)
{
LDAPControlW
*
controlW
;
LDAPControlW
*
ret
;
DWORD
len
=
control
->
ldctl_value
.
bv_len
;
char
*
val
=
NULL
;
...
...
@@ -903,58 +1219,57 @@ static inline LDAPControlW *controldupW( LDAPControlW *control )
memcpy
(
val
,
control
->
ldctl_value
.
bv_val
,
len
);
}
if
(
!
(
controlW
=
malloc
(
sizeof
(
*
controlW
)
)))
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
free
(
val
);
return
NULL
;
}
controlW
->
ldctl_oid
=
strdupW
(
control
->
ldctl_oid
);
controlW
->
ldctl_value
.
bv_len
=
len
;
controlW
->
ldctl_value
.
bv_val
=
val
;
controlW
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
ret
->
ldctl_oid
=
strdupW
(
control
->
ldctl_oid
);
ret
->
ldctl_value
.
bv_len
=
len
;
ret
->
ldctl_value
.
bv_val
=
val
;
ret
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
return
controlW
;
return
ret
;
}
static
inline
LDAPControlW
**
controlarraydupW
(
LDAPControlW
**
controlarray
)
{
LDAPControlW
**
controlarrayW
=
NULL
;
LDAPControlW
**
ret
=
NULL
;
DWORD
size
;
if
(
controlarray
)
{
size
=
sizeof
(
LDAPControlW
*
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
controlarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPControlW
**
p
=
controlarray
;
LDAPControlW
**
q
=
controlarrayW
;
LDAPControlW
**
p
=
controlarray
,
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
controldupW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
controlarrayW
;
return
ret
;
}
static
inline
LDAPControlA
**
controlarrayWtoA
(
LDAPControlW
**
controlarray
)
{
LDAPControlA
**
controlarrayA
=
NULL
;
LDAPControlA
**
ret
=
NULL
;
DWORD
size
;
if
(
controlarray
)
{
size
=
sizeof
(
LDAPControlA
*
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
controlarrayA
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
controlarraylenW
(
controlarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPControlW
**
p
=
controlarray
;
LDAPControlA
**
q
=
controlarrayA
;
LDAPControlA
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
controlWtoA
(
*
p
++
);
*
q
=
NULL
;
}
}
return
controlarrayA
;
return
ret
;
}
static
inline
WCHAR
*
strUtoW
(
const
char
*
str
)
...
...
@@ -977,47 +1292,46 @@ static inline DWORD strarraylenU( char **strarray )
static
inline
WCHAR
**
strarrayUtoW
(
char
**
strarray
)
{
WCHAR
**
strarrayW
=
NULL
;
WCHAR
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
WCHAR
*
)
*
(
strarraylenU
(
strarray
)
+
1
);
if
((
strarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
strarraylenU
(
strarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
char
**
p
=
strarray
;
WCHAR
**
q
=
strarrayW
;
WCHAR
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strUtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayW
;
return
ret
;
}
static
inline
char
**
strarrayUtoU
(
char
**
strarray
)
{
char
**
strarrayU
=
NULL
;
char
**
ret
=
NULL
;
DWORD
size
;
if
(
strarray
)
{
size
=
sizeof
(
char
*
)
*
(
strarraylenU
(
strarray
)
+
1
);
if
((
strarrayU
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
strarraylenU
(
strarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
char
**
p
=
strarray
;
char
**
q
=
strarrayU
;
char
**
p
=
strarray
,
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
strdupU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
strarrayU
;
return
ret
;
}
static
inline
LDAPControlW
*
controlUtoW
(
const
LDAPControl
U
*
control
)
static
inline
LDAPControlW
*
controlUtoW
(
const
LDAPControl
*
control
)
{
LDAPControlW
*
controlW
;
LDAPControlW
*
ret
;
DWORD
len
=
control
->
ldctl_value
.
bv_len
;
char
*
val
=
NULL
;
...
...
@@ -1027,38 +1341,38 @@ static inline LDAPControlW *controlUtoW( const LDAPControlU *control )
memcpy
(
val
,
control
->
ldctl_value
.
bv_val
,
len
);
}
if
(
!
(
controlW
=
malloc
(
sizeof
(
*
controlW
)
)))
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
free
(
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
;
ret
->
ldctl_oid
=
strUtoW
(
control
->
ldctl_oid
);
ret
->
ldctl_value
.
bv_len
=
len
;
ret
->
ldctl_value
.
bv_val
=
val
;
ret
->
ldctl_iscritical
=
control
->
ldctl_iscritical
;
return
controlW
;
return
ret
;
}
static
inline
LDAPControlW
**
controlarrayUtoW
(
LDAPControl
U
**
controlarray
)
static
inline
LDAPControlW
**
controlarrayUtoW
(
LDAPControl
**
controlarray
)
{
LDAPControlW
**
controlarrayW
=
NULL
;
LDAPControlW
**
ret
=
NULL
;
DWORD
size
;
if
(
controlarray
)
{
size
=
sizeof
(
LDAPControlW
*
)
*
(
controlarraylenU
(
controlarray
)
+
1
);
if
((
controlarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
controlarraylenU
(
controlarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPControl
U
**
p
=
controlarray
;
LDAPControlW
**
q
=
controlarrayW
;
LDAPControl
**
p
=
controlarray
;
LDAPControlW
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
controlUtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
controlarrayW
;
return
ret
;
}
static
inline
DWORD
sortkeyarraylenA
(
LDAPSortKeyA
**
sortkeyarray
)
...
...
@@ -1070,35 +1384,35 @@ static inline DWORD sortkeyarraylenA( LDAPSortKeyA **sortkeyarray )
static
inline
LDAPSortKeyW
*
sortkeyAtoW
(
const
LDAPSortKeyA
*
sortkey
)
{
LDAPSortKeyW
*
sortkeyW
;
LDAPSortKeyW
*
ret
;
if
((
sortkeyW
=
malloc
(
sizeof
(
*
sortkeyW
)
)))
if
((
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
sortkeyW
->
sk_attrtype
=
strAtoW
(
sortkey
->
sk_attrtype
);
sortkeyW
->
sk_matchruleoid
=
strAtoW
(
sortkey
->
sk_matchruleoid
);
sortkeyW
->
sk_reverseorder
=
sortkey
->
sk_reverseorder
;
ret
->
sk_attrtype
=
strAtoW
(
sortkey
->
sk_attrtype
);
ret
->
sk_matchruleoid
=
strAtoW
(
sortkey
->
sk_matchruleoid
);
ret
->
sk_reverseorder
=
sortkey
->
sk_reverseorder
;
}
return
sortkeyW
;
return
ret
;
}
static
inline
LDAPSortKeyW
**
sortkeyarrayAtoW
(
LDAPSortKeyA
**
sortkeyarray
)
{
LDAPSortKeyW
**
sortkeyarrayW
=
NULL
;
LDAPSortKeyW
**
ret
=
NULL
;
DWORD
size
;
if
(
sortkeyarray
)
{
size
=
sizeof
(
LDAPSortKeyW
*
)
*
(
sortkeyarraylenA
(
sortkeyarray
)
+
1
);
if
((
sortkeyarrayW
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
sortkeyarraylenA
(
sortkeyarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPSortKeyA
**
p
=
sortkeyarray
;
LDAPSortKeyW
**
q
=
sortkeyarrayW
;
LDAPSortKeyW
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
sortkeyAtoW
(
*
p
++
);
*
q
=
NULL
;
}
}
return
sortkeyarrayW
;
return
ret
;
}
static
inline
void
sortkeyfreeW
(
LDAPSortKeyW
*
sortkey
)
...
...
@@ -1128,40 +1442,40 @@ static inline DWORD sortkeyarraylenW( LDAPSortKeyW **sortkeyarray )
return
p
-
sortkeyarray
;
}
static
inline
LDAPSortKey
U
*
sortkeyWtoU
(
const
LDAPSortKeyW
*
sortkey
)
static
inline
LDAPSortKey
*
sortkeyWtoU
(
const
LDAPSortKeyW
*
sortkey
)
{
LDAPSortKey
U
*
sortkeyU
;
LDAPSortKey
*
ret
;
if
((
sortkeyU
=
malloc
(
sizeof
(
*
sortkeyU
)
)))
if
((
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
sortkeyU
->
attributeType
=
strWtoU
(
sortkey
->
sk_attrtype
);
sortkeyU
->
orderingRule
=
strWtoU
(
sortkey
->
sk_matchruleoid
);
sortkeyU
->
reverseOrder
=
sortkey
->
sk_reverseorder
;
ret
->
attributeType
=
strWtoU
(
sortkey
->
sk_attrtype
);
ret
->
orderingRule
=
strWtoU
(
sortkey
->
sk_matchruleoid
);
ret
->
reverseOrder
=
sortkey
->
sk_reverseorder
;
}
return
sortkeyU
;
return
ret
;
}
static
inline
LDAPSortKey
U
**
sortkeyarrayWtoU
(
LDAPSortKeyW
**
sortkeyarray
)
static
inline
LDAPSortKey
**
sortkeyarrayWtoU
(
LDAPSortKeyW
**
sortkeyarray
)
{
LDAPSortKey
U
**
sortkeyarrayU
=
NULL
;
LDAPSortKey
**
ret
=
NULL
;
DWORD
size
;
if
(
sortkeyarray
)
{
size
=
sizeof
(
LDAPSortKeyU
*
)
*
(
sortkeyarraylenW
(
sortkeyarray
)
+
1
);
if
((
sortkeyarrayU
=
malloc
(
size
)))
size
=
sizeof
(
*
ret
)
*
(
sortkeyarraylenW
(
sortkeyarray
)
+
1
);
if
((
ret
=
malloc
(
size
)))
{
LDAPSortKeyW
**
p
=
sortkeyarray
;
LDAPSortKey
U
**
q
=
sortkeyarrayU
;
LDAPSortKey
**
q
=
ret
;
while
(
*
p
)
*
q
++
=
sortkeyWtoU
(
*
p
++
);
*
q
=
NULL
;
}
}
return
sortkeyarrayU
;
return
ret
;
}
static
inline
void
sortkeyfreeU
(
LDAPSortKey
U
*
sortkey
)
static
inline
void
sortkeyfreeU
(
LDAPSortKey
*
sortkey
)
{
if
(
sortkey
)
{
...
...
@@ -1171,44 +1485,44 @@ static inline void sortkeyfreeU( LDAPSortKeyU *sortkey )
}
}
static
inline
void
sortkeyarrayfreeU
(
LDAPSortKey
U
**
sortkeyarray
)
static
inline
void
sortkeyarrayfreeU
(
LDAPSortKey
**
sortkeyarray
)
{
if
(
sortkeyarray
)
{
LDAPSortKey
U
**
p
=
sortkeyarray
;
LDAPSortKey
**
p
=
sortkeyarray
;
while
(
*
p
)
sortkeyfreeU
(
*
p
++
);
free
(
sortkeyarray
);
}
}
static
inline
LDAPVLVInfo
U
*
vlvinfoWtoU
(
const
LDAPVLVInfo
*
info
)
static
inline
LDAPVLVInfo
*
vlvinfoWtoU
(
const
WLDAP32_
LDAPVLVInfo
*
info
)
{
LDAPVLVInfo
U
*
infoU
;
LDAPVLVInfo
*
ret
;
if
((
infoU
=
malloc
(
sizeof
(
*
infoU
)
)))
if
((
ret
=
malloc
(
sizeof
(
*
ret
)
)))
{
infoU
->
ldvlv_version
=
info
->
ldvlv_version
;
infoU
->
ldvlv_before_count
=
info
->
ldvlv_before_count
;
infoU
->
ldvlv_after_count
=
info
->
ldvlv_after_count
;
infoU
->
ldvlv_offset
=
info
->
ldvlv_offset
;
infoU
->
ldvlv_count
=
info
->
ldvlv_count
;
if
(
!
(
infoU
->
ldvlv_attrvalue
=
bervalWtoU
(
info
->
ldvlv_attrvalue
)))
ret
->
ldvlv_version
=
info
->
ldvlv_version
;
ret
->
ldvlv_before_count
=
info
->
ldvlv_before_count
;
ret
->
ldvlv_after_count
=
info
->
ldvlv_after_count
;
ret
->
ldvlv_offset
=
info
->
ldvlv_offset
;
ret
->
ldvlv_count
=
info
->
ldvlv_count
;
if
(
!
(
ret
->
ldvlv_attrvalue
=
bervalWtoU
(
info
->
ldvlv_attrvalue
)))
{
free
(
infoU
);
free
(
ret
);
return
NULL
;
}
if
(
!
(
infoU
->
ldvlv_context
=
bervalWtoU
(
info
->
ldvlv_context
)))
if
(
!
(
ret
->
ldvlv_context
=
bervalWtoU
(
info
->
ldvlv_context
)))
{
free
(
infoU
->
ldvlv_attrvalue
);
free
(
infoU
);
free
(
ret
->
ldvlv_attrvalue
);
free
(
ret
);
return
NULL
;
}
infoU
->
ldvlv_extradata
=
info
->
ldvlv_extradata
;
ret
->
ldvlv_extradata
=
info
->
ldvlv_extradata
;
}
return
infoU
;
return
ret
;
}
static
inline
void
vlvinfofreeU
(
LDAPVLVInfo
U
*
info
)
static
inline
void
vlvinfofreeU
(
LDAPVLVInfo
*
info
)
{
free
(
info
->
ldvlv_attrvalue
);
free
(
info
->
ldvlv_context
);
...
...
include/config.h.in
View file @
d08d6f51
...
...
@@ -140,15 +140,6 @@
/* Define to 1 if you have the <krb5/krb5.h> header file. */
#undef HAVE_KRB5_KRB5_H
/* Define to 1 if you have the <lber.h> header file. */
#undef HAVE_LBER_H
/* Define if you have the OpenLDAP development environment */
#undef HAVE_LDAP
/* Define to 1 if you have the <ldap.h> header file. */
#undef HAVE_LDAP_H
/* Define to 1 if you have the `gettextpo' library (-lgettextpo). */
#undef HAVE_LIBGETTEXTPO
...
...
@@ -377,9 +368,6 @@
/* Define to 1 if you have the `res_getservers' function. */
#undef HAVE_RES_GETSERVERS
/* Define to 1 if you have the <sasl/sasl.h> header file. */
#undef HAVE_SASL_SASL_H
/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment