2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
28 #include "winldap_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wldap32
);
32 /***********************************************************************
33 * ldap_deleteA (WLDAP32.@)
37 ULONG CDECL
ldap_deleteA( LDAP
*ld
, char *dn
)
42 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
45 if (dn
&& !(dnW
= strAtoW( dn
))) return LDAP_NO_MEMORY
;
47 ret
= ldap_deleteW( ld
, dnW
);
52 /***********************************************************************
53 * ldap_deleteW (WLDAP32.@)
55 * Delete an entry from a directory tree (asynchronous operation).
58 * ld [I] Pointer to an LDAP context.
59 * dn [I] DN of the entry to delete.
62 * Success: Message ID of the add operation.
63 * Failure: An LDAP error code.
66 * Call ldap_result with the message ID to get the result of
67 * the operation. Cancel the operation by calling ldap_abandon
68 * with the message ID.
70 ULONG CDECL
ldap_deleteW( LDAP
*ld
, WCHAR
*dn
)
74 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
76 ret
= ldap_delete_extW( ld
, dn
, NULL
, NULL
, &msg
);
77 if (ret
== LDAP_SUCCESS
) return msg
;
81 /***********************************************************************
82 * ldap_delete_extA (WLDAP32.@)
84 * See ldap_delete_extW.
86 ULONG CDECL
ldap_delete_extA( LDAP
*ld
, char *dn
, LDAPControlA
**serverctrls
, LDAPControlA
**clientctrls
,
89 ULONG ret
= LDAP_NO_MEMORY
;
91 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
93 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
, clientctrls
, message
);
95 if (!ld
) return LDAP_PARAM_ERROR
;
97 if (dn
&& !(dnW
= strAtoW( dn
))) goto exit
;
98 if (serverctrls
&& !(serverctrlsW
= controlarrayAtoW( serverctrls
))) goto exit
;
99 if (clientctrls
&& !(clientctrlsW
= controlarrayAtoW( clientctrls
))) goto exit
;
101 ret
= ldap_delete_extW( ld
, dnW
, serverctrlsW
, clientctrlsW
, message
);
105 controlarrayfreeW( serverctrlsW
);
106 controlarrayfreeW( clientctrlsW
);
110 /***********************************************************************
111 * ldap_delete_extW (WLDAP32.@)
113 * Delete an entry from a directory tree (asynchronous operation).
116 * ld [I] Pointer to an LDAP context.
117 * dn [I] DN of the entry to delete.
118 * serverctrls [I] Array of LDAP server controls.
119 * clientctrls [I] Array of LDAP client controls.
120 * message [O] Message ID of the delete operation.
123 * Success: LDAP_SUCCESS
124 * Failure: An LDAP error code.
127 * Call ldap_result with the message ID to get the result of
128 * the operation. The serverctrls and clientctrls parameters are
129 * optional and should be set to NULL if not used.
131 ULONG CDECL
ldap_delete_extW( LDAP
*ld
, WCHAR
*dn
, LDAPControlW
**serverctrls
, LDAPControlW
**clientctrls
,
134 ULONG ret
= LDAP_NO_MEMORY
;
136 LDAPControlU
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
138 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
, clientctrls
, message
);
140 if (!ld
) return LDAP_PARAM_ERROR
;
142 if (dn
&& !(dnU
= strWtoU( dn
))) goto exit
;
143 if (serverctrls
&& !(serverctrlsU
= controlarrayWtoU( serverctrls
))) goto exit
;
144 if (clientctrls
&& !(clientctrlsU
= controlarrayWtoU( clientctrls
))) goto exit
;
146 ret
= map_error( ldap_funcs
->fn_ldap_delete_ext( CTX(ld
), dnU
, serverctrlsU
, clientctrlsU
, message
) );
150 controlarrayfreeU( serverctrlsU
);
151 controlarrayfreeU( clientctrlsU
);
155 /***********************************************************************
156 * ldap_delete_ext_sA (WLDAP32.@)
158 * See ldap_delete_ext_sW.
160 ULONG CDECL
ldap_delete_ext_sA( LDAP
*ld
, char *dn
, LDAPControlA
**serverctrls
, LDAPControlA
**clientctrls
)
162 ULONG ret
= LDAP_NO_MEMORY
;
164 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
166 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
, clientctrls
);
168 if (!ld
) return LDAP_PARAM_ERROR
;
170 if (dn
&& !(dnW
= strAtoW( dn
))) goto exit
;
171 if (serverctrls
&& !(serverctrlsW
= controlarrayAtoW( serverctrls
))) goto exit
;
172 if (clientctrls
&& !(clientctrlsW
= controlarrayAtoW( clientctrls
))) goto exit
;
174 ret
= ldap_delete_ext_sW( ld
, dnW
, serverctrlsW
, clientctrlsW
);
178 controlarrayfreeW( serverctrlsW
);
179 controlarrayfreeW( clientctrlsW
);
183 /***********************************************************************
184 * ldap_delete_ext_sW (WLDAP32.@)
186 * Delete an entry from a directory tree (synchronous operation).
189 * ld [I] Pointer to an LDAP context.
190 * dn [I] DN of the entry to delete.
191 * serverctrls [I] Array of LDAP server controls.
192 * clientctrls [I] Array of LDAP client controls.
195 * Success: LDAP_SUCCESS
196 * Failure: An LDAP error code.
199 * The serverctrls and clientctrls parameters are optional and
200 * should be set to NULL if not used.
202 ULONG CDECL
ldap_delete_ext_sW( LDAP
*ld
, WCHAR
*dn
, LDAPControlW
**serverctrls
, LDAPControlW
**clientctrls
)
204 ULONG ret
= LDAP_NO_MEMORY
;
206 LDAPControlU
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
208 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
, clientctrls
);
210 if (!ld
) return LDAP_PARAM_ERROR
;
212 if (dn
&& !(dnU
= strWtoU( dn
))) goto exit
;
213 if (serverctrls
&& !(serverctrlsU
= controlarrayWtoU( serverctrls
))) goto exit
;
214 if (clientctrls
&& !(clientctrlsU
= controlarrayWtoU( clientctrls
))) goto exit
;
216 ret
= map_error( ldap_funcs
->fn_ldap_delete_ext_s( CTX(ld
), dnU
, serverctrlsU
, clientctrlsU
) );
220 controlarrayfreeU( serverctrlsU
);
221 controlarrayfreeU( clientctrlsU
);
225 /***********************************************************************
226 * ldap_delete_sA (WLDAP32.@)
228 * See ldap_delete_sW.
230 ULONG CDECL
ldap_delete_sA( LDAP
*ld
, char *dn
)
235 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
237 if (!ld
) return LDAP_PARAM_ERROR
;
238 if (dn
&& !(dnW
= strAtoW( dn
))) return LDAP_NO_MEMORY
;
240 ret
= ldap_delete_sW( ld
, dnW
);
245 /***********************************************************************
246 * ldap_delete_sW (WLDAP32.@)
248 * Delete an entry from a directory tree (synchronous operation).
251 * ld [I] Pointer to an LDAP context.
252 * dn [I] DN of the entry to delete.
255 * Success: LDAP_SUCCESS
256 * Failure: An LDAP error code.
258 ULONG CDECL
ldap_delete_sW( LDAP
*ld
, WCHAR
*dn
)
260 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
261 return ldap_delete_ext_sW( ld
, dn
, NULL
, NULL
);