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
23 #include "wine/port.h"
24 #include "wine/debug.h"
35 #define LDAP_NOT_SUPPORTED 0x5c
38 #include "winldap_private.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
43 /***********************************************************************
44 * ldap_deleteA (WLDAP32.@)
48 ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn )
50 ULONG ret = LDAP_NOT_SUPPORTED;
54 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
60 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
63 ret = ldap_deleteW( ld, dnW );
70 /***********************************************************************
71 * ldap_deleteW (WLDAP32.@)
73 * Delete an entry from a directory tree (asynchronous operation).
76 * ld [I] Pointer to an LDAP context.
77 * dn [I] DN of the entry to delete.
80 * Success: Message ID of the add operation.
81 * Failure: An LDAP error code.
84 * Call ldap_result with the message ID to get the result of
85 * the operation. Cancel the operation by calling ldap_abandon
86 * with the message ID.
88 ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
90 ULONG ret = LDAP_NOT_SUPPORTED;
95 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
101 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
104 ret = ldap_delete_ext( ld, dn ? dnU : "", NULL, NULL, &msg );
106 if (ret == LDAP_SUCCESS)
117 /***********************************************************************
118 * ldap_delete_extA (WLDAP32.@)
120 * See ldap_delete_extW.
122 ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
123 PLDAPControlA *clientctrls, ULONG *message )
125 ULONG ret = LDAP_NOT_SUPPORTED;
128 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
130 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
131 clientctrls, message );
133 ret = WLDAP32_LDAP_NO_MEMORY;
135 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
142 serverctrlsW = controlarrayAtoW( serverctrls );
143 if (!serverctrlsW) goto exit;
146 clientctrlsW = controlarrayAtoW( clientctrls );
147 if (!clientctrlsW) goto exit;
150 ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message );
154 controlarrayfreeW( serverctrlsW );
155 controlarrayfreeW( clientctrlsW );
161 /***********************************************************************
162 * ldap_delete_extW (WLDAP32.@)
164 * Delete an entry from a directory tree (asynchronous operation).
167 * ld [I] Pointer to an LDAP context.
168 * dn [I] DN of the entry to delete.
169 * serverctrls [I] Array of LDAP server controls.
170 * clientctrls [I] Array of LDAP client controls.
171 * message [O] Message ID of the delete operation.
174 * Success: LDAP_SUCCESS
175 * Failure: An LDAP error code.
178 * Call ldap_result with the message ID to get the result of
179 * the operation. The serverctrls and clientctrls parameters are
180 * optional and should be set to NULL if not used.
182 ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
183 PLDAPControlW *clientctrls, ULONG *message )
185 ULONG ret = LDAP_NOT_SUPPORTED;
188 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
191 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
192 clientctrls, message );
194 ret = WLDAP32_LDAP_NO_MEMORY;
196 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
203 serverctrlsU = controlarrayWtoU( serverctrls );
204 if (!serverctrlsU) goto exit;
207 clientctrlsU = controlarrayWtoU( clientctrls );
208 if (!clientctrlsU) goto exit;
211 ret = ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
212 message ? (int *)message : &dummy );
216 controlarrayfreeU( serverctrlsU );
217 controlarrayfreeU( clientctrlsU );
223 /***********************************************************************
224 * ldap_delete_ext_sA (WLDAP32.@)
226 * See ldap_delete_ext_sW.
228 ULONG CDECL ldap_delete_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
229 PLDAPControlA *clientctrls )
231 ULONG ret = LDAP_NOT_SUPPORTED;
234 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
236 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
239 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
246 serverctrlsW = controlarrayAtoW( serverctrls );
247 if (!serverctrlsW) goto exit;
250 clientctrlsW = controlarrayAtoW( clientctrls );
251 if (!clientctrlsW) goto exit;
254 ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW );
258 controlarrayfreeW( serverctrlsW );
259 controlarrayfreeW( clientctrlsW );
265 /***********************************************************************
266 * ldap_delete_ext_sW (WLDAP32.@)
268 * Delete an entry from a directory tree (synchronous operation).
271 * ld [I] Pointer to an LDAP context.
272 * dn [I] DN of the entry to delete.
273 * serverctrls [I] Array of LDAP server controls.
274 * clientctrls [I] Array of LDAP client controls.
277 * Success: LDAP_SUCCESS
278 * Failure: An LDAP error code.
281 * The serverctrls and clientctrls parameters are optional and
282 * should be set to NULL if not used.
284 ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
285 PLDAPControlW *clientctrls )
287 ULONG ret = LDAP_NOT_SUPPORTED;
290 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
292 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
295 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
302 serverctrlsU = controlarrayWtoU( serverctrls );
303 if (!serverctrlsU) goto exit;
306 clientctrlsU = controlarrayWtoU( clientctrls );
307 if (!clientctrlsU) goto exit;
310 ret = ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU );
314 controlarrayfreeU( serverctrlsU );
315 controlarrayfreeU( clientctrlsU );
321 /***********************************************************************
322 * ldap_delete_sA (WLDAP32.@)
324 * See ldap_delete_sW.
326 ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn )
328 ULONG ret = LDAP_NOT_SUPPORTED;
332 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
334 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
338 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
341 ret = ldap_delete_sW( ld, dnW );
348 /***********************************************************************
349 * ldap_delete_sW (WLDAP32.@)
351 * Delete an entry from a directory tree (synchronous operation).
354 * ld [I] Pointer to an LDAP context.
355 * dn [I] DN of the entry to delete.
358 * Success: LDAP_SUCCESS
359 * Failure: An LDAP error code.
361 ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
363 ULONG ret = LDAP_NOT_SUPPORTED;
367 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
369 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
373 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
376 ret = ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL );