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
d8a2463a
Commit
d8a2463a
authored
Apr 15, 2021
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Move support for delete functions to the Unix library.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
82d69d8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
165 deletions
+68
-165
delete.c
dlls/wldap32/delete.c
+49
-165
libldap.c
dlls/wldap32/libldap.c
+15
-0
libldap.h
dlls/wldap32/libldap.h
+4
-0
No files found.
dlls/wldap32/delete.c
View file @
d8a2463a
...
...
@@ -18,50 +18,33 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#ifdef HAVE_LDAP_H
#include <ldap.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winldap_private.h"
#include "wldap32.h"
#include "wine/debug.h"
#include "winldap_private.h"
#ifdef HAVE_LDAP
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
#endif
/***********************************************************************
* ldap_deleteA (WLDAP32.@)
*
* See ldap_deleteW.
*/
ULONG
CDECL
ldap_deleteA
(
WLDAP32_LDAP
*
ld
,
PCHAR
dn
)
ULONG
CDECL
ldap_deleteA
(
WLDAP32_LDAP
*
ld
,
char
*
dn
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
;
WCHAR
*
dnW
=
NULL
;
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_a
(
dn
)
);
if
(
!
ld
)
return
~
0u
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
if
(
!
dnW
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
return
WLDAP32_LDAP_NO_MEMORY
;
ret
=
ldap_deleteW
(
ld
,
dnW
);
strfreeW
(
dnW
);
#endif
return
ret
;
}
...
...
@@ -83,33 +66,15 @@ ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn )
* the operation. Cancel the operation by calling ldap_abandon
* with the message ID.
*/
ULONG
CDECL
ldap_deleteW
(
WLDAP32_LDAP
*
ld
,
PWCHAR
dn
)
ULONG
CDECL
ldap_deleteW
(
WLDAP32_LDAP
*
ld
,
WCHAR
*
dn
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
;
int
msg
;
ULONG
ret
,
msg
;
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_w
(
dn
)
);
if
(
!
ld
)
return
~
0u
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
if
(
!
dnU
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
ret
=
ldap_delete_ext
(
ld
->
ld
,
dn
?
dnU
:
""
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0u
;
strfreeU
(
dnU
);
#endif
return
ret
;
ret
=
ldap_delete_extW
(
ld
,
dn
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
WLDAP32_LDAP_SUCCESS
)
return
msg
;
return
~
0u
;
}
/***********************************************************************
...
...
@@ -117,33 +82,20 @@ ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
*
* See ldap_delete_extW.
*/
ULONG
CDECL
ldap_delete_extA
(
WLDAP32_LDAP
*
ld
,
PCHAR
dn
,
PLDAPControlA
*
serverctrls
,
PLDAPControlA
*
clientctrls
,
ULONG
*
message
)
ULONG
CDECL
ldap_delete_extA
(
WLDAP32_LDAP
*
ld
,
char
*
dn
,
LDAPControlA
*
*
serverctrls
,
LDAPControlA
*
*
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
dnW
=
NULL
;
LDAPControlW
**
serverctrlsW
=
NULL
,
**
clientctrlsW
=
NULL
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
serverctrls
,
clientctrls
,
message
);
ret
=
WLDAP32_LDAP_NO_MEMORY
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
if
(
!
dnW
)
goto
exit
;
}
if
(
serverctrls
)
{
serverctrlsW
=
controlarrayAtoW
(
serverctrls
);
if
(
!
serverctrlsW
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsW
=
controlarrayAtoW
(
clientctrls
);
if
(
!
clientctrlsW
)
goto
exit
;
}
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsW
=
controlarrayAtoW
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsW
=
controlarrayAtoW
(
clientctrls
)))
goto
exit
;
ret
=
ldap_delete_extW
(
ld
,
dnW
,
serverctrlsW
,
clientctrlsW
,
message
);
...
...
@@ -151,8 +103,6 @@ exit:
strfreeW
(
dnW
);
controlarrayfreeW
(
serverctrlsW
);
controlarrayfreeW
(
clientctrlsW
);
#endif
return
ret
;
}
...
...
@@ -177,44 +127,27 @@ exit:
* the operation. The serverctrls and clientctrls parameters are
* optional and should be set to NULL if not used.
*/
ULONG
CDECL
ldap_delete_extW
(
WLDAP32_LDAP
*
ld
,
PWCHAR
dn
,
PLDAPControlW
*
serverctrls
,
PLDAPControlW
*
clientctrls
,
ULONG
*
message
)
ULONG
CDECL
ldap_delete_extW
(
WLDAP32_LDAP
*
ld
,
WCHAR
*
dn
,
LDAPControlW
*
*
serverctrls
,
LDAPControlW
*
*
clientctrls
,
ULONG
*
message
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
int
dummy
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
,
message
);
LDAPControlU
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
TRACE
(
"(%p, %s, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
,
message
)
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
if
(
!
dnU
)
goto
exit
;
}
if
(
serverctrls
)
{
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
if
(
!
serverctrlsU
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsU
=
controlarrayWtoU
(
clientctrls
);
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
map_error
(
ldap_delete_ext
(
ld
->
ld
,
dn
?
dnU
:
""
,
serverctrlsU
,
clientctrlsU
,
message
?
(
int
*
)
message
:
&
dummy
));
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
->
ldap_delete_ext
(
ld
->
ld
,
dnU
,
serverctrlsU
,
clientctrlsU
,
message
)
);
exit:
strfreeU
(
dnU
);
controlarrayfreeU
(
serverctrlsU
);
controlarrayfreeU
(
clientctrlsU
);
#endif
return
ret
;
}
...
...
@@ -223,31 +156,20 @@ exit:
*
* See ldap_delete_ext_sW.
*/
ULONG
CDECL
ldap_delete_ext_sA
(
WLDAP32_LDAP
*
ld
,
PCHAR
dn
,
PLDAPControlA
*
serverctrls
,
PLDAPControlA
*
clientctrls
)
ULONG
CDECL
ldap_delete_ext_sA
(
WLDAP32_LDAP
*
ld
,
char
*
dn
,
LDAPControlA
*
*
serverctrls
,
LDAPControlA
*
*
clientctrls
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
WCHAR
*
dnW
=
NULL
;
LDAPControlW
**
serverctrlsW
=
NULL
,
**
clientctrlsW
=
NULL
;
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
serverctrls
,
clientctrls
);
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
if
(
!
dnW
)
goto
exit
;
}
if
(
serverctrls
)
{
serverctrlsW
=
controlarrayAtoW
(
serverctrls
);
if
(
!
serverctrlsW
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsW
=
controlarrayAtoW
(
clientctrls
);
if
(
!
clientctrlsW
)
goto
exit
;
}
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsW
=
controlarrayAtoW
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsW
=
controlarrayAtoW
(
clientctrls
)))
goto
exit
;
ret
=
ldap_delete_ext_sW
(
ld
,
dnW
,
serverctrlsW
,
clientctrlsW
);
...
...
@@ -255,8 +177,6 @@ exit:
strfreeW
(
dnW
);
controlarrayfreeW
(
serverctrlsW
);
controlarrayfreeW
(
clientctrlsW
);
#endif
return
ret
;
}
...
...
@@ -279,67 +199,47 @@ exit:
* The serverctrls and clientctrls parameters are optional and
* should be set to NULL if not used.
*/
ULONG
CDECL
ldap_delete_ext_sW
(
WLDAP32_LDAP
*
ld
,
PWCHAR
dn
,
PLDAPControlW
*
serverctrls
,
PLDAPControlW
*
clientctrls
)
ULONG
CDECL
ldap_delete_ext_sW
(
WLDAP32_LDAP
*
ld
,
WCHAR
*
dn
,
LDAPControlW
*
*
serverctrls
,
LDAPControlW
*
*
clientctrls
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
=
WLDAP32_LDAP_NO_MEMORY
;
char
*
dnU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
LDAPControl
U
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
);
TRACE
(
"(%p, %s, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
if
(
!
dnU
)
goto
exit
;
}
if
(
serverctrls
)
{
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
if
(
!
serverctrlsU
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsU
=
controlarrayWtoU
(
clientctrls
);
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
map_error
(
ldap_delete_ext_s
(
ld
->
ld
,
dn
?
dnU
:
""
,
serverctrlsU
,
clientctrlsU
));
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
->
ldap_delete_ext_s
(
ld
->
ld
,
dnU
,
serverctrlsU
,
clientctrlsU
)
);
exit:
strfreeU
(
dnU
);
controlarrayfreeU
(
serverctrlsU
);
controlarrayfreeU
(
clientctrlsU
);
#endif
return
ret
;
}
/***********************************************************************
* ldap_delete_sA (WLDAP32.@)
*
* See ldap_delete_sW.
*/
ULONG
CDECL
ldap_delete_sA
(
WLDAP32_LDAP
*
ld
,
PCHAR
dn
)
ULONG
CDECL
ldap_delete_sA
(
WLDAP32_LDAP
*
ld
,
char
*
dn
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
ULONG
ret
;
WCHAR
*
dnW
=
NULL
;
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_a
(
dn
)
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
if
(
!
dnW
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
return
WLDAP32_LDAP_NO_MEMORY
;
ret
=
ldap_delete_sW
(
ld
,
dnW
);
strfreeW
(
dnW
);
#endif
return
ret
;
}
...
...
@@ -356,24 +256,8 @@ ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn )
* Success: LDAP_SUCCESS
* Failure: An LDAP error code.
*/
ULONG
CDECL
ldap_delete_sW
(
WLDAP32_LDAP
*
ld
,
PWCHAR
dn
)
ULONG
CDECL
ldap_delete_sW
(
WLDAP32_LDAP
*
ld
,
WCHAR
*
dn
)
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
;
TRACE
(
"(%p, %s)
\n
"
,
ld
,
debugstr_w
(
dn
)
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
if
(
!
dnU
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
ret
=
map_error
(
ldap_delete_ext_s
(
ld
->
ld
,
dn
?
dnU
:
""
,
NULL
,
NULL
));
strfreeU
(
dnU
);
#endif
return
ret
;
return
ldap_delete_ext_sW
(
ld
,
dn
,
NULL
,
NULL
);
}
dlls/wldap32/libldap.c
View file @
d8a2463a
...
...
@@ -339,6 +339,19 @@ int CDECL wrap_ldap_create_vlv_control( void *ld, LDAPVLVInfoU *info, LDAPContro
return
ldap_create_vlv_control
(
ld
,
(
LDAPVLVInfo
*
)
info
,
(
LDAPControl
**
)
control
);
}
int
CDECL
wrap_ldap_delete_ext
(
void
*
ld
,
const
char
*
dn
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
,
ULONG
*
msg
)
{
int
dummy
;
return
ldap_delete_ext
(
ld
,
dn
?
dn
:
""
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
,
msg
?
(
int
*
)
msg
:
&
dummy
);
}
int
CDECL
wrap_ldap_delete_ext_s
(
void
*
ld
,
const
char
*
dn
,
LDAPControlU
**
serverctrls
,
LDAPControlU
**
clientctrls
)
{
return
ldap_delete_ext_s
(
ld
,
dn
?
dn
:
""
,
(
LDAPControl
**
)
serverctrls
,
(
LDAPControl
**
)
clientctrls
);
}
void
CDECL
wrap_ldap_memfree
(
void
*
ptr
)
{
return
ldap_memfree
(
ptr
);
...
...
@@ -410,6 +423,8 @@ static const struct ldap_funcs funcs =
wrap_ldap_control_free
,
wrap_ldap_create_sort_control
,
wrap_ldap_create_vlv_control
,
wrap_ldap_delete_ext
,
wrap_ldap_delete_ext_s
,
wrap_ldap_memfree
,
wrap_ldap_sasl_bind
,
wrap_ldap_sasl_bind_s
,
...
...
dlls/wldap32/libldap.h
View file @
d8a2463a
...
...
@@ -101,6 +101,8 @@ extern int CDECL wrap_ldap_compare_ext_s(void *, const char *, const char *, str
extern
void
CDECL
wrap_ldap_control_free
(
LDAPControlU
*
)
DECLSPEC_HIDDEN
;
extern
int
CDECL
wrap_ldap_create_sort_control
(
void
*
,
LDAPSortKeyU
**
,
int
,
LDAPControlU
**
)
DECLSPEC_HIDDEN
;
extern
int
CDECL
wrap_ldap_create_vlv_control
(
void
*
,
LDAPVLVInfoU
*
,
LDAPControlU
**
)
DECLSPEC_HIDDEN
;
extern
int
CDECL
wrap_ldap_delete_ext
(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
)
DECLSPEC_HIDDEN
;
extern
int
CDECL
wrap_ldap_delete_ext_s
(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
wrap_ldap_memfree
(
void
*
)
DECLSPEC_HIDDEN
;
extern
int
CDECL
wrap_ldap_sasl_bind
(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
int
*
)
DECLSPEC_HIDDEN
;
...
...
@@ -136,6 +138,8 @@ struct ldap_funcs
void
(
CDECL
*
ldap_control_free
)(
LDAPControlU
*
);
int
(
CDECL
*
ldap_create_sort_control
)(
void
*
,
LDAPSortKeyU
**
,
int
,
LDAPControlU
**
);
int
(
CDECL
*
ldap_create_vlv_control
)(
void
*
,
LDAPVLVInfoU
*
,
LDAPControlU
**
);
int
(
CDECL
*
ldap_delete_ext
)(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
,
ULONG
*
);
int
(
CDECL
*
ldap_delete_ext_s
)(
void
*
,
const
char
*
,
LDAPControlU
**
,
LDAPControlU
**
);
void
(
CDECL
*
ldap_memfree
)(
void
*
);
int
(
CDECL
*
ldap_sasl_bind
)(
void
*
,
const
char
*
,
const
char
*
,
struct
bervalU
*
,
LDAPControlU
**
,
LDAPControlU
**
,
int
*
);
...
...
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