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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 ULONG ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn )
45 ULONG ret = LDAP_NOT_SUPPORTED;
49 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
55 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
58 ret = ldap_deleteW( ld, dnW );
65 ULONG ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn )
67 ULONG ret = LDAP_NOT_SUPPORTED;
71 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
77 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
80 ret = ldap_delete( ld, dn ? dnU : "" );
87 ULONG ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
88 PLDAPControlA *clientctrls, ULONG *message )
90 ULONG ret = LDAP_NOT_SUPPORTED;
93 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
95 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
96 clientctrls, message );
98 ret = WLDAP32_LDAP_NO_MEMORY;
100 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
107 serverctrlsW = controlarrayAtoW( serverctrls );
108 if (!serverctrlsW) goto exit;
111 clientctrlsW = controlarrayAtoW( clientctrls );
112 if (!clientctrlsW) goto exit;
115 ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message );
119 controlarrayfreeW( serverctrlsW );
120 controlarrayfreeW( clientctrlsW );
126 ULONG ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
127 PLDAPControlW *clientctrls, ULONG *message )
129 ULONG ret = LDAP_NOT_SUPPORTED;
132 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
135 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
136 clientctrls, message );
138 ret = WLDAP32_LDAP_NO_MEMORY;
140 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
147 serverctrlsU = controlarrayWtoU( serverctrls );
148 if (!serverctrlsU) goto exit;
151 clientctrlsU = controlarrayWtoU( clientctrls );
152 if (!clientctrlsU) goto exit;
155 ret = ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU,
156 message ? (int *)message : &dummy );
160 controlarrayfreeU( serverctrlsU );
161 controlarrayfreeU( clientctrlsU );
167 ULONG ldap_delete_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls,
168 PLDAPControlA *clientctrls )
170 ULONG ret = LDAP_NOT_SUPPORTED;
173 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
175 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls,
178 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
185 serverctrlsW = controlarrayAtoW( serverctrls );
186 if (!serverctrlsW) goto exit;
189 clientctrlsW = controlarrayAtoW( clientctrls );
190 if (!clientctrlsW) goto exit;
193 ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW );
197 controlarrayfreeW( serverctrlsW );
198 controlarrayfreeW( clientctrlsW );
204 ULONG ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls,
205 PLDAPControlW *clientctrls )
207 ULONG ret = LDAP_NOT_SUPPORTED;
210 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
212 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls,
215 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
222 serverctrlsU = controlarrayWtoU( serverctrls );
223 if (!serverctrlsU) goto exit;
226 clientctrlsU = controlarrayWtoU( clientctrls );
227 if (!clientctrlsU) goto exit;
230 ret = ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU );
234 controlarrayfreeU( serverctrlsU );
235 controlarrayfreeU( clientctrlsU );
241 ULONG ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn )
243 ULONG ret = LDAP_NOT_SUPPORTED;
247 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) );
249 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
253 if (!dnW) return WLDAP32_LDAP_NO_MEMORY;
256 ret = ldap_delete_sW( ld, dnW );
263 ULONG ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn )
265 ULONG ret = LDAP_NOT_SUPPORTED;
269 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) );
271 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
275 if (!dnU) return WLDAP32_LDAP_NO_MEMORY;
278 ret = ldap_delete_s( ld, dn ? dnU : "" );