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
3cc3dd78
Commit
3cc3dd78
authored
Nov 03, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Avoid returning pointers from the Unix interface functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cefd34fb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
55 deletions
+63
-55
ber.c
dlls/wldap32/ber.c
+2
-2
dn.c
dlls/wldap32/dn.c
+3
-3
libldap.c
dlls/wldap32/libldap.c
+36
-24
libldap.h
dlls/wldap32/libldap.h
+12
-12
misc.c
dlls/wldap32/misc.c
+6
-9
option.c
dlls/wldap32/option.c
+2
-3
value.c
dlls/wldap32/value.c
+2
-2
No files found.
dlls/wldap32/ber.c
View file @
3cc3dd78
...
...
@@ -51,7 +51,7 @@ BerElement * CDECL ber_alloc_t( int options )
BerElement
*
ret
;
if
(
!
(
ret
=
malloc
(
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
BER
(
ret
)
=
ldap_funcs
->
fn_ber_alloc_t
(
options
)
))
if
(
ldap_funcs
->
fn_ber_alloc_t
(
options
,
(
void
**
)
&
BER
(
ret
)
))
{
free
(
ret
);
return
NULL
;
...
...
@@ -226,7 +226,7 @@ BerElement * CDECL ber_init( BERVAL *berval )
free
(
ret
);
return
NULL
;
}
if
(
!
(
BER
(
ret
)
=
ldap_funcs
->
fn_ber_init
(
bervalU
)
))
if
(
ldap_funcs
->
fn_ber_init
(
bervalU
,
(
void
**
)
&
BER
(
ret
)
))
{
free
(
ret
);
ret
=
NULL
;
...
...
dlls/wldap32/dn.c
View file @
3cc3dd78
...
...
@@ -75,7 +75,7 @@ WCHAR * CDECL ldap_dn2ufnW( WCHAR *dn )
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
retU
=
ldap_funcs
->
fn_ldap_dn2ufn
(
dn
U
);
ldap_funcs
->
fn_ldap_dn2ufn
(
dnU
,
&
ret
U
);
ret
=
strUtoW
(
retU
);
free
(
dnU
);
...
...
@@ -131,7 +131,7 @@ WCHAR ** CDECL ldap_explode_dnW( WCHAR *dn, ULONG notypes )
if
(
!
(
dnU
=
strWtoU
(
dn
)))
return
NULL
;
retU
=
ldap_funcs
->
fn_ldap_explode_dn
(
dnU
,
notypes
);
ldap_funcs
->
fn_ldap_explode_dn
(
dnU
,
notypes
,
&
retU
);
ret
=
strarrayUtoW
(
retU
);
free
(
dnU
);
...
...
@@ -185,7 +185,7 @@ WCHAR * CDECL ldap_get_dnW( LDAP *ld, LDAPMessage *entry )
if
(
!
ld
||
!
entry
)
return
NULL
;
retU
=
ldap_funcs
->
fn_ldap_get_dn
(
CTX
(
ld
),
MSG
(
entry
)
);
ldap_funcs
->
fn_ldap_get_dn
(
CTX
(
ld
),
MSG
(
entry
),
&
retU
);
ret
=
strUtoW
(
retU
);
ldap_funcs
->
fn_ldap_memfree
(
retU
);
...
...
dlls/wldap32/libldap.c
View file @
3cc3dd78
...
...
@@ -59,9 +59,10 @@ C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
static
LDAPMod
*
nullmods
[]
=
{
NULL
};
static
void
*
CDECL
wrap_ber_alloc_t
(
int
options
)
static
int
CDECL
wrap_ber_alloc_t
(
int
options
,
void
**
ret
)
{
return
ber_alloc_t
(
options
);
*
ret
=
ber_alloc_t
(
options
);
return
*
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
void
CDECL
wrap_ber_bvecfree
(
struct
bervalU
**
berval
)
...
...
@@ -105,9 +106,10 @@ static void CDECL wrap_ber_free( void *ber, int freebuf )
ber_free
(
ber
,
freebuf
);
}
static
void
*
CDECL
wrap_ber_init
(
struct
bervalU
*
berval
)
static
int
CDECL
wrap_ber_init
(
struct
bervalU
*
berval
,
void
**
ret
)
{
return
ber_init
(
(
struct
berval
*
)
berval
);
*
ret
=
ber_init
(
(
struct
berval
*
)
berval
);
return
*
ret
?
LDAP_SUCCESS
:
WLDAP32_LBER_ERROR
;
}
static
unsigned
int
CDECL
wrap_ber_next_element
(
void
*
ber
,
unsigned
int
*
ret_len
,
char
*
last
)
...
...
@@ -260,14 +262,16 @@ static int CDECL wrap_ldap_delete_ext_s( void *ld, const char *dn, LDAPControlU
return
ldap_delete_ext_s
(
ld
,
dn
?
dn
:
""
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
}
static
char
*
CDECL
wrap_ldap_dn2ufn
(
const
char
*
dn
)
static
int
CDECL
wrap_ldap_dn2ufn
(
const
char
*
dn
,
char
**
ret
)
{
return
ldap_dn2ufn
(
dn
);
*
ret
=
ldap_dn2ufn
(
dn
);
return
*
ret
?
0
:
-
1
;
}
static
char
**
CDECL
wrap_ldap_explode_dn
(
const
char
*
dn
,
int
notypes
)
static
int
CDECL
wrap_ldap_explode_dn
(
const
char
*
dn
,
int
notypes
,
char
***
ret
)
{
return
ldap_explode_dn
(
dn
,
notypes
);
*
ret
=
ldap_explode_dn
(
dn
,
notypes
);
return
*
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_extended_operation
(
void
*
ld
,
const
char
*
oid
,
struct
bervalU
*
data
,
LDAPControlU
**
serverctrls
,
...
...
@@ -285,24 +289,28 @@ static int CDECL wrap_ldap_extended_operation_s( void *ld, const char *oid, stru
(
LDAPControl
**
)
clientctrls
,
retoid
,
(
struct
berval
**
)
retdata
);
}
static
char
*
CDECL
wrap_ldap_get_dn
(
void
*
ld
,
void
*
entry
)
static
int
CDECL
wrap_ldap_get_dn
(
void
*
ld
,
void
*
entry
,
char
**
ret
)
{
return
ldap_get_dn
(
ld
,
entry
);
*
ret
=
ldap_get_dn
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
}
static
char
*
CDECL
wrap_ldap_first_attribute
(
void
*
ld
,
void
*
entry
,
void
**
ber
)
static
int
CDECL
wrap_ldap_first_attribute
(
void
*
ld
,
void
*
entry
,
void
**
ber
,
char
**
ret
)
{
return
ldap_first_attribute
(
ld
,
entry
,
(
BerElement
**
)
ber
);
*
ret
=
ldap_first_attribute
(
ld
,
entry
,
(
BerElement
**
)
ber
);
return
*
ret
?
0
:
-
1
;
}
static
void
*
CDECL
wrap_ldap_first_entry
(
void
*
ld
,
void
*
chain
)
static
int
CDECL
wrap_ldap_first_entry
(
void
*
ld
,
void
*
chain
,
void
**
ret
)
{
return
ldap_first_entry
(
ld
,
chain
);
*
ret
=
ldap_first_entry
(
ld
,
chain
);
return
*
ret
?
0
:
-
1
;
}
static
void
*
CDECL
wrap_ldap_first_reference
(
void
*
ld
,
void
*
chain
)
static
int
CDECL
wrap_ldap_first_reference
(
void
*
ld
,
void
*
chain
,
void
**
ret
)
{
return
ldap_first_reference
(
ld
,
chain
);
*
ret
=
ldap_first_reference
(
ld
,
chain
);
return
*
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_get_option
(
void
*
ld
,
int
option
,
void
*
value
)
...
...
@@ -310,9 +318,10 @@ static int CDECL wrap_ldap_get_option( void *ld, int option, void *value )
return
ldap_get_option
(
ld
,
option
,
value
);
}
static
struct
bervalU
**
CDECL
wrap_ldap_get_values_len
(
void
*
ld
,
void
*
entry
,
const
char
*
attr
)
static
int
CDECL
wrap_ldap_get_values_len
(
void
*
ld
,
void
*
entry
,
const
char
*
attr
,
struct
bervalU
***
ret
)
{
return
(
struct
bervalU
**
)
ldap_get_values_len
(
ld
,
entry
,
attr
);
*
ret
=
(
struct
bervalU
**
)
ldap_get_values_len
(
ld
,
entry
,
attr
);
return
*
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_initialize
(
void
**
ld
,
const
char
*
url
)
...
...
@@ -350,19 +359,22 @@ static int CDECL wrap_ldap_msgfree( void *msg )
return
ldap_msgfree
(
msg
);
}
static
char
*
CDECL
wrap_ldap_next_attribute
(
void
*
ld
,
void
*
entry
,
void
*
ber
)
static
int
CDECL
wrap_ldap_next_attribute
(
void
*
ld
,
void
*
entry
,
void
*
ber
,
char
**
ret
)
{
return
ldap_next_attribute
(
ld
,
entry
,
ber
);
*
ret
=
ldap_next_attribute
(
ld
,
entry
,
ber
);
return
*
ret
?
0
:
-
1
;
}
static
void
*
CDECL
wrap_ldap_next_entry
(
void
*
ld
,
void
*
entry
)
static
int
CDECL
wrap_ldap_next_entry
(
void
*
ld
,
void
*
entry
,
void
**
ret
)
{
return
ldap_next_entry
(
ld
,
entry
);
*
ret
=
ldap_next_entry
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
}
static
void
*
CDECL
wrap_ldap_next_reference
(
void
*
ld
,
void
*
entry
)
static
int
CDECL
wrap_ldap_next_reference
(
void
*
ld
,
void
*
entry
,
void
**
ret
)
{
return
ldap_next_reference
(
ld
,
entry
);
*
ret
=
ldap_next_reference
(
ld
,
entry
);
return
*
ret
?
0
:
-
1
;
}
static
int
CDECL
wrap_ldap_parse_extended_result
(
void
*
ld
,
void
*
result
,
char
**
retoid
,
struct
bervalU
**
retdata
,
int
free
)
...
...
dlls/wldap32/libldap.h
View file @
3cc3dd78
...
...
@@ -95,13 +95,13 @@ struct sasl_interactive_bind_id
struct
ldap_funcs
{
void
*
(
CDECL
*
fn_ber_alloc_t
)(
int
);
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
);
void
*
(
CDECL
*
fn_ber_init
)(
struct
bervalU
*
);
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
*
);
...
...
@@ -124,27 +124,27 @@ struct ldap_funcs
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
**
);
char
*
(
CDECL
*
fn_ldap_dn2ufn
)(
const
char
*
);
char
**
(
CDECL
*
fn_ldap_explode_dn
)(
const
char
*
,
int
);
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
**
);
char
*
(
CDECL
*
fn_ldap_get_dn
)(
void
*
,
void
*
);
int
(
CDECL
*
fn_ldap_get_dn
)(
void
*
,
void
*
,
char
*
*
);
int
(
CDECL
*
fn_ldap_get_option
)(
void
*
,
int
,
void
*
);
struct
bervalU
**
(
CDECL
*
fn_ldap_get_values_len
)(
void
*
,
void
*
,
const
char
*
);
int
(
CDECL
*
fn_ldap_get_values_len
)(
void
*
,
void
*
,
const
char
*
,
struct
bervalU
**
*
);
int
(
CDECL
*
fn_ldap_initialize
)(
void
**
,
const
char
*
);
char
*
(
CDECL
*
fn_ldap_first_attribute
)(
void
*
,
void
*
,
void
**
);
void
*
(
CDECL
*
fn_ldap_first_entry
)(
void
*
,
void
*
);
void
*
(
CDECL
*
fn_ldap_first_reference
)(
void
*
,
void
*
);
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
*
);
char
*
(
CDECL
*
fn_ldap_next_attribute
)(
void
*
,
void
*
,
void
*
);
void
*
(
CDECL
*
fn_ldap_next_entry
)(
void
*
,
void
*
);
void
*
(
CDECL
*
fn_ldap_next_reference
)(
void
*
,
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
);
...
...
dlls/wldap32/misc.c
View file @
3cc3dd78
...
...
@@ -299,7 +299,7 @@ WCHAR * CDECL ldap_first_attributeW( LDAP *ld, LDAPMessage *entry, BerElement **
if
(
!
ld
||
!
entry
)
return
NULL
;
retU
=
ldap_funcs
->
fn_ldap_first_attribute
(
CTX
(
ld
),
MSG
(
entry
),
&
ber
U
);
ldap_funcs
->
fn_ldap_first_attribute
(
CTX
(
ld
),
MSG
(
entry
),
&
berU
,
&
ret
U
);
if
(
retU
&&
(
ber
=
malloc
(
sizeof
(
*
ber
)
)))
{
BER
(
ber
)
=
(
char
*
)
berU
;
...
...
@@ -335,8 +335,7 @@ LDAPMessage * CDECL ldap_first_entry( LDAP *ld, LDAPMessage *res )
if
(
!
ld
||
!
res
)
return
NULL
;
msgU
=
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
MSG
(
res
)
);
if
(
msgU
)
if
(
!
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
MSG
(
res
),
&
msgU
))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
...
...
@@ -366,8 +365,7 @@ LDAPMessage * CDECL ldap_first_reference( LDAP *ld, LDAPMessage *res )
if
(
!
ld
)
return
NULL
;
msgU
=
ldap_funcs
->
fn_ldap_first_reference
(
CTX
(
ld
),
MSG
(
res
)
);
if
(
msgU
)
if
(
!
ldap_funcs
->
fn_ldap_first_reference
(
CTX
(
ld
),
MSG
(
res
),
&
msgU
))
{
assert
(
msgU
==
MSG
(
res
)
);
return
res
;
...
...
@@ -479,8 +477,7 @@ WCHAR * CDECL ldap_next_attributeW( LDAP *ld, LDAPMessage *entry, BerElement *pt
if
(
!
ld
||
!
entry
||
!
ptr
)
return
NULL
;
retU
=
ldap_funcs
->
fn_ldap_next_attribute
(
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
)
);
if
(
retU
)
if
(
!
ldap_funcs
->
fn_ldap_next_attribute
(
CTX
(
ld
),
MSG
(
entry
),
BER
(
ptr
),
&
retU
))
{
ret
=
strUtoW
(
retU
);
ldap_funcs
->
fn_ldap_memfree
(
retU
);
...
...
@@ -516,7 +513,7 @@ LDAPMessage * CDECL ldap_next_entry( LDAP *ld, LDAPMessage *entry )
if
(
entry
->
lm_next
)
return
entry
->
lm_next
;
msgU
=
ldap_funcs
->
fn_ldap_next_entry
(
CTX
(
ld
),
MSG
(
entry
)
);
ldap_funcs
->
fn_ldap_next_entry
(
CTX
(
ld
),
MSG
(
entry
),
&
msgU
);
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
@@ -553,7 +550,7 @@ LDAPMessage * CDECL ldap_next_reference( LDAP *ld, LDAPMessage *entry )
if
(
entry
->
lm_next
)
return
entry
->
lm_next
;
msgU
=
ldap_funcs
->
fn_ldap_next_reference
(
CTX
(
ld
),
MSG
(
entry
)
);
ldap_funcs
->
fn_ldap_next_reference
(
CTX
(
ld
),
MSG
(
entry
),
&
msgU
);
if
(
msgU
&&
(
msg
=
calloc
(
1
,
sizeof
(
*
msg
)
)))
{
MSG
(
msg
)
=
msgU
;
...
...
dlls/wldap32/option.c
View file @
3cc3dd78
...
...
@@ -377,11 +377,10 @@ static BOOL query_supported_server_ctrls( LDAP *ld )
attrs
,
FALSE
,
NULL
,
NULL
,
NULL
,
0
,
&
res
)
);
if
(
ret
!=
LDAP_SUCCESS
)
return
FALSE
;
entry
=
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
res
);
if
(
entry
)
if
(
!
ldap_funcs
->
fn_ldap_first_entry
(
CTX
(
ld
),
res
,
&
entry
))
{
ULONG
count
,
i
;
ctrls
=
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
entry
,
attrs
[
0
]
);
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
;
...
...
dlls/wldap32/value.c
View file @
3cc3dd78
...
...
@@ -197,7 +197,7 @@ WCHAR ** CDECL ldap_get_valuesW( LDAP *ld, LDAPMessage *entry, WCHAR *attr )
if
(
!
ld
||
!
entry
||
!
attr
||
!
(
attrU
=
strWtoU
(
attr
)))
return
NULL
;
if
(
(
bv
=
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
entry
),
attrU
)
))
if
(
!
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
entry
),
attrU
,
&
bv
))
{
retU
=
bv2str_array
(
bv
);
ret
=
strarrayUtoW
(
retU
);
...
...
@@ -259,7 +259,7 @@ struct berval ** CDECL ldap_get_values_lenW( LDAP *ld, LDAPMessage *message, WCH
if
(
!
ld
||
!
message
||
!
attr
||
!
(
attrU
=
strWtoU
(
attr
)))
return
NULL
;
if
(
(
retU
=
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
message
),
attrU
)
))
if
(
!
ldap_funcs
->
fn_ldap_get_values_len
(
CTX
(
ld
),
MSG
(
message
),
attrU
,
&
retU
))
{
ret
=
bvarrayUtoW
(
retU
);
bvarrayfreeU
(
retU
);
...
...
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