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
;
72 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
78 if (!dnU
) return WLDAP32_LDAP_NO_MEMORY
;
81 ret
= ldap_delete_ext( ld
, dn
? dnU
: "", NULL
, NULL
, &msg
);
83 if (ret
== LDAP_SUCCESS
)
94 ULONG
ldap_delete_extA( WLDAP32_LDAP
*ld
, PCHAR dn
, PLDAPControlA
*serverctrls
,
95 PLDAPControlA
*clientctrls
, ULONG
*message
)
97 ULONG ret
= LDAP_NOT_SUPPORTED
;
100 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
102 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
,
103 clientctrls
, message
);
105 ret
= WLDAP32_LDAP_NO_MEMORY
;
107 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
114 serverctrlsW
= controlarrayAtoW( serverctrls
);
115 if (!serverctrlsW
) goto exit
;
118 clientctrlsW
= controlarrayAtoW( clientctrls
);
119 if (!clientctrlsW
) goto exit
;
122 ret
= ldap_delete_extW( ld
, dnW
, serverctrlsW
, clientctrlsW
, message
);
126 controlarrayfreeW( serverctrlsW
);
127 controlarrayfreeW( clientctrlsW
);
133 ULONG
ldap_delete_extW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PLDAPControlW
*serverctrls
,
134 PLDAPControlW
*clientctrls
, ULONG
*message
)
136 ULONG ret
= LDAP_NOT_SUPPORTED
;
139 LDAPControl
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
142 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
,
143 clientctrls
, message
);
145 ret
= WLDAP32_LDAP_NO_MEMORY
;
147 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
154 serverctrlsU
= controlarrayWtoU( serverctrls
);
155 if (!serverctrlsU
) goto exit
;
158 clientctrlsU
= controlarrayWtoU( clientctrls
);
159 if (!clientctrlsU
) goto exit
;
162 ret
= ldap_delete_ext( ld
, dn
? dnU
: "", serverctrlsU
, clientctrlsU
,
163 message
? (int *)message
: &dummy
);
167 controlarrayfreeU( serverctrlsU
);
168 controlarrayfreeU( clientctrlsU
);
174 ULONG
ldap_delete_ext_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PLDAPControlA
*serverctrls
,
175 PLDAPControlA
*clientctrls
)
177 ULONG ret
= LDAP_NOT_SUPPORTED
;
180 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
182 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
,
185 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
192 serverctrlsW
= controlarrayAtoW( serverctrls
);
193 if (!serverctrlsW
) goto exit
;
196 clientctrlsW
= controlarrayAtoW( clientctrls
);
197 if (!clientctrlsW
) goto exit
;
200 ret
= ldap_delete_ext_sW( ld
, dnW
, serverctrlsW
, clientctrlsW
);
204 controlarrayfreeW( serverctrlsW
);
205 controlarrayfreeW( clientctrlsW
);
211 ULONG
ldap_delete_ext_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PLDAPControlW
*serverctrls
,
212 PLDAPControlW
*clientctrls
)
214 ULONG ret
= LDAP_NOT_SUPPORTED
;
217 LDAPControl
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
219 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
,
222 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
229 serverctrlsU
= controlarrayWtoU( serverctrls
);
230 if (!serverctrlsU
) goto exit
;
233 clientctrlsU
= controlarrayWtoU( clientctrls
);
234 if (!clientctrlsU
) goto exit
;
237 ret
= ldap_delete_ext_s( ld
, dn
? dnU
: "", serverctrlsU
, clientctrlsU
);
241 controlarrayfreeU( serverctrlsU
);
242 controlarrayfreeU( clientctrlsU
);
248 ULONG
ldap_delete_sA( WLDAP32_LDAP
*ld
, PCHAR dn
)
250 ULONG ret
= LDAP_NOT_SUPPORTED
;
254 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
256 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
260 if (!dnW
) return WLDAP32_LDAP_NO_MEMORY
;
263 ret
= ldap_delete_sW( ld
, dnW
);
270 ULONG
ldap_delete_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
)
272 ULONG ret
= LDAP_NOT_SUPPORTED
;
276 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
278 if (!ld
) return WLDAP32_LDAP_PARAM_ERROR
;
282 if (!dnU
) return WLDAP32_LDAP_NO_MEMORY
;
285 ret
= ldap_delete_ext_s( ld
, dn
? dnU
: "", NULL
, NULL
);