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
22 #include "wine/port.h"
33 #include "winldap_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
39 /***********************************************************************
40 * ldap_deleteA (WLDAP32.@)
44 ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn )
46 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
50 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
56 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
59 ret = ldap_deleteW( ld, dnW );
66 /***********************************************************************
67 * ldap_deleteW (WLDAP32.@)
69 * Delete an entry from a directory tree (asynchronous operation).
72 * ld [I] Pointer to an LDAP context.
73 * dn [I] DN of the entry to delete.
76 * Success: Message ID of the add operation.
77 * Failure: An LDAP error code.
80 * Call ldap_result with the message ID to get the result of
81 * the operation. Cancel the operation by calling ldap_abandon
82 * with the message ID.
84 ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
86 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
91 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
97 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
100 ret = ldap_delete_ext( ld, dn ? dnU : "", NULL, NULL, &msg );
102 if (ret == LDAP_SUCCESS)
113 /***********************************************************************
114 * ldap_delete_extA (WLDAP32.@)
116 * See ldap_delete_extW.
118 ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
119 PLDAPControlA *clientctrls, ULONG *message )
121 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
124 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
126 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
127 clientctrls, message );
129 ret = WLDAP32_LDAP_NO_MEMORY;
131 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
138 serverctrlsW = controlarrayAtoW( serverctrls );
139 if (!serverctrlsW) goto exit;
142 clientctrlsW = controlarrayAtoW( clientctrls );
143 if (!clientctrlsW) goto exit;
146 ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message );
150 controlarrayfreeW( serverctrlsW );
151 controlarrayfreeW( clientctrlsW );
157 /***********************************************************************
158 * ldap_delete_extW (WLDAP32.@)
160 * Delete an entry from a directory tree (asynchronous operation).
163 * ld [I] Pointer to an LDAP context.
164 * dn [I] DN of the entry to delete.
165 * serverctrls [I] Array of LDAP server controls.
166 * clientctrls [I] Array of LDAP client controls.
167 * message [O] Message ID of the delete operation.
170 * Success: LDAP_SUCCESS
171 * Failure: An LDAP error code.
174 * Call ldap_result with the message ID to get the result of
175 * the operation. The serverctrls and clientctrls parameters are
176 * optional and should be set to NULL if not used.
178 ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
179 PLDAPControlW *clientctrls, ULONG *message )
181 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
184 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
187 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
188 clientctrls, message );
190 ret = WLDAP32_LDAP_NO_MEMORY;
192 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
199 serverctrlsU = controlarrayWtoU( serverctrls );
200 if (!serverctrlsU) goto exit;
203 clientctrlsU = controlarrayWtoU( clientctrls );
204 if (!clientctrlsU) goto exit;
207 ret = map_error( ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
208 message ? (int *)message : &dummy ));
212 controlarrayfreeU( serverctrlsU );
213 controlarrayfreeU( clientctrlsU );
219 /***********************************************************************
220 * ldap_delete_ext_sA (WLDAP32.@)
222 * See ldap_delete_ext_sW.
224 ULONG CDECL ldap_delete_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
225 PLDAPControlA *clientctrls )
227 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
230 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
232 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
235 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
242 serverctrlsW = controlarrayAtoW( serverctrls );
243 if (!serverctrlsW) goto exit;
246 clientctrlsW = controlarrayAtoW( clientctrls );
247 if (!clientctrlsW) goto exit;
250 ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW );
254 controlarrayfreeW( serverctrlsW );
255 controlarrayfreeW( clientctrlsW );
261 /***********************************************************************
262 * ldap_delete_ext_sW (WLDAP32.@)
264 * Delete an entry from a directory tree (synchronous operation).
267 * ld [I] Pointer to an LDAP context.
268 * dn [I] DN of the entry to delete.
269 * serverctrls [I] Array of LDAP server controls.
270 * clientctrls [I] Array of LDAP client controls.
273 * Success: LDAP_SUCCESS
274 * Failure: An LDAP error code.
277 * The serverctrls and clientctrls parameters are optional and
278 * should be set to NULL if not used.
280 ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
281 PLDAPControlW *clientctrls )
283 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
286 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
288 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
291 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
298 serverctrlsU = controlarrayWtoU( serverctrls );
299 if (!serverctrlsU) goto exit;
302 clientctrlsU = controlarrayWtoU( clientctrls );
303 if (!clientctrlsU) goto exit;
306 ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU ));
310 controlarrayfreeU( serverctrlsU );
311 controlarrayfreeU( clientctrlsU );
317 /***********************************************************************
318 * ldap_delete_sA (WLDAP32.@)
320 * See ldap_delete_sW.
322 ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn )
324 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
328 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
330 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
334 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
337 ret = ldap_delete_sW( ld, dnW );
344 /***********************************************************************
345 * ldap_delete_sW (WLDAP32.@)
347 * Delete an entry from a directory tree (synchronous operation).
350 * ld [I] Pointer to an LDAP context.
351 * dn [I] DN of the entry to delete.
354 * Success: LDAP_SUCCESS
355 * Failure: An LDAP error code.
357 ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
359 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
363 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
365 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
369 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
372 ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL ));