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"
36 #include "winldap_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(wldap32
);
41 /***********************************************************************
42 * ldap_deleteA (WLDAP32.@)
46 ULONG CDECL
ldap_deleteA( WLDAP32_LDAP
*ld
, PCHAR dn
)
48 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
52 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
58 if (!dnW
) return WLDAP32_LDAP_NO_MEMORY
;
61 ret
= ldap_deleteW( ld
, dnW
);
68 /***********************************************************************
69 * ldap_deleteW (WLDAP32.@)
71 * Delete an entry from a directory tree (asynchronous operation).
74 * ld [I] Pointer to an LDAP context.
75 * dn [I] DN of the entry to delete.
78 * Success: Message ID of the add operation.
79 * Failure: An LDAP error code.
82 * Call ldap_result with the message ID to get the result of
83 * the operation. Cancel the operation by calling ldap_abandon
84 * with the message ID.
86 ULONG CDECL
ldap_deleteW( WLDAP32_LDAP
*ld
, PWCHAR dn
)
88 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
93 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
99 if (!dnU
) return WLDAP32_LDAP_NO_MEMORY
;
102 ret
= ldap_delete_ext( ld
, dn
? dnU
: "", NULL
, NULL
, &msg
);
104 if (ret
== LDAP_SUCCESS
)
115 /***********************************************************************
116 * ldap_delete_extA (WLDAP32.@)
118 * See ldap_delete_extW.
120 ULONG CDECL
ldap_delete_extA( WLDAP32_LDAP
*ld
, PCHAR dn
, PLDAPControlA
*serverctrls
,
121 PLDAPControlA
*clientctrls
, ULONG
*message
)
123 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
126 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
128 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
,
129 clientctrls
, message
);
131 ret
= WLDAP32_LDAP_NO_MEMORY
;
133 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
140 serverctrlsW
= controlarrayAtoW( serverctrls
);
141 if (!serverctrlsW
) goto exit
;
144 clientctrlsW
= controlarrayAtoW( clientctrls
);
145 if (!clientctrlsW
) goto exit
;
148 ret
= ldap_delete_extW( ld
, dnW
, serverctrlsW
, clientctrlsW
, message
);
152 controlarrayfreeW( serverctrlsW
);
153 controlarrayfreeW( clientctrlsW
);
159 /***********************************************************************
160 * ldap_delete_extW (WLDAP32.@)
162 * Delete an entry from a directory tree (asynchronous operation).
165 * ld [I] Pointer to an LDAP context.
166 * dn [I] DN of the entry to delete.
167 * serverctrls [I] Array of LDAP server controls.
168 * clientctrls [I] Array of LDAP client controls.
169 * message [O] Message ID of the delete operation.
172 * Success: LDAP_SUCCESS
173 * Failure: An LDAP error code.
176 * Call ldap_result with the message ID to get the result of
177 * the operation. The serverctrls and clientctrls parameters are
178 * optional and should be set to NULL if not used.
180 ULONG CDECL
ldap_delete_extW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PLDAPControlW
*serverctrls
,
181 PLDAPControlW
*clientctrls
, ULONG
*message
)
183 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
186 LDAPControl
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
189 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
,
190 clientctrls
, message
);
192 ret
= WLDAP32_LDAP_NO_MEMORY
;
194 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
201 serverctrlsU
= controlarrayWtoU( serverctrls
);
202 if (!serverctrlsU
) goto exit
;
205 clientctrlsU
= controlarrayWtoU( clientctrls
);
206 if (!clientctrlsU
) goto exit
;
209 ret
= ldap_delete_ext( ld
, dn
? dnU
: "", serverctrlsU
, clientctrlsU
,
210 message
? (int *)message
: &dummy
);
214 controlarrayfreeU( serverctrlsU
);
215 controlarrayfreeU( clientctrlsU
);
221 /***********************************************************************
222 * ldap_delete_ext_sA (WLDAP32.@)
224 * See ldap_delete_ext_sW.
226 ULONG CDECL
ldap_delete_ext_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PLDAPControlA
*serverctrls
,
227 PLDAPControlA
*clientctrls
)
229 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
232 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
234 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
,
237 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
244 serverctrlsW
= controlarrayAtoW( serverctrls
);
245 if (!serverctrlsW
) goto exit
;
248 clientctrlsW
= controlarrayAtoW( clientctrls
);
249 if (!clientctrlsW
) goto exit
;
252 ret
= ldap_delete_ext_sW( ld
, dnW
, serverctrlsW
, clientctrlsW
);
256 controlarrayfreeW( serverctrlsW
);
257 controlarrayfreeW( clientctrlsW
);
263 /***********************************************************************
264 * ldap_delete_ext_sW (WLDAP32.@)
266 * Delete an entry from a directory tree (synchronous operation).
269 * ld [I] Pointer to an LDAP context.
270 * dn [I] DN of the entry to delete.
271 * serverctrls [I] Array of LDAP server controls.
272 * clientctrls [I] Array of LDAP client controls.
275 * Success: LDAP_SUCCESS
276 * Failure: An LDAP error code.
279 * The serverctrls and clientctrls parameters are optional and
280 * should be set to NULL if not used.
282 ULONG CDECL
ldap_delete_ext_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PLDAPControlW
*serverctrls
,
283 PLDAPControlW
*clientctrls
)
285 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
288 LDAPControl
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
290 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
,
293 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
300 serverctrlsU
= controlarrayWtoU( serverctrls
);
301 if (!serverctrlsU
) goto exit
;
304 clientctrlsU
= controlarrayWtoU( clientctrls
);
305 if (!clientctrlsU
) goto exit
;
308 ret
= ldap_delete_ext_s( ld
, dn
? dnU
: "", serverctrlsU
, clientctrlsU
);
312 controlarrayfreeU( serverctrlsU
);
313 controlarrayfreeU( clientctrlsU
);
319 /***********************************************************************
320 * ldap_delete_sA (WLDAP32.@)
322 * See ldap_delete_sW.
324 ULONG CDECL
ldap_delete_sA( WLDAP32_LDAP
*ld
, PCHAR dn
)
326 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
330 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
332 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
336 if (!dnW
) return WLDAP32_LDAP_NO_MEMORY
;
339 ret
= ldap_delete_sW( ld
, dnW
);
346 /***********************************************************************
347 * ldap_delete_sW (WLDAP32.@)
349 * Delete an entry from a directory tree (synchronous operation).
352 * ld [I] Pointer to an LDAP context.
353 * dn [I] DN of the entry to delete.
356 * Success: LDAP_SUCCESS
357 * Failure: An LDAP error code.
359 ULONG CDECL
ldap_delete_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
)
361 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
365 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
367 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
371 if (!dnU
) return WLDAP32_LDAP_NO_MEMORY
;
374 ret
= ldap_delete_ext_s( ld
, dn
? dnU
: "", NULL
, NULL
);