Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
b2009d02
Commit
b2009d02
authored
Nov 04, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Convert the Unix library to the __wine_unix_call interface.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3cc3dd78
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1232 additions
and
545 deletions
+1232
-545
Makefile.in
dlls/wldap32/Makefile.in
+1
-0
add.c
dlls/wldap32/add.c
+10
-4
ber.c
dlls/wldap32/ber.c
+59
-50
bind.c
dlls/wldap32/bind.c
+49
-23
compare.c
dlls/wldap32/compare.c
+10
-5
control.c
dlls/wldap32/control.c
+13
-6
delete.c
dlls/wldap32/delete.c
+10
-4
dn.c
dlls/wldap32/dn.c
+26
-19
error.c
dlls/wldap32/error.c
+6
-10
extended.c
dlls/wldap32/extended.c
+12
-7
init.c
dlls/wldap32/init.c
+14
-7
libldap.c
dlls/wldap32/libldap.c
+268
-193
libldap.h
dlls/wldap32/libldap.h
+529
-80
main.c
dlls/wldap32/main.c
+3
-2
misc.c
dlls/wldap32/misc.c
+65
-36
modify.c
dlls/wldap32/modify.c
+10
-4
modrdn.c
dlls/wldap32/modrdn.c
+19
-17
option.c
dlls/wldap32/option.c
+48
-27
parse.c
dlls/wldap32/parse.c
+37
-24
rename.c
dlls/wldap32/rename.c
+10
-6
search.c
dlls/wldap32/search.c
+12
-5
value.c
dlls/wldap32/value.c
+21
-16
No files found.
dlls/wldap32/Makefile.in
View file @
b2009d02
MODULE
=
wldap32.dll
UNIXLIB
=
wldap32.so
IMPORTLIB
=
wldap32
IMPORTS
=
user32
EXTRAINCL
=
$(LDAP_CFLAGS)
...
...
dlls/wldap32/add.c
View file @
b2009d02
...
...
@@ -157,8 +157,11 @@ ULONG CDECL ldap_add_extW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW *
if
(
attrs
&&
!
(
attrsU
=
modarrayWtoU
(
attrs
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_add_ext
(
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
else
{
struct
ldap_add_ext_params
params
=
{
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_add_ext
,
&
params
));
}
exit:
free
(
dnU
);
...
...
@@ -237,8 +240,11 @@ ULONG CDECL ldap_add_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW
if
(
attrs
&&
!
(
attrsU
=
modarrayWtoU
(
attrs
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_add_ext_s
(
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
)
);
else
{
struct
ldap_add_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
attrsU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_add_ext_s
,
&
params
));
}
exit:
free
(
dnU
);
...
...
dlls/wldap32/ber.c
View file @
b2009d02
...
...
@@ -49,9 +49,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
BerElement
*
CDECL
ber_alloc_t
(
int
options
)
{
BerElement
*
ret
;
struct
ber_alloc_t_params
params
;
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
ldap_funcs
->
fn_ber_alloc_t
(
options
,
(
void
**
)
&
BER
(
ret
)
))
params
.
options
=
options
;
params
.
ret
=
(
void
**
)
&
BER
(
ret
);
if
(
LDAP_CALL
(
ber_alloc_t
,
&
params
))
{
free
(
ret
);
return
NULL
;
...
...
@@ -142,7 +145,8 @@ void CDECL ber_bvfree( BERVAL *berval )
*/
ULONG
CDECL
ber_first_element
(
BerElement
*
ber
,
ULONG
*
len
,
char
**
opaque
)
{
return
ldap_funcs
->
fn_ber_first_element
(
BER
(
ber
),
len
,
opaque
);
struct
ber_first_element_params
params
=
{
BER
(
ber
),
len
,
opaque
};
return
LDAP_CALL
(
ber_first_element
,
&
params
);
}
...
...
@@ -166,11 +170,12 @@ int CDECL ber_flatten( BerElement *ber, BERVAL **berval )
{
struct
bervalU
*
bervalU
;
struct
berval
*
bervalW
;
struct
ber_flatten_params
params
=
{
BER
(
ber
),
&
bervalU
};
if
(
ldap_funcs
->
fn_ber_flatten
(
BER
(
ber
),
&
bervalU
))
return
LBER_ERROR
;
if
(
LDAP_CALL
(
ber_flatten
,
&
params
))
return
LBER_ERROR
;
if
(
!
(
bervalW
=
bervalUtoW
(
bervalU
)))
return
LBER_ERROR
;
ldap_funcs
->
fn_ber_bvfree
(
bervalU
);
LDAP_CALL
(
ber_bvfree
,
bervalU
);
if
(
!
bervalW
)
return
LBER_ERROR
;
*
berval
=
bervalW
;
return
0
;
...
...
@@ -195,7 +200,8 @@ int CDECL ber_flatten( BerElement *ber, BERVAL **berval )
*/
void
CDECL
ber_free
(
BerElement
*
ber
,
int
freebuf
)
{
ldap_funcs
->
fn_ber_free
(
BER
(
ber
),
freebuf
);
struct
ber_free_params
params
=
{
BER
(
ber
),
freebuf
};
LDAP_CALL
(
ber_free
,
&
params
);
free
(
ber
);
}
...
...
@@ -219,6 +225,7 @@ BerElement * CDECL ber_init( BERVAL *berval )
{
struct
bervalU
*
bervalU
;
BerElement
*
ret
;
struct
ber_init_params
params
;
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
bervalU
=
bervalWtoU
(
berval
)))
...
...
@@ -226,7 +233,9 @@ BerElement * CDECL ber_init( BERVAL *berval )
free
(
ret
);
return
NULL
;
}
if
(
ldap_funcs
->
fn_ber_init
(
bervalU
,
(
void
**
)
&
BER
(
ret
)
))
params
.
berval
=
bervalU
;
params
.
ret
=
(
void
**
)
&
BER
(
ret
);
if
(
LDAP_CALL
(
ber_init
,
&
params
))
{
free
(
ret
);
ret
=
NULL
;
...
...
@@ -256,7 +265,8 @@ BerElement * CDECL ber_init( BERVAL *berval )
*/
ULONG
CDECL
ber_next_element
(
BerElement
*
ber
,
ULONG
*
len
,
char
*
opaque
)
{
return
ldap_funcs
->
fn_ber_next_element
(
BER
(
ber
),
len
,
opaque
);
struct
ber_next_element_params
params
=
{
BER
(
ber
),
len
,
opaque
};
return
LDAP_CALL
(
ber_next_element
,
&
params
);
}
...
...
@@ -275,7 +285,8 @@ ULONG CDECL ber_next_element( BerElement *ber, ULONG *len, char *opaque )
*/
ULONG
CDECL
ber_peek_tag
(
BerElement
*
ber
,
ULONG
*
len
)
{
return
ldap_funcs
->
fn_ber_peek_tag
(
BER
(
ber
),
len
);
struct
ber_peek_tag_params
params
=
{
BER
(
ber
),
len
};
return
LDAP_CALL
(
ber_peek_tag
,
&
params
);
}
...
...
@@ -294,7 +305,8 @@ ULONG CDECL ber_peek_tag( BerElement *ber, ULONG *len )
*/
ULONG
CDECL
ber_skip_tag
(
BerElement
*
ber
,
ULONG
*
len
)
{
return
ldap_funcs
->
fn_ber_skip_tag
(
BER
(
ber
),
len
);
struct
ber_skip_tag_params
params
=
{
BER
(
ber
),
len
};
return
LDAP_CALL
(
ber_skip_tag
,
&
params
);
}
...
...
@@ -326,36 +338,29 @@ int WINAPIV ber_printf( BerElement *ber, char *fmt, ... )
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'
:
{
int
i
=
va_arg
(
list
,
int
);
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
i
,
0
);
params
.
arg1
=
va_arg
(
list
,
int
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
}
case
'o'
:
case
's'
:
{
char
*
str
=
va_arg
(
list
,
char
*
);
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
(
ULONG_PTR
)
str
,
0
);
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
*
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
}
case
't'
:
{
unsigned
int
tag
=
va_arg
(
list
,
unsigned
int
);
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
tag
,
0
);
params
.
arg1
=
va_arg
(
list
,
unsigned
int
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
}
case
'v'
:
{
char
**
array
=
va_arg
(
list
,
char
**
);
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
(
ULONG_PTR
)
array
,
0
);
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
**
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
}
case
'V'
:
{
struct
berval
**
array
=
va_arg
(
list
,
struct
berval
**
);
...
...
@@ -365,16 +370,17 @@ int WINAPIV ber_printf( BerElement *ber, char *fmt, ... )
ret
=
-
1
;
break
;
}
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
(
ULONG_PTR
)
arrayU
,
0
);
params
.
arg1
=
(
ULONG_PTR
)
arrayU
;
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
bvarrayfreeU
(
arrayU
);
break
;
}
case
'X'
:
{
char
*
str
=
va_arg
(
list
,
char
*
);
int
len
=
va_arg
(
list
,
int
);
params
.
arg1
=
(
ULONG_PTR
)
va_arg
(
list
,
char
*
);
params
.
arg2
=
va_arg
(
list
,
int
);
new_fmt
[
0
]
=
'B'
;
/* 'X' is deprecated */
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
(
ULONG_PTR
)
str
,
len
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
}
case
'n'
:
...
...
@@ -382,7 +388,7 @@ int WINAPIV ber_printf( BerElement *ber, char *fmt, ... )
case
'}'
:
case
'['
:
case
']'
:
ret
=
ldap_funcs
->
fn_ber_printf
(
BER
(
ber
),
new_fmt
,
0
,
0
);
ret
=
LDAP_CALL
(
ber_printf
,
&
params
);
break
;
default:
...
...
@@ -425,71 +431,74 @@ ULONG WINAPIV ber_scanf( BerElement *ber, char *fmt, ... )
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
**
);
if
((
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
&
str
,
NULL
))
==
-
1
)
break
;
params
.
arg1
=
&
str
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
*
ptr
=
strdupU
(
str
);
ldap_funcs
->
fn_ldap_memfree
(
str
);
LDAP_CALL
(
ldap_memfree
,
str
);
break
;
}
case
'b'
:
case
'e'
:
case
'i'
:
{
int
*
i
=
va_arg
(
list
,
int
*
);
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
i
,
NULL
);
params
.
arg1
=
va_arg
(
list
,
int
*
);
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
break
;
}
case
't'
:
{
unsigned
int
*
tag
=
va_arg
(
list
,
unsigned
int
*
);
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
tag
,
NULL
);
params
.
arg1
=
va_arg
(
list
,
unsigned
int
*
);
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
break
;
}
case
'v'
:
{
char
*
str
,
**
arrayU
,
**
ptr
,
***
array
=
va_arg
(
list
,
char
***
);
if
((
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
&
arrayU
,
NULL
))
==
-
1
)
break
;
params
.
arg1
=
&
arrayU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
*
array
=
strarrayUtoU
(
arrayU
);
ptr
=
arrayU
;
while
((
str
=
*
ptr
))
{
ldap_funcs
->
fn_ldap_memfree
(
str
);
LDAP_CALL
(
ldap_memfree
,
str
);
ptr
++
;
}
ldap_funcs
->
fn_ldap_memfree
(
arrayU
);
LDAP_CALL
(
ldap_memfree
,
arrayU
);
break
;
}
case
'B'
:
{
char
*
strU
,
**
str
=
va_arg
(
list
,
char
**
);
int
*
len
=
va_arg
(
list
,
int
*
);
if
((
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
&
strU
,
len
))
==
-
1
)
break
;
params
.
arg1
=
&
strU
;
params
.
arg2
=
len
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
*
str
=
malloc
(
*
len
);
memcpy
(
*
str
,
strU
,
*
len
);
ldap_funcs
->
fn_ldap_memfree
(
strU
);
LDAP_CALL
(
ldap_memfree
,
strU
);
break
;
}
case
'O'
:
{
struct
berval
**
berval
=
va_arg
(
list
,
struct
berval
**
);
struct
bervalU
*
bervalU
;
if
((
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
&
bervalU
,
NULL
))
==
-
1
)
break
;
params
.
arg1
=
&
bervalU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
*
berval
=
bervalUtoW
(
bervalU
);
ldap_funcs
->
fn_ber_bvfree
(
bervalU
);
LDAP_CALL
(
ber_bvfree
,
bervalU
);
break
;
}
case
'V'
:
{
struct
berval
***
array
=
va_arg
(
list
,
struct
berval
***
);
struct
bervalU
**
arrayU
;
if
((
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
&
arrayU
,
NULL
))
==
-
1
)
break
;
params
.
arg1
=
&
arrayU
;
if
((
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
))
==
-
1
)
break
;
*
array
=
bvarrayUtoW
(
arrayU
);
ldap_funcs
->
fn_ber_bvecfree
(
arrayU
);
LDAP_CALL
(
ber_bvecfree
,
arrayU
);
break
;
}
case
'n'
:
...
...
@@ -498,7 +507,7 @@ ULONG WINAPIV ber_scanf( BerElement *ber, char *fmt, ... )
case
'}'
:
case
'['
:
case
']'
:
ret
=
ldap_funcs
->
fn_ber_scanf
(
BER
(
ber
),
new_fmt
,
NULL
,
NULL
);
ret
=
LDAP_CALL
(
ber_scanf
,
&
params
);
break
;
default:
...
...
dlls/wldap32/bind.c
View file @
b2009d02
...
...
@@ -94,7 +94,10 @@ ULONG CDECL ldap_bindW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
pwd
.
bv_val
=
credU
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
)
);
{
struct
ldap_sasl_bind_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind
,
&
params
));
}
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
...
...
@@ -173,7 +176,10 @@ ULONG CDECL ldap_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
pwd
.
bv_val
=
credU
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_bind_s
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
)
);
{
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
));
}
}
else
if
(
method
==
LDAP_AUTH_NEGOTIATE
)
{
...
...
@@ -197,10 +203,13 @@ ULONG CDECL ldap_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method )
idU
.
Password
=
(
unsigned
char
*
)
strnWtoU
(
id
->
Password
,
id
->
PasswordLength
,
&
idU
.
PasswordLength
);
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_interactive_bind_s
(
CTX
(
ld
),
NULL
/* server will ignore DN anyway */
,
NULL
/* query supportedSASLMechanisms */
,
NULL
,
NULL
,
2
/* LDAP_SASL_QUIET */
,
&
idU
)
);
{
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
));
}
if
(
id
&&
(
id
->
Flags
&
SEC_WINNT_AUTH_IDENTITY_ANSI
))
{
...
...
@@ -296,12 +305,13 @@ ULONG CDECL ldap_sasl_bindW( LDAP *ld, const PWCHAR dn, const PWCHAR mechanism,
if
(
!
(
mechanismU
=
strWtoU
(
mechanism
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
credU
.
bv_len
=
cred
->
bv_len
;
credU
.
bv_val
=
cred
->
bv_val
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
mechanismU
,
&
credU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
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
));
}
exit:
free
(
dnU
);
...
...
@@ -386,14 +396,16 @@ 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_funcs
->
fn_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
==
LDAP_SUCCESS
)
{
BERVAL
*
ptr
;
if
(
!
(
ptr
=
bervalUtoW
(
dataU
)))
ret
=
LDAP_NO_MEMORY
;
else
*
serverdata
=
ptr
;
ldap_funcs
->
fn_ber_bvfree
(
dataU
);
LDAP_CALL
(
ber_bvfree
,
dataU
);
}
exit:
...
...
@@ -465,7 +477,10 @@ ULONG CDECL ldap_simple_bindW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
pwd
.
bv_val
=
passwdU
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_bind
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
)
);
{
struct
ldap_sasl_bind_params
params
=
{
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
&
msg
};
ret
=
map_error
(
LDAP_CALL
(
ldap_sasl_bind
,
&
params
));
}
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
...
...
@@ -537,7 +552,10 @@ ULONG CDECL ldap_simple_bind_sW( LDAP *ld, WCHAR *dn, WCHAR *passwd )
pwd
.
bv_val
=
passwdU
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_sasl_bind_s
(
CTX
(
ld
),
dnU
,
0
,
&
pwd
,
NULL
,
NULL
,
NULL
)
);
{
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
));
}
exit:
free
(
dnU
);
...
...
@@ -563,10 +581,14 @@ ULONG CDECL ldap_unbind( LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
!
ld
)
return
LDAP_PARAM_ERROR
;
if
(
ld
)
{
struct
ldap_unbind_ext_params
params
=
{
CTX
(
ld
),
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_unbind_ext
,
&
params
));
}
else
return
LDAP_PARAM_ERROR
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_unbind_ext
(
CTX
(
ld
),
NULL
,
NULL
));
if
(
SERVER_CTRLS
(
ld
))
ldap_funcs
->
fn_ldap_value_free_len
(
SERVER_CTRLS
(
ld
)
);
if
(
SERVER_CTRLS
(
ld
))
LDAP_CALL
(
ldap_value_free_len
,
SERVER_CTRLS
(
ld
)
);
free
(
ld
);
return
ret
;
...
...
@@ -590,10 +612,14 @@ ULONG CDECL ldap_unbind_s( LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
!
ld
)
return
LDAP_PARAM_ERROR
;
if
(
ld
)
{
struct
ldap_unbind_ext_s_params
params
=
{
CTX
(
ld
),
NULL
,
NULL
};
ret
=
map_error
(
LDAP_CALL
(
ldap_unbind_ext_s
,
&
params
));
}
else
return
LDAP_PARAM_ERROR
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_unbind_ext_s
(
CTX
(
ld
),
NULL
,
NULL
)
);
if
(
SERVER_CTRLS
(
ld
))
ldap_funcs
->
fn_ldap_value_free_len
(
SERVER_CTRLS
(
ld
)
);
if
(
SERVER_CTRLS
(
ld
))
LDAP_CALL
(
ldap_value_free_len
,
SERVER_CTRLS
(
ld
)
);
free
(
ld
);
return
ret
;
...
...
dlls/wldap32/compare.c
View file @
b2009d02
...
...
@@ -170,9 +170,12 @@ ULONG CDECL ldap_compare_extW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value, s
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
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_funcs
->
fn_ldap_compare_ext
(
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
,
message
)
);
exit:
free
(
dnU
);
free
(
attrU
);
...
...
@@ -268,9 +271,11 @@ ULONG CDECL ldap_compare_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value,
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_compare_ext_s
(
CTX
(
ld
),
dnU
,
attrU
,
dataU
?
dataU
:
&
val
,
serverctrlsU
,
clientctrlsU
)
);
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
));
}
exit:
free
(
dnU
);
free
(
attrU
);
...
...
dlls/wldap32/control.c
View file @
b2009d02
...
...
@@ -151,15 +151,19 @@ ULONG CDECL ldap_create_sort_controlW( LDAP *ld, LDAPSortKeyW **sortkey, UCHAR c
if
(
!
ld
||
!
sortkey
||
!
control
)
return
LDAP_PARAM_ERROR
;
if
(
!
(
sortkeyU
=
sortkeyarrayWtoU
(
sortkey
)))
return
LDAP_NO_MEMORY
;
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
LDAP_NO_MEMORY
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_create_sort_control
(
CTX
(
ld
),
sortkeyU
,
critical
,
&
controlU
)
);
if
(
ret
==
LDAP_SUCCESS
)
{
LDAPControlW
*
controlW
=
controlUtoW
(
controlU
);
if
(
controlW
)
*
control
=
controlW
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_control_free
(
controlU
);
LDAP_CALL
(
ldap_control_free
,
controlU
);
}
sortkeyarrayfreeU
(
sortkeyU
);
...
...
@@ -225,14 +229,17 @@ INT CDECL ldap_create_vlv_controlW( LDAP *ld, LDAPVLVInfo *info, UCHAR critical,
if
(
!
ld
||
!
control
)
return
~
0u
;
if
(
info
&&
!
(
infoU
=
vlvinfoWtoU
(
info
)))
return
LDAP_NO_MEMORY
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_create_vlv_control
(
CTX
(
ld
),
infoU
,
&
controlU
)
);
else
{
struct
ldap_create_vlv_control_params
params
=
{
CTX
(
ld
),
infoU
,
&
controlU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_create_vlv_control
,
&
params
));
}
if
(
ret
==
LDAP_SUCCESS
)
{
LDAPControlW
*
controlW
=
controlUtoW
(
controlU
);
if
(
controlW
)
*
control
=
controlW
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_control_free
(
controlU
);
LDAP_CALL
(
ldap_control_free
,
controlU
);
}
vlvinfofreeU
(
infoU
);
...
...
dlls/wldap32/delete.c
View file @
b2009d02
...
...
@@ -142,8 +142,11 @@ ULONG CDECL ldap_delete_extW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls, L
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_delete_ext
(
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
else
{
struct
ldap_delete_ext_params
params
=
{
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_delete_ext
,
&
params
));
}
exit:
free
(
dnU
);
...
...
@@ -212,8 +215,11 @@ ULONG CDECL ldap_delete_ext_sW( LDAP *ld, WCHAR *dn, LDAPControlW **serverctrls,
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_delete_ext_s
(
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
)
);
else
{
struct
ldap_delete_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_delete_ext_s
,
&
params
));
}
exit:
free
(
dnU
);
...
...
dlls/wldap32/dn.c
View file @
b2009d02
...
...
@@ -68,18 +68,21 @@ char * CDECL ldap_dn2ufnA( char *dn )
*/
WCHAR
*
CDECL
ldap_dn2ufnW
(
WCHAR
*
dn
)
{
WCHAR
*
ret
;
WCHAR
*
ret
=
NULL
;
char
*
dnU
,
*
retU
;
TRACE
(
"(%s)
\n
"
,
debugstr_w
(
dn
)
);
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
if
((
dnU
=
strWtoU
(
dn
)))
{
struct
ldap_dn2ufn_params
params
=
{
dnU
,
&
retU
};
LDAP_CALL
(
ldap_dn2ufn
,
&
params
);
ldap_funcs
->
fn_ldap_dn2ufn
(
dnU
,
&
retU
);
ret
=
strUtoW
(
retU
);
ret
=
strUtoW
(
retU
);
free
(
dnU
);
ldap_funcs
->
fn_ldap_memfree
(
retU
);
free
(
dnU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
}
return
ret
;
}
...
...
@@ -124,18 +127,20 @@ char ** CDECL ldap_explode_dnA( char *dn, ULONG notypes )
*/
WCHAR
**
CDECL
ldap_explode_dnW
(
WCHAR
*
dn
,
ULONG
notypes
)
{
WCHAR
**
ret
;
WCHAR
**
ret
=
NULL
;
char
*
dnU
,
**
retU
;
TRACE
(
"(%s, 0x%08x)
\n
"
,
debugstr_w
(
dn
),
notypes
);
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
ldap_funcs
->
fn_ldap_explode_dn
(
dnU
,
notypes
,
&
retU
);
ret
=
strarrayUtoW
(
retU
);
if
((
dnU
=
strWtoU
(
dn
)))
{
struct
ldap_explode_dn_params
params
=
{
dnU
,
notypes
,
&
retU
};
LDAP_CALL
(
ldap_explode_dn
,
&
params
);
ret
=
strarrayUtoW
(
retU
);
free
(
dnU
);
ldap_funcs
->
fn_ldap_memvfree
(
(
void
**
)
retU
);
free
(
dnU
);
LDAP_CALL
(
ldap_memvfree
,
retU
);
}
return
ret
;
}
...
...
@@ -178,17 +183,19 @@ char * CDECL ldap_get_dnA( LDAP *ld, LDAPMessage *entry )
*/
WCHAR
*
CDECL
ldap_get_dnW
(
LDAP
*
ld
,
LDAPMessage
*
entry
)
{
WCHAR
*
ret
;
WCHAR
*
ret
=
NULL
;
char
*
retU
;
TRACE
(
"(%p, %p)
\n
"
,
ld
,
entry
);
if
(
!
ld
||
!
entry
)
return
NULL
;
ldap_funcs
->
fn_ldap_get_dn
(
CTX
(
ld
),
MSG
(
entry
),
&
retU
);
if
(
ld
&&
entry
)
{
struct
ldap_get_dn_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
retU
};
LDAP_CALL
(
ldap_get_dn
,
&
params
);
ret
=
strUtoW
(
retU
);
ldap_funcs
->
fn_ldap_memfree
(
retU
);
ret
=
strUtoW
(
retU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
}
return
ret
;
}
...
...
dlls/wldap32/error.c
View file @
b2009d02
...
...
@@ -146,20 +146,16 @@ void CDECL ldap_perror( LDAP *ld, const PCHAR msg )
*/
ULONG
CDECL
ldap_result2error
(
LDAP
*
ld
,
LDAPMessage
*
res
,
ULONG
free
)
{
ULONG
ret
;
int
error
;
TRACE
(
"(%p, %p, 0x%08x)
\n
"
,
ld
,
res
,
free
);
if
(
!
ld
||
!
res
)
return
~
0u
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_result
(
CTX
(
ld
),
MSG
(
res
),
&
error
,
NULL
,
NULL
,
NULL
,
NULL
,
free
)
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
error
;
else
ret
=
~
0u
;
return
ret
;
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
;
}
return
~
0u
;
}
/***********************************************************************
...
...
dlls/wldap32/extended.c
View file @
b2009d02
...
...
@@ -124,9 +124,11 @@ ULONG CDECL ldap_extended_operationW( LDAP *ld, WCHAR *oid, struct berval *data,
if
(
data
&&
!
(
dataU
=
bervalWtoU
(
data
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_extended_operation
(
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
else
{
struct
ldap_extended_operation_params
params
=
{
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_extended_operation
,
&
params
));
}
exit:
free
(
oidU
);
...
...
@@ -212,22 +214,25 @@ ULONG CDECL ldap_extended_operation_sW( LDAP *ld, WCHAR *oid, struct berval *dat
if
(
data
&&
!
(
dataU
=
bervalWtoU
(
data
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
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_funcs
->
fn_ldap_extended_operation_s
(
CTX
(
ld
),
oidU
,
dataU
,
serverctrlsU
,
clientctrlsU
,
&
retoidU
,
&
retdataU
)
);
if
(
retoid
&&
retoidU
)
{
WCHAR
*
str
=
strUtoW
(
retoidU
);
if
(
str
)
*
retoid
=
str
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_memfree
(
retoidU
);
LDAP_CALL
(
ldap_memfree
,
retoidU
);
}
if
(
retdata
&&
retdataU
)
{
struct
berval
*
bv
=
bervalUtoW
(
retdataU
);
if
(
bv
)
*
retdata
=
bv
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ber_bvfree
(
retdataU
);
LDAP_CALL
(
ber_bvfree
,
retdataU
);
}
exit:
...
...
dlls/wldap32/init.c
View file @
b2009d02
...
...
@@ -195,15 +195,19 @@ static LDAP *create_context( const char *url )
{
LDAP
*
ld
;
int
version
=
LDAP_VERSION3
;
struct
ldap_initialize_params
params
;
if
(
!
(
ld
=
calloc
(
1
,
sizeof
(
*
ld
))))
return
NULL
;
if
(
map_error
(
ldap_funcs
->
fn_ldap_initialize
(
&
CTX
(
ld
),
url
)
)
!=
LDAP_SUCCESS
)
params
.
ld
=
&
CTX
(
ld
);
params
.
url
=
url
;
if
(
map_error
(
LDAP_CALL
(
ldap_initialize
,
&
params
))
==
LDAP_SUCCESS
)
{
free
(
ld
);
return
NULL
;
struct
ldap_set_option_params
opt_params
=
{
CTX
(
ld
),
LDAP_OPT_PROTOCOL_VERSION
,
&
version
};
LDAP_CALL
(
ldap_set_option
,
&
opt_params
);
return
ld
;
}
ldap_funcs
->
fn_ldap_set_option
(
CTX
(
ld
),
LDAP_OPT_PROTOCOL_VERSION
,
&
version
);
return
ld
;
free
(
ld
);
return
NULL
;
}
/***********************************************************************
...
...
@@ -538,8 +542,11 @@ ULONG CDECL ldap_start_tls_sW( LDAP *ld, ULONG *retval, LDAPMessage **result, LD
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_start_tls_s
(
CTX
(
ld
),
serverctrlsU
,
clientctrlsU
)
);
else
{
struct
ldap_start_tls_s_params
params
=
{
CTX
(
ld
),
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_start_tls_s
,
&
params
));
}
exit:
controlarrayfreeU
(
serverctrlsU
);
...
...
dlls/wldap32/libldap.c
View file @
b2009d02
...
...
@@ -59,28 +59,33 @@ C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
static
LDAPMod
*
nullmods
[]
=
{
NULL
};
static
int
CDECL
wrap_ber_alloc_t
(
int
options
,
void
**
ret
)
static
NTSTATUS
wrap_ber_alloc_t
(
void
*
args
)
{
*
ret
=
ber_alloc_t
(
options
);
return
*
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
struct
ber_alloc_t_params
*
params
=
args
;
*
params
->
ret
=
ber_alloc_t
(
params
->
options
);
return
*
params
->
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
void
CDECL
wrap_ber_bvecfree
(
struct
bervalU
**
berval
)
static
NTSTATUS
wrap_ber_bvecfree
(
void
*
args
)
{
ber_bvecfree
(
(
struct
berval
**
)
berval
);
ber_bvecfree
(
args
);
return
STATUS_SUCCESS
;
}
static
void
CDECL
wrap_ber_bvfree
(
struct
bervalU
*
berval
)
static
NTSTATUS
wrap_ber_bvfree
(
void
*
args
)
{
ber_bvfree
(
(
struct
berval
*
)
berval
);
ber_bvfree
(
args
);
return
STATUS_SUCCESS
;
}
static
unsigned
int
CDECL
wrap_ber_first_element
(
void
*
ber
,
ULONG
*
ret_len
,
char
**
last
)
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
(
ber
,
&
len
,
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
((
ret
=
ber_first_element
(
params
->
ber
,
&
len
,
params
->
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
ret
>
~
0u
)
{
ERR
(
"ret too large
\n
"
);
...
...
@@ -92,32 +97,39 @@ static unsigned int CDECL wrap_ber_first_element( void *ber, ULONG *ret_len, cha
return
WLDAP32_LBER_ERROR
;
}
*
ret_len
=
len
;
*
params
->
ret_len
=
len
;
return
ret
;
}
static
int
CDECL
wrap_ber_flatten
(
void
*
ber
,
struct
bervalU
**
berval
)
static
NTSTATUS
wrap_ber_flatten
(
void
*
args
)
{
return
ber_flatten
(
ber
,
(
struct
berval
**
)
berval
);
struct
ber_flatten_params
*
params
=
args
;
return
ber_flatten
(
params
->
ber
,
(
struct
berval
**
)
params
->
berval
);
}
static
void
CDECL
wrap_ber_free
(
void
*
ber
,
int
freebuf
)
static
NTSTATUS
wrap_ber_free
(
void
*
args
)
{
ber_free
(
ber
,
freebuf
);
struct
ber_free_params
*
params
=
args
;
ber_free
(
params
->
ber
,
params
->
freebuf
);
return
STATUS_SUCCESS
;
}
static
int
CDECL
wrap_ber_init
(
struct
bervalU
*
berval
,
void
**
ret
)
static
NTSTATUS
wrap_ber_init
(
void
*
args
)
{
*
ret
=
ber_init
(
(
struct
berval
*
)
berval
);
return
*
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
struct
ber_init_params
*
params
=
args
;
*
params
->
ret
=
ber_init
(
(
struct
berval
*
)
params
->
berval
);
return
*
params
->
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
unsigned
int
CDECL
wrap_ber_next_element
(
void
*
ber
,
unsigned
int
*
ret_len
,
char
*
last
)
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
(
ber
,
&
len
,
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
((
ret
=
ber_next_element
(
params
->
ber
,
&
len
,
params
->
last
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
if
(
ret
>
~
0u
)
{
ERR
(
"ret too large
\n
"
);
...
...
@@ -129,313 +141,371 @@ static unsigned int CDECL wrap_ber_next_element( void *ber, unsigned int *ret_le
return
WLDAP32_LBER_ERROR
;
}
*
ret_len
=
len
;
*
params
->
ret_len
=
len
;
return
ret
;
}
static
unsigned
int
CDECL
wrap_ber_peek_tag
(
void
*
ber
,
unsigned
int
*
ret_len
)
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
(
ber
,
&
len
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
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
;
}
*
ret_len
=
len
;
*
params
->
ret_len
=
len
;
return
ret
;
}
static
unsigned
int
CDECL
wrap_ber_skip_tag
(
void
*
ber
,
unsigned
int
*
ret_len
)
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
(
ber
,
&
len
))
==
LBER_ERROR
)
return
WLDAP32_LBER_ERROR
;
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
;
}
*
ret_len
=
len
;
*
params
->
ret_len
=
len
;
return
ret
;
}
static
int
CDECL
wrap_ber_printf
(
void
*
ber
,
char
*
fmt
,
ULONG_PTR
arg1
,
ULONG_PTR
arg2
)
static
NTSTATUS
wrap_ber_printf
(
void
*
args
)
{
assert
(
strlen
(
fmt
)
==
1
)
;
struct
ber_printf_params
*
params
=
args
;
return
ber_printf
(
ber
,
fmt
,
arg1
,
arg2
);
assert
(
strlen
(
params
->
fmt
)
==
1
);
return
ber_printf
(
params
->
ber
,
params
->
fmt
,
params
->
arg1
,
params
->
arg2
);
}
static
int
CDECL
wrap_ber_scanf
(
void
*
ber
,
char
*
fmt
,
void
*
arg1
,
void
*
arg2
)
static
NTSTATUS
wrap_ber_scanf
(
void
*
args
)
{
assert
(
strlen
(
fmt
)
==
1
);
struct
ber_scanf_params
*
params
=
args
;
assert
(
strlen
(
params
->
fmt
)
==
1
);
return
ber_scanf
(
ber
,
fmt
,
arg1
,
arg2
);
return
ber_scanf
(
params
->
ber
,
params
->
fmt
,
params
->
arg1
,
params
->
arg2
);
}
static
int
CDECL
wrap_ldap_abandon_ext
(
void
*
ld
,
int
msgid
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrl
s
)
static
NTSTATUS
wrap_ldap_abandon_ext
(
void
*
arg
s
)
{
return
ldap_abandon_ext
(
ld
,
msgid
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
struct
ldap_abandon_ext_params
*
params
=
args
;
return
ldap_abandon_ext
(
params
->
ld
,
params
->
msgid
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
int
CDECL
wrap_ldap_add_ext
(
void
*
ld
,
const
char
*
dn
,
LDAPModU
**
attrs
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_add_ext
(
void
*
args
)
{
struct
ldap_add_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_add_ext
(
ld
,
dn
?
dn
:
""
,
attrs
?
(
LDAPMod
**
)
attrs
:
nullmods
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msg
?
(
int
*
)
msg
:
&
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
int
CDECL
wrap_ldap_add_ext_s
(
void
*
ld
,
const
char
*
dn
,
LDAPModU
**
attrs
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
)
static
NTSTATUS
wrap_ldap_add_ext_s
(
void
*
args
)
{
return
ldap_add_ext_s
(
ld
,
dn
?
dn
:
""
,
attrs
?
(
LDAPMod
**
)
attrs
:
nullmods
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
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
int
CDECL
wrap_ldap_compare_ext
(
void
*
ld
,
const
char
*
dn
,
const
char
*
attrs
,
struct
bervalU
*
value
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_compare_ext
(
void
*
args
)
{
struct
ldap_compare_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_compare_ext
(
ld
,
dn
?
dn
:
""
,
attrs
?
attrs
:
""
,
(
struct
berval
*
)
value
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msg
?
(
int
*
)
msg
:
&
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
int
CDECL
wrap_ldap_compare_ext_s
(
void
*
ld
,
const
char
*
dn
,
const
char
*
attrs
,
struct
bervalU
*
value
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
)
static
NTSTATUS
wrap_ldap_compare_ext_s
(
void
*
args
)
{
return
ldap_compare_ext_s
(
ld
,
dn
?
dn
:
""
,
attrs
?
attrs
:
""
,
(
struct
berval
*
)
value
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
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
void
CDECL
wrap_ldap_control_free
(
LDAPControlU
*
control
)
static
NTSTATUS
wrap_ldap_control_free
(
void
*
args
)
{
ldap_control_free
(
(
LDAPControl
*
)
control
);
ldap_control_free
(
args
);
return
STATUS_SUCCESS
;
}
static
void
CDECL
wrap_ldap_controls_free
(
LDAPControlU
**
control
)
static
NTSTATUS
wrap_ldap_controls_free
(
void
*
args
)
{
ldap_controls_free
(
(
LDAPControl
**
)
control
);
ldap_controls_free
(
args
);
return
STATUS_SUCCESS
;
}
static
int
CDECL
wrap_ldap_count_entries
(
void
*
ld
,
void
*
chain
)
static
NTSTATUS
wrap_ldap_count_entries
(
void
*
args
)
{
return
ldap_count_entries
(
ld
,
chain
);
struct
ldap_count_entries_params
*
params
=
args
;
return
ldap_count_entries
(
params
->
ld
,
params
->
chain
);
}
static
int
CDECL
wrap_ldap_count_references
(
void
*
ld
,
void
*
chain
)
static
NTSTATUS
wrap_ldap_count_references
(
void
*
args
)
{
return
ldap_count_references
(
ld
,
chain
);
struct
ldap_count_references_params
*
params
=
args
;
return
ldap_count_references
(
params
->
ld
,
params
->
chain
);
}
static
int
CDECL
wrap_ldap_count_values_len
(
struct
bervalU
**
value
s
)
static
NTSTATUS
wrap_ldap_count_values_len
(
void
*
arg
s
)
{
return
ldap_count_values_len
(
(
struct
berval
**
)
value
s
);
return
ldap_count_values_len
(
arg
s
);
}
static
int
CDECL
wrap_ldap_create_sort_control
(
void
*
ld
,
LDAPSortKeyU
**
keylist
,
int
critical
,
LDAPControlU
**
control
)
static
NTSTATUS
wrap_ldap_create_sort_control
(
void
*
args
)
{
return
ldap_create_sort_control
(
ld
,
(
LDAPSortKey
**
)
keylist
,
critical
,
(
LDAPControl
**
)
control
);
struct
ldap_create_sort_control_params
*
params
=
args
;
return
ldap_create_sort_control
(
params
->
ld
,
(
LDAPSortKey
**
)
params
->
keylist
,
params
->
critical
,
(
LDAPControl
**
)
params
->
control
);
}
static
int
CDECL
wrap_ldap_create_vlv_control
(
void
*
ld
,
LDAPVLVInfoU
*
info
,
LDAPControlU
**
control
)
static
NTSTATUS
wrap_ldap_create_vlv_control
(
void
*
args
)
{
return
ldap_create_vlv_control
(
ld
,
(
LDAPVLVInfo
*
)
info
,
(
LDAPControl
**
)
control
);
struct
ldap_create_vlv_control_params
*
params
=
args
;
return
ldap_create_vlv_control
(
params
->
ld
,
(
LDAPVLVInfo
*
)
params
->
info
,
(
LDAPControl
**
)
params
->
control
);
}
static
int
CDECL
wrap_ldap_delete_ext
(
void
*
ld
,
const
char
*
dn
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_delete_ext
(
void
*
args
)
{
struct
ldap_delete_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_delete_ext
(
ld
,
dn
?
dn
:
""
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
client
ctrls
,
msg
?
(
int
*
)
msg
:
&
dummy
);
return
ldap_delete_ext
(
params
->
ld
,
params
->
dn
?
params
->
dn
:
""
,
(
LDAPControl
**
)
params
->
server
ctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
params
->
msg
?
(
int
*
)
params
->
msg
:
&
dummy
);
}
static
int
CDECL
wrap_ldap_delete_ext_s
(
void
*
ld
,
const
char
*
dn
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrl
s
)
static
NTSTATUS
wrap_ldap_delete_ext_s
(
void
*
arg
s
)
{
return
ldap_delete_ext_s
(
ld
,
dn
?
dn
:
""
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
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
int
CDECL
wrap_ldap_dn2ufn
(
const
char
*
dn
,
char
**
ret
)
static
NTSTATUS
wrap_ldap_dn2ufn
(
void
*
args
)
{
*
ret
=
ldap_dn2ufn
(
dn
);
return
*
ret
?
0
:
-
1
;
struct
ldap_dn2ufn_params
*
params
=
args
;
*
params
->
ret
=
ldap_dn2ufn
(
params
->
dn
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_explode_dn
(
const
char
*
dn
,
int
notypes
,
char
***
ret
)
static
NTSTATUS
wrap_ldap_explode_dn
(
void
*
args
)
{
*
ret
=
ldap_explode_dn
(
dn
,
notypes
);
return
*
ret
?
0
:
-
1
;
struct
ldap_explode_dn_params
*
params
=
args
;
*
params
->
ret
=
ldap_explode_dn
(
params
->
dn
,
params
->
notypes
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_extended_operation
(
void
*
ld
,
const
char
*
oid
,
struct
bervalU
*
data
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_extended_operation
(
void
*
args
)
{
struct
ldap_extended_operation_params
*
params
=
args
;
int
dummy
;
return
ldap_extended_operation
(
ld
,
oid
?
oid
:
""
,
(
struct
berval
*
)
data
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msg
?
(
int
*
)
msg
:
&
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
int
CDECL
wrap_ldap_extended_operation_s
(
void
*
ld
,
const
char
*
oid
,
struct
bervalU
*
data
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
char
**
retoid
,
struct
bervalU
**
retdata
)
static
NTSTATUS
wrap_ldap_extended_operation_s
(
void
*
args
)
{
return
ldap_extended_operation_s
(
ld
,
oid
?
oid
:
""
,
(
struct
berval
*
)
data
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
retoid
,
(
struct
berval
**
)
retdata
);
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
int
CDECL
wrap_ldap_get_dn
(
void
*
ld
,
void
*
entry
,
char
**
ret
)
static
NTSTATUS
wrap_ldap_get_dn
(
void
*
args
)
{
*
ret
=
ldap_get_dn
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
struct
ldap_get_dn_params
*
params
=
args
;
*
params
->
ret
=
ldap_get_dn
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_first_attribute
(
void
*
ld
,
void
*
entry
,
void
**
ber
,
char
**
ret
)
static
NTSTATUS
wrap_ldap_first_attribute
(
void
*
args
)
{
*
ret
=
ldap_first_attribute
(
ld
,
entry
,
(
BerElement
**
)
ber
);
return
*
ret
?
0
:
-
1
;
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
int
CDECL
wrap_ldap_first_entry
(
void
*
ld
,
void
*
chain
,
void
**
ret
)
static
NTSTATUS
wrap_ldap_first_entry
(
void
*
args
)
{
*
ret
=
ldap_first_entry
(
ld
,
chain
);
return
*
ret
?
0
:
-
1
;
struct
ldap_first_entry_params
*
params
=
args
;
*
params
->
ret
=
ldap_first_entry
(
params
->
ld
,
params
->
chain
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_first_reference
(
void
*
ld
,
void
*
chain
,
void
**
ret
)
static
NTSTATUS
wrap_ldap_first_reference
(
void
*
args
)
{
*
ret
=
ldap_first_reference
(
ld
,
chain
);
return
*
ret
?
0
:
-
1
;
struct
ldap_first_reference_params
*
params
=
args
;
*
params
->
ret
=
ldap_first_reference
(
params
->
ld
,
params
->
chain
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_get_option
(
void
*
ld
,
int
option
,
void
*
value
)
static
NTSTATUS
wrap_ldap_get_option
(
void
*
args
)
{
return
ldap_get_option
(
ld
,
option
,
value
);
struct
ldap_get_option_params
*
params
=
args
;
return
ldap_get_option
(
params
->
ld
,
params
->
option
,
params
->
value
);
}
static
int
CDECL
wrap_ldap_get_values_len
(
void
*
ld
,
void
*
entry
,
const
char
*
attr
,
struct
bervalU
***
ret
)
static
NTSTATUS
wrap_ldap_get_values_len
(
void
*
args
)
{
*
ret
=
(
struct
bervalU
**
)
ldap_get_values_len
(
ld
,
entry
,
attr
);
return
*
ret
?
0
:
-
1
;
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
int
CDECL
wrap_ldap_initialize
(
void
**
ld
,
const
char
*
url
)
static
NTSTATUS
wrap_ldap_initialize
(
void
*
args
)
{
return
ldap_initialize
(
(
LDAP
**
)
ld
,
url
);
struct
ldap_initialize_params
*
params
=
args
;
return
ldap_initialize
(
(
LDAP
**
)
params
->
ld
,
params
->
url
);
}
static
void
CDECL
wrap_ldap_memfree
(
void
*
ptr
)
static
NTSTATUS
wrap_ldap_memfree
(
void
*
args
)
{
return
ldap_memfree
(
ptr
);
ldap_memfree
(
args
);
return
STATUS_SUCCESS
;
}
static
void
CDECL
wrap_ldap_memvfree
(
void
**
ptr
)
static
NTSTATUS
wrap_ldap_memvfree
(
void
*
args
)
{
ldap_memvfree
(
ptr
);
ldap_memvfree
(
args
);
return
STATUS_SUCCESS
;
}
static
int
CDECL
wrap_ldap_modify_ext
(
void
*
ld
,
const
char
*
dn
,
LDAPModU
**
mods
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_modify_ext
(
void
*
args
)
{
struct
ldap_modify_ext_params
*
params
=
args
;
int
dummy
;
return
ldap_modify_ext
(
ld
,
dn
?
dn
:
""
,
mods
?
(
LDAPMod
**
)
mods
:
nullmods
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msg
?
(
int
*
)
msg
:
&
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
int
CDECL
wrap_ldap_modify_ext_s
(
void
*
ld
,
const
char
*
dn
,
LDAPModU
**
mods
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
)
static
NTSTATUS
wrap_ldap_modify_ext_s
(
void
*
args
)
{
return
ldap_modify_ext_s
(
ld
,
dn
?
dn
:
""
,
mods
?
(
LDAPMod
**
)
mods
:
nullmods
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
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
int
CDECL
wrap_ldap_msgfree
(
void
*
msg
)
static
NTSTATUS
wrap_ldap_msgfree
(
void
*
args
)
{
return
ldap_msgfree
(
msg
);
return
ldap_msgfree
(
args
);
}
static
int
CDECL
wrap_ldap_next_attribute
(
void
*
ld
,
void
*
entry
,
void
*
ber
,
char
**
ret
)
static
NTSTATUS
wrap_ldap_next_attribute
(
void
*
args
)
{
*
ret
=
ldap_next_attribute
(
ld
,
entry
,
ber
);
return
*
ret
?
0
:
-
1
;
struct
ldap_next_attribute_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_attribute
(
params
->
ld
,
params
->
entry
,
params
->
ber
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_next_entry
(
void
*
ld
,
void
*
entry
,
void
**
ret
)
static
NTSTATUS
wrap_ldap_next_entry
(
void
*
args
)
{
*
ret
=
ldap_next_entry
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
struct
ldap_next_entry_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_entry
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_next_reference
(
void
*
ld
,
void
*
entry
,
void
**
ret
)
static
NTSTATUS
wrap_ldap_next_reference
(
void
*
args
)
{
*
ret
=
ldap_next_reference
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
struct
ldap_next_reference_params
*
params
=
args
;
*
params
->
ret
=
ldap_next_reference
(
params
->
ld
,
params
->
entry
);
return
*
params
->
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_parse_extended_result
(
void
*
ld
,
void
*
result
,
char
**
retoid
,
struct
bervalU
**
retdata
,
int
free
)
static
NTSTATUS
wrap_ldap_parse_extended_result
(
void
*
args
)
{
return
ldap_parse_extended_result
(
ld
,
result
,
retoid
,
(
struct
berval
**
)
retdata
,
free
);
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
int
CDECL
wrap_ldap_parse_reference
(
void
*
ld
,
void
*
ref
,
char
***
referrals
,
LDAPControlU
***
serverctrls
,
int
free
)
static
NTSTATUS
wrap_ldap_parse_reference
(
void
*
args
)
{
return
ldap_parse_reference
(
ld
,
ref
,
referrals
,
(
LDAPControl
***
)
serverctrls
,
free
);
struct
ldap_parse_reference_params
*
params
=
args
;
return
ldap_parse_reference
(
params
->
ld
,
params
->
ref
,
params
->
referrals
,
(
LDAPControl
***
)
params
->
serverctrls
,
params
->
free
);
}
static
int
CDECL
wrap_ldap_parse_result
(
void
*
ld
,
void
*
res
,
int
*
errcode
,
char
**
matcheddn
,
char
**
errmsg
,
char
***
referrals
,
LDAPControlU
***
serverctrls
,
int
free
)
static
NTSTATUS
wrap_ldap_parse_result
(
void
*
args
)
{
return
ldap_parse_result
(
ld
,
res
,
errcode
,
matcheddn
,
errmsg
,
referrals
,
(
LDAPControl
***
)
serverctrls
,
free
);
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
int
CDECL
wrap_ldap_parse_sortresponse_control
(
void
*
ld
,
LDAPControlU
*
ctrl
,
int
*
result
,
char
**
attr
)
static
NTSTATUS
wrap_ldap_parse_sortresponse_control
(
void
*
args
)
{
return
ldap_parse_sortresponse_control
(
ld
,
(
LDAPControl
*
)
ctrl
,
result
,
attr
);
struct
ldap_parse_sortresponse_control_params
*
params
=
args
;
return
ldap_parse_sortresponse_control
(
params
->
ld
,
(
LDAPControl
*
)
params
->
ctrl
,
params
->
result
,
params
->
attr
);
}
static
int
CDECL
wrap_ldap_parse_vlvresponse_control
(
void
*
ld
,
LDAPControlU
*
ctrls
,
int
*
target_pos
,
int
*
list_count
,
struct
bervalU
**
ctx
,
int
*
errcode
)
static
NTSTATUS
wrap_ldap_parse_vlvresponse_control
(
void
*
args
)
{
return
ldap_parse_vlvresponse_control
(
ld
,
(
LDAPControl
*
)
ctrls
,
target_pos
,
list_count
,
(
struct
berval
**
)
ctx
,
errcode
);
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
int
CDECL
wrap_ldap_rename
(
void
*
ld
,
const
char
*
dn
,
const
char
*
newrdn
,
const
char
*
newparent
,
int
delete
,
LDAPControlU
**
clientctrls
,
LDAPControlU
**
serverctrls
,
ULONG
*
msg
)
static
NTSTATUS
wrap_ldap_rename
(
void
*
args
)
{
return
ldap_rename
(
ld
,
dn
?
dn
:
""
,
newrdn
,
newparent
,
delete
,
(
LDAPControl
**
)
clientctrls
,
(
LDAPControl
**
)
serverctrls
,
(
int
*
)
msg
);
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
int
CDECL
wrap_ldap_rename_s
(
void
*
ld
,
const
char
*
dn
,
const
char
*
newrdn
,
const
char
*
newparent
,
int
delete
,
LDAPControlU
**
clientctrls
,
LDAPControlU
**
serverctrls
)
static
NTSTATUS
wrap_ldap_rename_s
(
void
*
args
)
{
return
ldap_rename_s
(
ld
,
dn
?
dn
:
""
,
newrdn
,
newparent
,
delete
,
(
LDAPControl
**
)
clientctrls
,
(
LDAPControl
**
)
serverctrls
);
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
int
CDECL
wrap_ldap_result
(
void
*
ld
,
int
msgid
,
int
all
,
struct
timevalU
*
timeout
,
void
**
result
)
static
NTSTATUS
wrap_ldap_result
(
void
*
args
)
{
return
ldap_result
(
ld
,
msgid
,
all
,
(
struct
timeval
*
)
timeout
,
(
LDAPMessage
**
)
result
);
struct
ldap_result_params
*
params
=
args
;
return
ldap_result
(
params
->
ld
,
params
->
msgid
,
params
->
all
,
(
struct
timeval
*
)
params
->
timeout
,
(
LDAPMessage
**
)
params
->
result
);
}
static
int
CDECL
wrap_ldap_sasl_bind
(
void
*
ld
,
const
char
*
dn
,
const
char
*
mech
,
struct
bervalU
*
cred
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
int
*
msgid
)
static
NTSTATUS
wrap_ldap_sasl_bind
(
void
*
args
)
{
return
ldap_sasl_bind
(
ld
,
dn
,
mech
,
(
struct
berval
*
)
cred
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msgid
);
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
int
CDECL
wrap_ldap_sasl_bind_s
(
void
*
ld
,
const
char
*
dn
,
const
char
*
mech
,
struct
bervalU
*
cred
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
struct
bervalU
**
servercred
)
static
NTSTATUS
wrap_ldap_sasl_bind_s
(
void
*
args
)
{
return
ldap_sasl_bind_s
(
ld
,
dn
,
mech
,
(
struct
berval
*
)
cred
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
(
struct
berval
**
)
servercred
);
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
)
...
...
@@ -473,56 +543,67 @@ static int wrap_sasl_interact( LDAP *ld, unsigned int flags, void *defaults, voi
return
-
1
;
}
static
int
CDECL
wrap_ldap_sasl_interactive_bind_s
(
void
*
ld
,
const
char
*
dn
,
const
char
*
mech
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
unsigned
int
flags
,
void
*
defaults
)
static
NTSTATUS
wrap_ldap_sasl_interactive_bind_s
(
void
*
args
)
{
return
ldap_sasl_interactive_bind_s
(
ld
,
dn
,
mech
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
flags
,
wrap_sasl_interact
,
defaults
);
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
int
CDECL
wrap_ldap_search_ext
(
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
)
static
NTSTATUS
wrap_ldap_search_ext
(
void
*
args
)
{
return
ldap_search_ext
(
ld
,
base
,
scope
,
filter
,
attrs
,
attrsonly
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
(
struct
timeval
*
)
timeout
,
sizelimit
,
(
int
*
)
msg
);
struct
ldap_search_ext_params
*
params
=
args
;
return
ldap_search_ext
(
params
->
ld
,
params
->
base
,
params
->
scope
,
params
->
filter
,
params
->
attrs
,
params
->
attrsonly
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
(
struct
timeval
*
)
params
->
timeout
,
params
->
sizelimit
,
(
int
*
)
params
->
msg
);
}
static
int
CDECL
wrap_ldap_search_ext_s
(
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
)
static
NTSTATUS
wrap_ldap_search_ext_s
(
void
*
args
)
{
return
ldap_search_ext_s
(
ld
,
base
,
scope
,
filter
,
attrs
,
attrsonly
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
(
struct
timeval
*
)
timeout
,
sizelimit
,
(
LDAPMessage
**
)
result
);
struct
ldap_search_ext_s_params
*
params
=
args
;
return
ldap_search_ext_s
(
params
->
ld
,
params
->
base
,
params
->
scope
,
params
->
filter
,
params
->
attrs
,
params
->
attrsonly
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
,
(
struct
timeval
*
)
params
->
timeout
,
params
->
sizelimit
,
(
LDAPMessage
**
)
params
->
result
);
}
static
int
CDECL
wrap_ldap_set_option
(
void
*
ld
,
int
option
,
const
void
*
value
)
static
NTSTATUS
wrap_ldap_set_option
(
void
*
args
)
{
return
ldap_set_option
(
ld
,
option
,
value
);
struct
ldap_set_option_params
*
params
=
args
;
return
ldap_set_option
(
params
->
ld
,
params
->
option
,
params
->
value
);
}
static
int
CDECL
wrap_ldap_start_tls_s
(
void
*
ld
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrl
s
)
static
NTSTATUS
wrap_ldap_start_tls_s
(
void
*
arg
s
)
{
return
ldap_start_tls_s
(
ld
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
struct
ldap_start_tls_s_params
*
params
=
args
;
return
ldap_start_tls_s
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
int
CDECL
wrap_ldap_unbind_ext
(
void
*
ld
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrl
s
)
static
NTSTATUS
wrap_ldap_unbind_ext
(
void
*
arg
s
)
{
return
ldap_unbind_ext
(
ld
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
struct
ldap_unbind_ext_params
*
params
=
args
;
return
ldap_unbind_ext
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
int
CDECL
wrap_ldap_unbind_ext_s
(
void
*
ld
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrl
s
)
static
NTSTATUS
wrap_ldap_unbind_ext_s
(
void
*
arg
s
)
{
return
ldap_unbind_ext_s
(
ld
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
struct
ldap_unbind_ext_s_params
*
params
=
args
;
return
ldap_unbind_ext_s
(
params
->
ld
,
(
LDAPControl
**
)
params
->
serverctrls
,
(
LDAPControl
**
)
params
->
clientctrls
);
}
static
void
CDECL
wrap_ldap_value_free_len
(
struct
bervalU
**
value
s
)
static
NTSTATUS
wrap_ldap_value_free_len
(
void
*
arg
s
)
{
ldap_value_free_len
(
(
struct
berval
**
)
values
);
ldap_value_free_len
(
args
);
return
STATUS_SUCCESS
;
}
static
const
struct
ldap_funcs
funcs
=
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
wrap_ber_alloc_t
,
wrap_ber_bvecfree
,
...
...
@@ -533,9 +614,9 @@ static const struct ldap_funcs funcs =
wrap_ber_init
,
wrap_ber_next_element
,
wrap_ber_peek_tag
,
wrap_ber_skip_tag
,
wrap_ber_printf
,
wrap_ber_scanf
,
wrap_ber_skip_tag
,
wrap_ldap_abandon_ext
,
wrap_ldap_add_ext
,
wrap_ldap_add_ext_s
,
...
...
@@ -554,13 +635,13 @@ static const struct ldap_funcs funcs =
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_first_attribute
,
wrap_ldap_first_entry
,
wrap_ldap_first_reference
,
wrap_ldap_memfree
,
wrap_ldap_memvfree
,
wrap_ldap_modify_ext
,
...
...
@@ -589,10 +670,4 @@ static const struct ldap_funcs funcs =
wrap_ldap_value_free_len
,
};
NTSTATUS
CDECL
__wine_init_unix_lib
(
HMODULE
module
,
DWORD
reason
,
const
void
*
ptr_in
,
void
*
ptr_out
)
{
if
(
reason
!=
DLL_PROCESS_ATTACH
)
return
STATUS_SUCCESS
;
*
(
const
struct
ldap_funcs
**
)
ptr_out
=
&
funcs
;
return
STATUS_SUCCESS
;
}
#endif
/* HAVE_LDAP */
dlls/wldap32/libldap.h
View file @
b2009d02
...
...
@@ -16,6 +16,8 @@
* 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
{
...
...
@@ -93,83 +95,530 @@ struct sasl_interactive_bind_id
ULONG
password_len
;
};
struct
ldap_funcs
{
int
(
CDECL
*
fn_ber_alloc_t
)(
int
,
void
**
);
void
(
CDECL
*
fn_ber_bvecfree
)(
struct
bervalU
**
);
void
(
CDECL
*
fn_ber_bvfree
)(
struct
bervalU
*
);
unsigned
int
(
CDECL
*
fn_ber_first_element
)(
void
*
,
unsigned
int
*
,
char
**
);
int
(
CDECL
*
fn_ber_flatten
)(
void
*
,
struct
bervalU
**
);
void
(
CDECL
*
fn_ber_free
)(
void
*
,
int
);
int
(
CDECL
*
fn_ber_init
)(
struct
bervalU
*
,
void
**
);
unsigned
int
(
CDECL
*
fn_ber_next_element
)(
void
*
,
unsigned
int
*
,
char
*
);
unsigned
int
(
CDECL
*
fn_ber_peek_tag
)(
void
*
,
unsigned
int
*
);
unsigned
int
(
CDECL
*
fn_ber_skip_tag
)(
void
*
,
unsigned
int
*
);
int
(
CDECL
*
fn_ber_printf
)(
void
*
,
char
*
,
ULONG_PTR
arg1
,
ULONG_PTR
arg2
);
int
(
CDECL
*
fn_ber_scanf
)(
void
*
,
char
*
,
void
*
arg1
,
void
*
arg2
);
int
(
CDECL
*
fn_ldap_abandon_ext
)(
void
*
,
int
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_add_ext
)(
void
*
,
const
char
*
,
LDAPModU
**
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_add_ext_s
)(
void
*
,
const
char
*
,
LDAPModU
**
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_compare_ext
)(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_compare_ext_s
)(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
);
void
(
CDECL
*
fn_ldap_control_free
)(
LDAPControlU
*
);
void
(
CDECL
*
fn_ldap_controls_free
)(
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_count_entries
)(
void
*
,
void
*
);
int
(
CDECL
*
fn_ldap_count_references
)(
void
*
,
void
*
);
int
(
CDECL
*
fn_ldap_count_values_len
)(
struct
bervalU
**
);
int
(
CDECL
*
fn_ldap_create_sort_control
)(
void
*
,
LDAPSortKeyU
**
,
int
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_create_vlv_control
)(
void
*
,
LDAPVLVInfoU
*
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_delete_ext
)(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_delete_ext_s
)(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_dn2ufn
)(
const
char
*
,
char
**
);
int
(
CDECL
*
fn_ldap_explode_dn
)(
const
char
*
,
int
,
char
***
);
int
(
CDECL
*
fn_ldap_extended_operation
)(
void
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_extended_operation_s
)(
void
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
char
**
,
struct
bervalU
**
);
int
(
CDECL
*
fn_ldap_get_dn
)(
void
*
,
void
*
,
char
**
);
int
(
CDECL
*
fn_ldap_get_option
)(
void
*
,
int
,
void
*
);
int
(
CDECL
*
fn_ldap_get_values_len
)(
void
*
,
void
*
,
const
char
*
,
struct
bervalU
***
);
int
(
CDECL
*
fn_ldap_initialize
)(
void
**
,
const
char
*
);
int
(
CDECL
*
fn_ldap_first_attribute
)(
void
*
,
void
*
,
void
**
,
char
**
);
int
(
CDECL
*
fn_ldap_first_entry
)(
void
*
,
void
*
,
void
**
);
int
(
CDECL
*
fn_ldap_first_reference
)(
void
*
,
void
*
,
void
**
);
void
(
CDECL
*
fn_ldap_memfree
)(
void
*
);
void
(
CDECL
*
fn_ldap_memvfree
)(
void
**
);
int
(
CDECL
*
fn_ldap_modify_ext
)(
void
*
,
const
char
*
,
LDAPModU
**
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_modify_ext_s
)(
void
*
,
const
char
*
,
LDAPModU
**
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_msgfree
)(
void
*
);
int
(
CDECL
*
fn_ldap_next_attribute
)(
void
*
,
void
*
,
void
*
,
char
**
);
int
(
CDECL
*
fn_ldap_next_entry
)(
void
*
,
void
*
,
void
**
);
int
(
CDECL
*
fn_ldap_next_reference
)(
void
*
,
void
*
,
void
**
);
int
(
CDECL
*
fn_ldap_parse_extended_result
)(
void
*
,
void
*
,
char
**
,
struct
bervalU
**
,
int
);
int
(
CDECL
*
fn_ldap_parse_reference
)(
void
*
,
void
*
,
char
***
,
LDAPControlU
***
,
int
);
int
(
CDECL
*
fn_ldap_parse_result
)(
void
*
,
void
*
,
int
*
,
char
**
,
char
**
,
char
***
,
LDAPControlU
***
,
int
);
int
(
CDECL
*
fn_ldap_parse_sortresponse_control
)(
void
*
,
LDAPControlU
*
,
int
*
,
char
**
);
int
(
CDECL
*
fn_ldap_parse_vlvresponse_control
)(
void
*
,
LDAPControlU
*
,
int
*
,
int
*
,
struct
bervalU
**
,
int
*
);
int
(
CDECL
*
fn_ldap_rename
)(
void
*
,
const
char
*
,
const
char
*
,
const
char
*
,
int
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_rename_s
)(
void
*
,
const
char
*
,
const
char
*
,
const
char
*
,
int
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_result
)(
void
*
,
int
,
int
,
struct
timevalU
*
,
void
**
);
int
(
CDECL
*
fn_ldap_sasl_bind
)(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
int
*
);
int
(
CDECL
*
fn_ldap_sasl_bind_s
)(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
struct
bervalU
**
);
int
(
CDECL
*
fn_ldap_sasl_interactive_bind_s
)(
void
*
,
const
char
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
,
unsigned
int
,
void
*
);
int
(
CDECL
*
fn_ldap_search_ext
)(
void
*
,
const
char
*
,
int
,
const
char
*
,
char
**
,
int
,
LDAPControlU
**
,
LDAPControlU
**
,
struct
timevalU
*
,
int
,
ULONG
*
);
int
(
CDECL
*
fn_ldap_search_ext_s
)(
void
*
,
const
char
*
,
int
,
const
char
*
,
char
**
,
int
,
LDAPControlU
**
,
LDAPControlU
**
,
struct
timevalU
*
,
int
,
void
**
);
int
(
CDECL
*
fn_ldap_set_option
)(
void
*
,
int
,
const
void
*
);
int
(
CDECL
*
fn_ldap_start_tls_s
)(
void
*
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_unbind_ext
)(
void
*
,
LDAPControlU
**
,
LDAPControlU
**
);
int
(
CDECL
*
fn_ldap_unbind_ext_s
)(
void
*
,
LDAPControlU
**
,
LDAPControlU
**
);
void
(
CDECL
*
fn_ldap_value_free_len
)(
struct
bervalU
**
);
};
extern
const
struct
ldap_funcs
*
ldap_funcs
;
/* 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
;
ULONG
*
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 @
b2009d02
...
...
@@ -30,7 +30,7 @@ HINSTANCE hwldap32;
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
const
struct
ldap_funcs
*
ldap_funcs
=
NULL
;
unixlib_handle_t
ldap_handle
=
0
;
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
LPVOID
reserved
)
{
...
...
@@ -41,7 +41,8 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
case
DLL_PROCESS_ATTACH
:
hwldap32
=
hinst
;
DisableThreadLibraryCalls
(
hinst
);
if
(
__wine_init_unix_lib
(
hinst
,
reason
,
NULL
,
&
ldap_funcs
))
if
(
NtQueryVirtualMemory
(
GetCurrentProcess
(),
hinst
,
MemoryWineUnixFuncs
,
&
ldap_handle
,
sizeof
(
ldap_handle
),
NULL
))
ERR
(
"No libldap support, expect problems
\n
"
);
break
;
}
...
...
dlls/wldap32/misc.c
View file @
b2009d02
...
...
@@ -48,7 +48,11 @@ ULONG CDECL ldap_abandon( LDAP *ld, ULONG msgid )
TRACE
(
"(%p, 0x%08x)
\n
"
,
ld
,
msgid
);
if
(
!
ld
)
return
~
0u
;
return
map_error
(
ldap_funcs
->
fn_ldap_abandon_ext
(
CTX
(
ld
),
msgid
,
NULL
,
NULL
)
);
else
{
struct
ldap_abandon_ext_params
params
=
{
CTX
(
ld
),
msgid
};
return
map_error
(
LDAP_CALL
(
ldap_abandon_ext
,
&
params
));
}
}
/***********************************************************************
...
...
@@ -141,7 +145,11 @@ ULONG CDECL ldap_count_entries( LDAP *ld, LDAPMessage *res )
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
)
return
~
0u
;
return
ldap_funcs
->
fn_ldap_count_entries
(
CTX
(
ld
),
MSG
(
res
)
);
else
{
struct
ldap_count_entries_params
params
=
{
CTX
(
ld
),
MSG
(
res
)
};
return
LDAP_CALL
(
ldap_count_entries
,
&
params
);
}
}
/***********************************************************************
...
...
@@ -162,7 +170,11 @@ ULONG CDECL ldap_count_references( LDAP *ld, LDAPMessage *res )
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
)
return
0
;
return
ldap_funcs
->
fn_ldap_count_references
(
CTX
(
ld
),
MSG
(
res
)
);
else
{
struct
ldap_count_references_params
params
=
{
CTX
(
ld
),
MSG
(
res
)
};
return
LDAP_CALL
(
ldap_count_references
,
&
params
);
}
}
static
ULONG
get_escape_size
(
PCHAR
src
,
ULONG
srclen
)
...
...
@@ -297,9 +309,13 @@ WCHAR * CDECL ldap_first_attributeW( LDAP *ld, LDAPMessage *entry, BerElement **
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
entry
,
ptr
);
if
(
!
ld
||
!
entry
)
return
NULL
;
if
(
ld
&&
entry
)
{
struct
ldap_first_attribute_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
berU
,
&
retU
};
LDAP_CALL
(
ldap_first_attribute
,
&
params
);
}
else
return
NULL
;
ldap_funcs
->
fn_ldap_first_attribute
(
CTX
(
ld
),
MSG
(
entry
),
&
berU
,
&
retU
);
if
(
retU
&&
(
ber
=
malloc
(
sizeof
(
*
ber
)
)))
{
BER
(
ber
)
=
(
char
*
)
berU
;
...
...
@@ -307,7 +323,7 @@ WCHAR * CDECL ldap_first_attributeW( LDAP *ld, LDAPMessage *entry, BerElement **
ret
=
strUtoW
(
retU
);
}
ldap_funcs
->
fn_ldap_memfree
(
retU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
return
ret
;
}
...
...
@@ -333,14 +349,15 @@ LDAPMessage * CDECL ldap_first_entry( LDAP *ld, LDAPMessage *res )
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
||
!
res
)
return
NULL
;
if
(
!
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
MSG
(
res
),
&
msgU
))
if
(
ld
&&
res
)
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
struct
ldap_first_entry_params
params
=
{
CTX
(
ld
),
MSG
(
res
),
&
msgU
};
if
(
!
LDAP_CALL
(
ldap_first_entry
,
&
params
))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
}
}
return
NULL
;
}
...
...
@@ -363,14 +380,15 @@ LDAPMessage * CDECL ldap_first_reference( LDAP *ld, LDAPMessage *res )
TRACE
(
"(%p, %p)
\n
"
,
ld
,
res
);
if
(
!
ld
)
return
NULL
;
if
(
!
ldap_funcs
->
fn_ldap_first_reference
(
CTX
(
ld
),
MSG
(
res
),
&
msgU
))
if
(
ld
)
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
struct
ldap_first_reference_params
params
=
{
CTX
(
ld
),
MSG
(
res
),
&
msgU
};
if
(
!
LDAP_CALL
(
ldap_first_reference
,
&
params
))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
}
}
return
NULL
;
}
...
...
@@ -415,7 +433,7 @@ ULONG CDECL ldap_msgfree( LDAPMessage *res )
if
(
!
res
)
return
LDAP_SUCCESS
;
ldap_funcs
->
fn_ldap_msgfree
(
MSG
(
res
)
);
LDAP_CALL
(
ldap_msgfree
,
MSG
(
res
)
);
while
(
list
)
{
entry
=
list
;
...
...
@@ -475,14 +493,15 @@ WCHAR * CDECL ldap_next_attributeW( LDAP *ld, LDAPMessage *entry, BerElement *pt
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
entry
,
ptr
);
if
(
!
ld
||
!
entry
||
!
ptr
)
return
NULL
;
if
(
!
ldap_funcs
->
fn_ldap_next_attribute
(
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
),
&
retU
))
if
(
ld
&&
entry
&&
ptr
)
{
ret
=
strUtoW
(
retU
);
ldap_funcs
->
fn_ldap_memfree
(
retU
);
struct
ldap_next_attribute_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
),
&
retU
};
if
(
!
LDAP_CALL
(
ldap_next_attribute
,
&
params
))
{
ret
=
strUtoW
(
retU
);
LDAP_CALL
(
ldap_memfree
,
retU
);
}
}
return
ret
;
}
...
...
@@ -512,8 +531,12 @@ LDAPMessage * CDECL ldap_next_entry( LDAP *ld, LDAPMessage *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
);
}
ldap_funcs
->
fn_ldap_next_entry
(
CTX
(
ld
),
MSG
(
entry
),
&
msgU
);
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
@@ -549,8 +572,11 @@ LDAPMessage * CDECL ldap_next_reference( LDAP *ld, LDAPMessage *entry )
if
(
!
ld
||
!
entry
)
return
NULL
;
if
(
entry
->
lm_next
)
return
entry
->
lm_next
;
ldap_funcs
->
fn_ldap_next_reference
(
CTX
(
ld
),
MSG
(
entry
),
&
msgU
);
else
{
struct
ldap_next_reference_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
&
msgU
};
LDAP_CALL
(
ldap_next_reference
,
&
params
);
}
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
@@ -601,19 +627,22 @@ ULONG CDECL ldap_result( LDAP *ld, ULONG msgid, ULONG all, struct l_timeval *tim
LDAPMessage
*
msg
;
struct
timevalU
timeval
;
void
*
msgU
=
NULL
;
ULONG
ret
;
ULONG
ret
=
~
0u
;
TRACE
(
"(%p, 0x%08x, 0x%08x, %p, %p)
\n
"
,
ld
,
msgid
,
all
,
timeout
,
res
);
if
(
!
ld
||
!
res
||
msgid
==
~
0u
)
return
~
0u
;
if
(
timeout
)
if
(
ld
&&
res
&&
msgid
!=
~
0u
)
{
timeval
.
tv_sec
=
timeout
->
tv_sec
;
timeval
.
tv_usec
=
timeout
->
tv_usec
;
}
struct
ldap_result_params
params
=
{
CTX
(
ld
),
msgid
,
all
,
timeout
?
&
timeval
:
NULL
,
&
msgU
};
ret
=
ldap_funcs
->
fn_ldap_result
(
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
);
}
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
dlls/wldap32/modify.c
View file @
b2009d02
...
...
@@ -157,8 +157,11 @@ ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW
if
(
mods
&&
!
(
modsU
=
modarrayWtoU
(
mods
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_modify_ext
(
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
else
{
struct
ldap_modify_ext_params
params
=
{
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_modify_ext
,
&
params
));
}
exit:
free
(
dnU
);
...
...
@@ -237,8 +240,11 @@ ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPContro
if
(
mods
&&
!
(
modsU
=
modarrayWtoU
(
mods
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_modify_ext_s
(
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
)
);
else
{
struct
ldap_modify_ext_s_params
params
=
{
CTX
(
ld
),
dnU
,
modsU
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_modify_ext_s
,
&
params
));
}
exit:
free
(
dnU
);
...
...
dlls/wldap32/modrdn.c
View file @
b2009d02
...
...
@@ -134,18 +134,19 @@ ULONG CDECL ldap_modrdn2W( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
if
(
!
ld
||
!
newdn
)
return
~
0u
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
!
(
newdnU
=
strWtoU
(
newdn
)))
goto
exit
;
ret
=
ldap_funcs
->
fn_ldap_rename
(
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0u
;
exit:
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
return
LDAP_NO_MEMORY
;
if
((
newdnU
=
strWtoU
(
newdn
)))
{
struct
ldap_rename_params
params
=
{
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
,
&
msg
};
ret
=
LDAP_CALL
(
ldap_rename
,
&
params
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0u
;
free
(
newdnU
);
}
free
(
dnU
);
free
(
newdnU
);
return
ret
;
}
...
...
@@ -198,14 +199,15 @@ ULONG CDECL ldap_modrdn2_sW( LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete )
if
(
!
ld
||
!
newdn
)
return
LDAP_PARAM_ERROR
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
!
(
newdnU
=
strWtoU
(
newdn
)))
goto
exit
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
return
LDAP_NO_MEMORY
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_rename_s
(
CTX
(
ld
),
dnU
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
));
exit:
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
));
free
(
newdnU
);
}
free
(
dnU
);
free
(
newdnU
);
return
ret
;
}
...
...
dlls/wldap32/option.c
View file @
b2009d02
...
...
@@ -184,10 +184,13 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
if
(
!
featureW
->
ldapaif_name
)
return
LDAP_PARAM_ERROR
;
featureU
.
ldapaif_info_version
=
featureW
->
ldapaif_info_version
;
if
(
!
(
featureU
.
ldapaif_name
=
strWtoU
(
featureW
->
ldapaif_name
)))
return
LDAP_NO_MEMORY
;
featureU
.
ldapaif_version
=
0
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_get_option
(
CTX
(
ld
),
option
,
&
featureU
)
);
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
));
}
else
return
LDAP_NO_MEMORY
;
if
(
ret
==
LDAP_SUCCESS
)
featureW
->
ldapaif_version
=
featureU
.
ldapaif_version
;
free
(
featureU
.
ldapaif_name
);
...
...
@@ -197,11 +200,12 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
{
LDAPAPIInfoU
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_funcs
->
fn_ldap_get_option
(
CTX
(
ld
),
option
,
&
infoU
)
);
ret
=
map_error
(
LDAP_CALL
(
ldap_get_option
,
&
params
)
);
if
(
ret
==
LDAP_SUCCESS
)
{
infoW
->
ldapai_api_version
=
infoU
.
ldapai_api_version
;
...
...
@@ -211,13 +215,13 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
return
LDAP_NO_MEMORY
;
if
(
infoU
.
ldapai_vendor_name
&&
!
(
infoW
->
ldapai_vendor_name
=
strUtoW
(
infoU
.
ldapai_vendor_name
)))
{
ldap_funcs
->
fn_ldap_memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
LDAP_CALL
(
ldap_memvfree
,
infoU
.
ldapai_extensions
);
return
LDAP_NO_MEMORY
;
}
infoW
->
ldapai_vendor_version
=
infoU
.
ldapai_vendor_version
;
ldap_funcs
->
fn_ldap_memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
ldap_funcs
->
fn_ldap_memfree
(
infoU
.
ldapai_vendor_name
);
LDAP_CALL
(
ldap_memvfree
,
infoU
.
ldapai_extensions
);
LDAP_CALL
(
ldap_memfree
,
infoU
.
ldapai_vendor_name
);
}
return
ret
;
}
...
...
@@ -229,7 +233,10 @@ ULONG CDECL ldap_get_optionW( LDAP *ld, int option, void *value )
case
LDAP_OPT_REFERRALS
:
case
LDAP_OPT_SIZELIMIT
:
case
LDAP_OPT_TIMELIMIT
:
return
map_error
(
ldap_funcs
->
fn_ldap_get_option
(
CTX
(
ld
),
option
,
value
));
{
struct
ldap_get_option_params
params
=
{
CTX
(
ld
),
option
,
value
};
return
map_error
(
LDAP_CALL
(
ldap_get_option
,
&
params
));
}
case
LDAP_OPT_CACHE_ENABLE
:
case
LDAP_OPT_CACHE_FN_PTRS
:
...
...
@@ -371,22 +378,30 @@ static BOOL query_supported_server_ctrls( LDAP *ld )
struct
bervalU
**
ctrls
=
SERVER_CTRLS
(
ld
);
ULONG
ret
;
if
(
ctrls
)
return
TRUE
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_search_ext_s
(
CTX
(
ld
),
(
char
*
)
""
,
LDAP_SCOPE_BASE
,
(
char
*
)
"(objectClass=*)"
,
attrs
,
FALSE
,
NULL
,
NULL
,
NULL
,
0
,
&
res
)
);
if
(
ret
!=
LDAP_SUCCESS
)
return
FALSE
;
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
(
!
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
res
,
&
entry
)
)
if
(
ret
==
LDAP_SUCCESS
)
{
ULONG
count
,
i
;
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
entry
,
attrs
[
0
],
&
ctrls
);
count
=
ldap_funcs
->
fn_ldap_count_values_len
(
ctrls
);
for
(
i
=
0
;
i
<
count
;
i
++
)
TRACE
(
"%u: %s
\n
"
,
i
,
debugstr_an
(
ctrls
[
i
]
->
bv_val
,
ctrls
[
i
]
->
bv_len
));
*
(
struct
bervalU
***
)
&
SERVER_CTRLS
(
ld
)
=
ctrls
;
struct
ldap_first_entry_params
params
=
{
CTX
(
ld
),
res
,
&
entry
};
if
(
!
LDAP_CALL
(
ldap_first_entry
,
&
params
))
{
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
);
for
(
i
=
0
;
i
<
count
;
i
++
)
TRACE
(
"%u: %s
\n
"
,
i
,
debugstr_an
(
ctrls
[
i
]
->
bv_val
,
ctrls
[
i
]
->
bv_len
));
*
(
struct
bervalU
***
)
&
SERVER_CTRLS
(
ld
)
=
ctrls
;
}
}
else
return
FALSE
;
ldap_funcs
->
fn_ldap_msgfree
(
res
);
LDAP_CALL
(
ldap_msgfree
,
res
);
return
ctrls
!=
NULL
;
}
...
...
@@ -398,7 +413,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_funcs
->
fn_ldap_count_values_len
(
SERVER_CTRLS
(
ld
)
);
server_count
=
LDAP_CALL
(
ldap_count_values_len
,
SERVER_CTRLS
(
ld
)
);
for
(
n
=
0
;
n
<
user_count
;
n
++
)
{
...
...
@@ -454,18 +469,21 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
if
(
!
is_supported_server_ctrls
(
ld
,
ctrlsU
))
ret
=
LDAP_PARAM_ERROR
;
else
ret
=
map_error
(
ldap_funcs
->
fn_ldap_set_option
(
CTX
(
ld
),
option
,
ctrlsU
)
);
{
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
ctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
));
}
controlarrayfreeU
(
ctrlsU
);
return
ret
;
}
case
LDAP_OPT_REFERRALS
:
{
void
*
openldap_referral
=
LDAP_OPT_ON
;
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
LDAP_OPT_ON
}
;
if
(
value
==
LDAP_OPT_OFF
)
openldap_referral
=
LDAP_OPT_OFF
;
params
.
value
=
LDAP_OPT_OFF
;
else
FIXME
(
"upgrading referral value %p to LDAP_OPT_ON (OpenLDAP lacks sufficient granularity)
\n
"
,
value
);
return
map_error
(
ldap_funcs
->
fn_ldap_set_option
(
CTX
(
ld
),
option
,
openldap_referral
)
);
return
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
)
);
}
case
LDAP_OPT_DEREF
:
case
LDAP_OPT_DESC
:
...
...
@@ -473,7 +491,10 @@ ULONG CDECL ldap_set_optionW( LDAP *ld, int option, void *value )
case
LDAP_OPT_PROTOCOL_VERSION
:
case
LDAP_OPT_SIZELIMIT
:
case
LDAP_OPT_TIMELIMIT
:
return
map_error
(
ldap_funcs
->
fn_ldap_set_option
(
CTX
(
ld
),
option
,
value
));
{
struct
ldap_set_option_params
params
=
{
CTX
(
ld
),
option
,
value
};
return
map_error
(
LDAP_CALL
(
ldap_set_option
,
&
params
));
}
case
LDAP_OPT_CACHE_ENABLE
:
case
LDAP_OPT_CACHE_FN_PTRS
:
...
...
dlls/wldap32/parse.c
View file @
b2009d02
...
...
@@ -87,21 +87,24 @@ ULONG CDECL ldap_parse_extended_resultW( LDAP *ld, LDAPMessage *result, WCHAR **
if
(
!
ld
)
return
LDAP_PARAM_ERROR
;
if
(
!
result
)
return
LDAP_NO_RESULTS_RETURNED
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_extended_result
(
CTX
(
ld
),
result
,
&
oidU
,
&
dataU
,
free
)
);
else
{
struct
ldap_parse_extended_result_params
params
=
{
CTX
(
ld
),
result
,
&
oidU
,
&
dataU
,
free
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_extended_result
,
&
params
));
}
if
(
oid
&&
oidU
)
{
WCHAR
*
str
;
if
((
str
=
strUtoW
(
oidU
)))
*
oid
=
str
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_memfree
(
oidU
);
LDAP_CALL
(
ldap_memfree
,
oidU
);
}
if
(
data
&&
dataU
)
{
struct
berval
*
bv
;
if
((
bv
=
bervalUtoW
(
dataU
)))
*
data
=
bv
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ber_bvfree
(
dataU
);
LDAP_CALL
(
ber_bvfree
,
dataU
);
}
return
ret
;
...
...
@@ -151,20 +154,22 @@ ULONG CDECL ldap_parse_referenceA( LDAP *ld, LDAPMessage *message, char ***refer
*/
ULONG
CDECL
ldap_parse_referenceW
(
LDAP
*
ld
,
LDAPMessage
*
message
,
WCHAR
***
referrals
)
{
ULONG
ret
;
ULONG
ret
=
~
0u
;
char
**
referralsU
=
NULL
;
TRACE
(
"(%p, %p, %p)
\n
"
,
ld
,
message
,
referrals
);
if
(
!
ld
)
return
~
0u
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_reference
(
CTX
(
ld
),
message
,
&
referralsU
,
NULL
,
0
)
);
if
(
ld
)
{
struct
ldap_parse_reference_params
params
=
{
CTX
(
ld
),
message
,
&
referralsU
,
NULL
,
0
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_reference
,
&
params
));
}
if
(
referralsU
)
{
WCHAR
**
ref
;
if
((
ref
=
strarrayUtoW
(
referralsU
)))
*
referrals
=
ref
;
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_memfree
(
referralsU
);
LDAP_CALL
(
ldap_memfree
,
referralsU
);
}
return
ret
;
}
...
...
@@ -235,20 +240,23 @@ ULONG CDECL ldap_parse_resultW( LDAP *ld, LDAPMessage *result, ULONG *retcode, W
TRACE
(
"(%p, %p, %p, %p, %p, %p, %p, 0x%02x)
\n
"
,
ld
,
result
,
retcode
,
matched
,
error
,
referrals
,
serverctrls
,
free
);
if
(
!
ld
)
return
LDAP_PARAM_ERROR
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_result
(
CTX
(
ld
),
MSG
(
result
),
(
int
*
)
retcode
,
&
matchedU
,
&
errorU
,
&
referralsU
,
&
serverctrlsU
,
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
LDAP_PARAM_ERROR
;
if
(
matched
)
*
matched
=
strUtoW
(
matchedU
);
if
(
error
)
*
error
=
strUtoW
(
errorU
);
if
(
referrals
)
*
referrals
=
strarrayUtoW
(
referralsU
);
if
(
serverctrls
)
*
serverctrls
=
controlarrayUtoW
(
serverctrlsU
);
ldap_funcs
->
fn_ldap_memfree
(
matchedU
);
ldap_funcs
->
fn_ldap_memfree
(
errorU
);
ldap_funcs
->
fn_ldap_memvfree
(
(
void
**
)
referralsU
);
ldap_funcs
->
fn_ldap_controls_free
(
serverctrlsU
);
LDAP_CALL
(
ldap_memfree
,
matchedU
);
LDAP_CALL
(
ldap_memfree
,
errorU
);
LDAP_CALL
(
ldap_memvfree
,
referralsU
);
LDAP_CALL
(
ldap_controls_free
,
serverctrlsU
);
return
ret
;
}
...
...
@@ -318,8 +326,11 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
controlarrayfreeU
(
controlU
);
return
LDAP_CONTROL_NOT_FOUND
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_sortresponse_control
(
CTX
(
ld
),
sortcontrol
,
&
res
,
&
attrU
)
);
else
{
struct
ldap_parse_sortresponse_control_params
params
=
{
CTX
(
ld
),
sortcontrol
,
&
res
,
&
attrU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_parse_sortresponse_control
,
&
params
));
}
if
(
ret
==
LDAP_SUCCESS
)
{
WCHAR
*
str
;
...
...
@@ -329,7 +340,7 @@ ULONG CDECL ldap_parse_sort_controlW( LDAP *ld, LDAPControlW **control, ULONG *r
*
result
=
res
;
}
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ldap_memfree
(
attrU
);
LDAP_CALL
(
ldap_memfree
,
attrU
);
}
controlarrayfreeU
(
controlU
);
...
...
@@ -401,9 +412,11 @@ int CDECL ldap_parse_vlv_controlW( LDAP *ld, LDAPControlW **control, ULONG *targ
controlarrayfreeU
(
controlU
);
return
LDAP_CONTROL_NOT_FOUND
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_parse_vlvresponse_control
(
CTX
(
ld
),
vlvcontrolU
,
&
pos
,
&
count
,
&
ctxU
,
errcode
)
);
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
));
}
if
(
ret
==
LDAP_SUCCESS
)
{
struct
berval
*
bv
;
...
...
@@ -414,7 +427,7 @@ int CDECL ldap_parse_vlv_controlW( LDAP *ld, LDAPControlW **control, ULONG *targ
*
listcount
=
count
;
}
else
ret
=
LDAP_NO_MEMORY
;
ldap_funcs
->
fn_ber_bvfree
(
ctxU
);
LDAP_CALL
(
ber_bvfree
,
ctxU
);
}
controlarrayfreeU
(
controlU
);
...
...
dlls/wldap32/rename.c
View file @
b2009d02
...
...
@@ -104,9 +104,11 @@ ULONG CDECL ldap_rename_extW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpare
if
(
newparent
&&
!
(
newparentU
=
strWtoU
(
newparent
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_rename
(
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
,
message
)
);
else
{
struct
ldap_rename_params
params
=
{
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
,
message
};
ret
=
map_error
(
LDAP_CALL
(
ldap_rename
,
&
params
));
}
exit:
free
(
dnU
);
free
(
newrdnU
);
...
...
@@ -184,9 +186,11 @@ ULONG CDECL ldap_rename_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newpa
if
(
newparent
&&
!
(
newparentU
=
strWtoU
(
newparent
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_rename_s
(
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
)
);
else
{
struct
ldap_rename_s_params
params
=
{
CTX
(
ld
),
dnU
,
newrdnU
,
newparentU
,
delete
,
serverctrlsU
,
clientctrlsU
};
ret
=
map_error
(
LDAP_CALL
(
ldap_rename_s
,
&
params
));
}
exit:
free
(
dnU
);
free
(
newrdnU
);
...
...
dlls/wldap32/search.c
View file @
b2009d02
...
...
@@ -176,8 +176,11 @@ ULONG CDECL ldap_search_extW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filter,
timevalU
.
tv_sec
=
timelimit
;
timevalU
.
tv_usec
=
0
;
ret
=
map_error
(
ldap_funcs
->
fn_ldap_search_ext
(
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timelimit
?
&
timevalU
:
NULL
,
sizelimit
,
message
)
);
{
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
));
}
exit:
free
(
baseU
);
free
(
filterU
);
...
...
@@ -276,8 +279,12 @@ ULONG CDECL ldap_search_ext_sW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filte
timevalU
.
tv_usec
=
timeout
->
tv_usec
;
}
ret
=
map_error
(
ldap_funcs
->
fn_ldap_search_ext_s
(
CTX
(
ld
),
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
serverctrlsU
,
clientctrlsU
,
timeout
?
&
timevalU
:
NULL
,
sizelimit
,
&
msgU
)
);
{
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
));
}
if
(
msgU
)
{
LDAPMessage
*
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
);
...
...
@@ -288,7 +295,7 @@ ULONG CDECL ldap_search_ext_sW( LDAP *ld, WCHAR *base, ULONG scope, WCHAR *filte
}
else
{
ldap_funcs
->
fn_ldap_msgfree
(
msgU
);
LDAP_CALL
(
ldap_msgfree
,
msgU
);
ret
=
LDAP_NO_MEMORY
;
}
}
...
...
dlls/wldap32/value.c
View file @
b2009d02
...
...
@@ -195,18 +195,20 @@ WCHAR ** CDECL ldap_get_valuesW( LDAP *ld, LDAPMessage *entry, WCHAR *attr )
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
entry
,
debugstr_w
(
attr
)
);
if
(
!
ld
||
!
entry
||
!
attr
||
!
(
attrU
=
strWtoU
(
attr
)))
return
NULL
;
if
(
!
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
entry
),
attrU
,
&
bv
))
if
(
ld
&&
entry
&&
attr
&&
(
attrU
=
strWtoU
(
attr
)))
{
retU
=
bv2str_array
(
bv
);
ret
=
strarrayUtoW
(
retU
);
struct
ldap_get_values_len_params
params
=
{
CTX
(
ld
),
MSG
(
entry
),
attrU
,
&
bv
};
ldap_funcs
->
fn_ldap_value_free_len
(
bv
);
strarrayfreeU
(
retU
);
}
if
(
!
LDAP_CALL
(
ldap_get_values_len
,
&
params
))
{
retU
=
bv2str_array
(
bv
);
ret
=
strarrayUtoW
(
retU
);
free
(
attrU
);
LDAP_CALL
(
ldap_value_free_len
,
bv
);
strarrayfreeU
(
retU
);
}
free
(
attrU
);
}
return
ret
;
}
...
...
@@ -257,15 +259,18 @@ struct berval ** CDECL ldap_get_values_lenW( LDAP *ld, LDAPMessage *message, WCH
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
message
,
debugstr_w
(
attr
)
);
if
(
!
ld
||
!
message
||
!
attr
||
!
(
attrU
=
strWtoU
(
attr
)))
return
NULL
;
if
(
!
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
message
),
attrU
,
&
retU
))
if
(
ld
&&
message
&&
attr
&&
(
attrU
=
strWtoU
(
attr
)))
{
ret
=
bvarrayUtoW
(
retU
);
bvarrayfreeU
(
retU
);
}
struct
ldap_get_values_len_params
params
=
{
CTX
(
ld
),
MSG
(
message
),
attrU
,
&
retU
};
free
(
attrU
);
if
(
!
LDAP_CALL
(
ldap_get_values_len
,
&
params
))
{
ret
=
bvarrayUtoW
(
retU
);
bvarrayfreeU
(
retU
);
}
free
(
attrU
);
}
return
ret
;
}
...
...
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