Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6c4011e7
Commit
6c4011e7
authored
Nov 18, 2005
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using deprecated openldap functions.
Correct some return values.
parent
ae6239d5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
33 deletions
+126
-33
delete.c
dlls/wldap32/delete.c
+9
-2
dn.c
dlls/wldap32/dn.c
+1
-1
error.c
dlls/wldap32/error.c
+9
-2
misc.c
dlls/wldap32/misc.c
+3
-3
modify.c
dlls/wldap32/modify.c
+9
-2
modrdn.c
dlls/wldap32/modrdn.c
+16
-4
option.c
dlls/wldap32/option.c
+2
-2
search.c
dlls/wldap32/search.c
+12
-4
value.c
dlls/wldap32/value.c
+65
-13
No files found.
dlls/wldap32/delete.c
View file @
6c4011e7
...
...
@@ -67,6 +67,7 @@ ULONG ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
;
int
msg
;
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_w
(
dn
)
);
...
...
@@ -77,7 +78,13 @@ ULONG ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
if
(
!
dnU
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
ret
=
ldap_delete
(
ld
,
dn
?
dnU
:
""
);
ret
=
ldap_delete_ext
(
ld
,
dn
?
dnU
:
""
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
strfreeU
(
dnU
);
#endif
...
...
@@ -275,7 +282,7 @@ ULONG ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
if
(
!
dnU
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
ret
=
ldap_delete_
s
(
ld
,
dn
?
dnU
:
""
);
ret
=
ldap_delete_
ext_s
(
ld
,
dn
?
dnU
:
""
,
NULL
,
NULL
);
strfreeU
(
dnU
);
#endif
...
...
dlls/wldap32/dn.c
View file @
6c4011e7
...
...
@@ -118,7 +118,7 @@ PWCHAR *ldap_explode_dnW( PWCHAR dn, ULONG notypes )
ret
=
strarrayUtoW
(
retU
);
strfreeU
(
dnU
);
ldap_
value_free
(
retU
);
ldap_
memvfree
(
(
void
**
)
retU
);
#endif
return
ret
;
...
...
dlls/wldap32/error.c
View file @
6c4011e7
...
...
@@ -84,11 +84,18 @@ ULONG WLDAP32_ldap_result2error( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *res, ULO
{
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
int
error
;
TRACE
(
"(%p, %p, 0x%08lx)
\n
"
,
ld
,
res
,
free
);
if
(
!
ld
)
return
~
0UL
;
ret
=
ldap_result2error
(
ld
,
res
,
free
);
if
(
!
ld
||
!
res
)
return
~
0UL
;
ret
=
ldap_parse_result
(
ld
,
res
,
&
error
,
NULL
,
NULL
,
NULL
,
NULL
,
free
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
error
;
else
ret
=
~
0UL
;
#endif
return
ret
;
...
...
dlls/wldap32/misc.c
View file @
6c4011e7
...
...
@@ -50,7 +50,7 @@ ULONG WLDAP32_ldap_abandon( WLDAP32_LDAP *ld, ULONG msgid )
TRACE
(
"(%p, 0x%08lx)
\n
"
,
ld
,
msgid
);
if
(
!
ld
)
return
~
0UL
;
ret
=
ldap_abandon
(
ld
,
msgid
);
ret
=
ldap_abandon
_ext
(
ld
,
msgid
,
NULL
,
NULL
);
#endif
return
ret
;
...
...
@@ -81,7 +81,7 @@ ULONG ldap_check_filterW( WLDAP32_LDAP *ld, PWCHAR filter )
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_w
(
filter
)
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
return
LDAP_SUCCESS
;
return
LDAP_SUCCESS
;
/* FIXME: do some checks */
}
ULONG
ldap_cleanup
(
HANDLE
instance
)
...
...
@@ -357,7 +357,7 @@ ULONG WLDAP32_ldap_result( WLDAP32_LDAP *ld, ULONG msgid, ULONG all,
TRACE
(
"(%p, 0x%08lx, 0x%08lx, %p, %p)
\n
"
,
ld
,
msgid
,
all
,
timeout
,
res
);
if
(
!
ld
||
!
res
)
return
~
0UL
;
if
(
!
ld
||
!
res
||
msgid
==
~
0UL
)
return
~
0UL
;
ret
=
ldap_result
(
ld
,
msgid
,
all
,
(
struct
timeval
*
)
timeout
,
res
);
#endif
...
...
dlls/wldap32/modify.c
View file @
6c4011e7
...
...
@@ -79,6 +79,7 @@ ULONG ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
;
LDAPMod
**
modsU
=
NULL
;
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -95,7 +96,13 @@ ULONG ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
if
(
!
modsU
)
goto
exit
;
}
ret
=
ldap_modify
(
ld
,
dn
?
dnU
:
""
,
mods
?
modsU
:
nullmods
);
ret
=
ldap_modify_ext
(
ld
,
dn
?
dnU
:
""
,
mods
?
modsU
:
nullmods
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -342,7 +349,7 @@ ULONG ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
if
(
!
modsU
)
goto
exit
;
}
ret
=
ldap_modify_
s
(
ld
,
dn
?
dnU
:
""
,
mods
?
modsU
:
nullmods
);
ret
=
ldap_modify_
ext_s
(
ld
,
dn
?
dnU
:
""
,
mods
?
modsU
:
nullmods
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
dlls/wldap32/modrdn.c
View file @
6c4011e7
...
...
@@ -75,6 +75,7 @@ ULONG ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
newdnU
=
NULL
;
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -90,7 +91,12 @@ ULONG ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
newdnU
=
strWtoU
(
newdn
);
if
(
!
newdnU
)
goto
exit
;
ret
=
ldap_modrdn
(
ld
,
dn
?
dnU
:
""
,
newdnU
);
ret
=
ldap_rename
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
NULL
,
1
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -135,6 +141,7 @@ ULONG ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
newdnU
=
NULL
;
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -150,7 +157,12 @@ ULONG ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
newdnU
=
strWtoU
(
newdn
);
if
(
!
newdnU
)
goto
exit
;
ret
=
ldap_modrdn2
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
delete
);
ret
=
ldap_rename
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -210,7 +222,7 @@ ULONG ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
newdnU
=
strWtoU
(
newdn
);
if
(
!
newdnU
)
goto
exit
;
ret
=
ldap_
modrdn2_s
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
delete
);
ret
=
ldap_
rename_s
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
NULL
,
delete
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
@@ -270,7 +282,7 @@ ULONG ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
newdnU
=
strWtoU
(
newdn
);
if
(
!
newdnU
)
goto
exit
;
ret
=
ldap_
modrdn_s
(
ld
,
dn
?
dnU
:
""
,
newdnU
);
ret
=
ldap_
rename_s
(
ld
,
dn
?
dnU
:
""
,
newdnU
,
NULL
,
1
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
dlls/wldap32/option.c
View file @
6c4011e7
...
...
@@ -217,13 +217,13 @@ ULONG ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value )
infoW
->
ldapai_vendor_name
=
strUtoW
(
infoU
.
ldapai_vendor_name
);
if
(
!
infoW
->
ldapai_vendor_name
)
{
ldap_
value_free
(
infoU
.
ldapai_extensions
);
ldap_
memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
return
WLDAP32_LDAP_NO_MEMORY
;
}
}
infoW
->
ldapai_vendor_version
=
infoU
.
ldapai_vendor_version
;
ldap_
value_free
(
infoU
.
ldapai_extensions
);
ldap_
memvfree
(
(
void
**
)
infoU
.
ldapai_extensions
);
ldap_memfree
(
infoU
.
ldapai_vendor_name
);
return
ret
;
}
...
...
dlls/wldap32/search.c
View file @
6c4011e7
...
...
@@ -85,6 +85,7 @@ ULONG ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
baseU
=
NULL
,
*
filterU
=
NULL
,
**
attrsU
=
NULL
;
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -106,7 +107,13 @@ ULONG ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
if
(
!
attrsU
)
goto
exit
;
}
ret
=
ldap_search
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
);
ret
=
ldap_search_ext
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
NULL
,
NULL
,
NULL
,
0
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
baseU
);
...
...
@@ -395,7 +402,8 @@ ULONG ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
if
(
!
attrsU
)
goto
exit
;
}
ret
=
ldap_search_s
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
res
);
ret
=
ldap_search_ext_s
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
NULL
,
NULL
,
NULL
,
0
,
res
);
exit:
strfreeU
(
baseU
);
...
...
@@ -476,8 +484,8 @@ ULONG ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
if
(
!
attrsU
)
goto
exit
;
}
ret
=
ldap_search_
st
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
(
struct
timeval
*
)
timeout
,
res
);
ret
=
ldap_search_
ext_s
(
ld
,
baseU
,
scope
,
filterU
,
attrsU
,
attrsonly
,
NULL
,
NULL
,
(
struct
timeval
*
)
timeout
,
0
,
res
);
exit:
strfreeU
(
baseU
);
...
...
dlls/wldap32/value.c
View file @
6c4011e7
...
...
@@ -61,10 +61,10 @@ ULONG ldap_count_valuesA( PCHAR *vals )
TRACE
(
"(%p)
\n
"
,
vals
);
if
(
vals
)
{
valsW
=
strarrayAtoW
(
vals
);
if
(
!
valsW
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
if
(
!
vals
)
return
0
;
valsW
=
strarrayAtoW
(
vals
)
;
if
(
!
valsW
)
return
WLDAP32_LDAP_NO_MEMORY
;
ret
=
ldap_count_valuesW
(
valsW
);
strarrayfreeW
(
valsW
);
...
...
@@ -77,17 +77,18 @@ ULONG ldap_count_valuesW( PWCHAR *vals )
{
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
**
valsU
=
NULL
;
WCHAR
**
p
=
vals
;
TRACE
(
"(%p)
\n
"
,
vals
);
if
(
vals
)
{
valsU
=
strarrayWtoU
(
vals
);
if
(
!
valsU
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
if
(
!
vals
)
return
0
;
ret
=
ldap_count_values
(
valsU
);
strarrayfreeU
(
valsU
);
ret
=
0
;
while
(
*
p
)
{
ret
++
;
p
++
;
}
#endif
return
ret
;
...
...
@@ -116,11 +117,59 @@ PCHAR *ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PCHAR att
return
ret
;
}
static
char
*
bv2str
(
struct
berval
*
bv
)
{
char
*
str
=
NULL
;
unsigned
int
len
=
bv
->
bv_len
;
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
if
(
str
)
{
memcpy
(
str
,
bv
->
bv_val
,
len
);
str
[
len
]
=
'\0'
;
}
return
str
;
}
static
char
**
bv2str_array
(
struct
berval
**
bv
)
{
unsigned
int
len
=
0
,
i
=
0
;
struct
berval
**
p
=
bv
;
char
**
str
;
while
(
*
p
)
{
len
++
;
p
++
;
}
str
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
char
*
)
);
if
(
!
str
)
return
NULL
;
p
=
bv
;
while
(
*
p
)
{
str
[
i
]
=
bv2str
(
*
p
);
if
(
!
str
[
i
])
{
for
(
--
i
;
i
>=
0
;
i
--
)
HeapFree
(
GetProcessHeap
(),
0
,
str
[
i
]
);
HeapFree
(
GetProcessHeap
(),
0
,
str
);
return
NULL
;
}
i
++
;
p
++
;
}
str
[
i
]
=
NULL
;
return
str
;
}
PWCHAR
*
ldap_get_valuesW
(
WLDAP32_LDAP
*
ld
,
WLDAP32_LDAPMessage
*
entry
,
PWCHAR
attr
)
{
PWCHAR
*
ret
=
NULL
;
#ifdef HAVE_LDAP
char
*
attrU
=
NULL
,
**
retU
;
struct
berval
**
bv
;
TRACE
(
"(%p, %p, %s)
\n
"
,
ld
,
entry
,
debugstr_w
(
attr
)
);
...
...
@@ -129,10 +178,13 @@ PWCHAR *ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PWCHAR a
attrU
=
strWtoU
(
attr
);
if
(
!
attrU
)
return
NULL
;
retU
=
ldap_get_values
(
ld
,
entry
,
attrU
);
bv
=
ldap_get_values_len
(
ld
,
entry
,
attrU
);
retU
=
bv2str_array
(
bv
);
ret
=
strarrayUtoW
(
retU
);
ldap_value_free
(
retU
);
ldap_value_free_len
(
bv
);
strarrayfreeU
(
retU
);
strfreeU
(
attrU
);
#endif
...
...
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