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
27 #include "wine/debug.h"
28 #include "winldap_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wldap32
);
32 /***********************************************************************
33 * ldap_deleteA (WLDAP32.@)
37 ULONG CDECL
ldap_deleteA( LDAP
*ld
, char *dn
)
42 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
45 if (dn
&& !(dnW
= strAtoW( dn
))) return LDAP_NO_MEMORY
;
47 ret
= ldap_deleteW( ld
, dnW
);
52 /***********************************************************************
53 * ldap_deleteW (WLDAP32.@)
55 * Delete an entry from a directory tree (asynchronous operation).
58 * ld [I] Pointer to an LDAP context.
59 * dn [I] DN of the entry to delete.
62 * Success: Message ID of the add operation.
63 * Failure: An LDAP error code.
66 * Call ldap_result with the message ID to get the result of
67 * the operation. Cancel the operation by calling ldap_abandon
68 * with the message ID.
70 ULONG CDECL
ldap_deleteW( LDAP
*ld
, WCHAR
*dn
)
74 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
76 ret
= ldap_delete_extW( ld
, dn
, NULL
, NULL
, &msg
);
77 if (ret
== LDAP_SUCCESS
) return msg
;
81 /***********************************************************************
82 * ldap_delete_extA (WLDAP32.@)
84 * See ldap_delete_extW.
86 ULONG CDECL
ldap_delete_extA( LDAP
*ld
, char *dn
, LDAPControlA
**serverctrls
, LDAPControlA
**clientctrls
,
89 ULONG ret
= LDAP_NO_MEMORY
;
91 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
93 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
, clientctrls
, message
);
95 if (!ld
) return LDAP_PARAM_ERROR
;
97 if (dn
&& !(dnW
= strAtoW( dn
))) goto exit
;
98 if (serverctrls
&& !(serverctrlsW
= controlarrayAtoW( serverctrls
))) goto exit
;
99 if (clientctrls
&& !(clientctrlsW
= controlarrayAtoW( clientctrls
))) goto exit
;
101 ret
= ldap_delete_extW( ld
, dnW
, serverctrlsW
, clientctrlsW
, message
);
105 controlarrayfreeW( serverctrlsW
);
106 controlarrayfreeW( clientctrlsW
);
110 /***********************************************************************
111 * ldap_delete_extW (WLDAP32.@)
113 * Delete an entry from a directory tree (asynchronous operation).
116 * ld [I] Pointer to an LDAP context.
117 * dn [I] DN of the entry to delete.
118 * serverctrls [I] Array of LDAP server controls.
119 * clientctrls [I] Array of LDAP client controls.
120 * message [O] Message ID of the delete operation.
123 * Success: LDAP_SUCCESS
124 * Failure: An LDAP error code.
127 * Call ldap_result with the message ID to get the result of
128 * the operation. The serverctrls and clientctrls parameters are
129 * optional and should be set to NULL if not used.
131 ULONG CDECL
ldap_delete_extW( LDAP
*ld
, WCHAR
*dn
, LDAPControlW
**serverctrls
, LDAPControlW
**clientctrls
,
134 ULONG ret
= LDAP_NO_MEMORY
;
136 LDAPControlU
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
138 TRACE( "(%p, %s, %p, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
, clientctrls
, message
);
140 if (!ld
) return LDAP_PARAM_ERROR
;
142 if (dn
&& !(dnU
= strWtoU( dn
))) goto exit
;
143 if (serverctrls
&& !(serverctrlsU
= controlarrayWtoU( serverctrls
))) goto exit
;
144 if (clientctrls
&& !(clientctrlsU
= controlarrayWtoU( clientctrls
))) goto exit
;
147 struct ldap_delete_ext_params params
= { CTX(ld
), dnU
, serverctrlsU
, clientctrlsU
, message
};
148 ret
= map_error( LDAP_CALL( ldap_delete_ext
, ¶ms
));
153 controlarrayfreeU( serverctrlsU
);
154 controlarrayfreeU( clientctrlsU
);
158 /***********************************************************************
159 * ldap_delete_ext_sA (WLDAP32.@)
161 * See ldap_delete_ext_sW.
163 ULONG CDECL
ldap_delete_ext_sA( LDAP
*ld
, char *dn
, LDAPControlA
**serverctrls
, LDAPControlA
**clientctrls
)
165 ULONG ret
= LDAP_NO_MEMORY
;
167 LDAPControlW
**serverctrlsW
= NULL
, **clientctrlsW
= NULL
;
169 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_a(dn
), serverctrls
, clientctrls
);
171 if (!ld
) return LDAP_PARAM_ERROR
;
173 if (dn
&& !(dnW
= strAtoW( dn
))) goto exit
;
174 if (serverctrls
&& !(serverctrlsW
= controlarrayAtoW( serverctrls
))) goto exit
;
175 if (clientctrls
&& !(clientctrlsW
= controlarrayAtoW( clientctrls
))) goto exit
;
177 ret
= ldap_delete_ext_sW( ld
, dnW
, serverctrlsW
, clientctrlsW
);
181 controlarrayfreeW( serverctrlsW
);
182 controlarrayfreeW( clientctrlsW
);
186 /***********************************************************************
187 * ldap_delete_ext_sW (WLDAP32.@)
189 * Delete an entry from a directory tree (synchronous operation).
192 * ld [I] Pointer to an LDAP context.
193 * dn [I] DN of the entry to delete.
194 * serverctrls [I] Array of LDAP server controls.
195 * clientctrls [I] Array of LDAP client controls.
198 * Success: LDAP_SUCCESS
199 * Failure: An LDAP error code.
202 * The serverctrls and clientctrls parameters are optional and
203 * should be set to NULL if not used.
205 ULONG CDECL
ldap_delete_ext_sW( LDAP
*ld
, WCHAR
*dn
, LDAPControlW
**serverctrls
, LDAPControlW
**clientctrls
)
207 ULONG ret
= LDAP_NO_MEMORY
;
209 LDAPControlU
**serverctrlsU
= NULL
, **clientctrlsU
= NULL
;
211 TRACE( "(%p, %s, %p, %p)\n", ld
, debugstr_w(dn
), serverctrls
, clientctrls
);
213 if (!ld
) return LDAP_PARAM_ERROR
;
215 if (dn
&& !(dnU
= strWtoU( dn
))) goto exit
;
216 if (serverctrls
&& !(serverctrlsU
= controlarrayWtoU( serverctrls
))) goto exit
;
217 if (clientctrls
&& !(clientctrlsU
= controlarrayWtoU( clientctrls
))) goto exit
;
220 struct ldap_delete_ext_s_params params
= { CTX(ld
), dnU
, serverctrlsU
, clientctrlsU
};
221 ret
= map_error( LDAP_CALL( ldap_delete_ext_s
, ¶ms
));
226 controlarrayfreeU( serverctrlsU
);
227 controlarrayfreeU( clientctrlsU
);
231 /***********************************************************************
232 * ldap_delete_sA (WLDAP32.@)
234 * See ldap_delete_sW.
236 ULONG CDECL
ldap_delete_sA( LDAP
*ld
, char *dn
)
241 TRACE( "(%p, %s)\n", ld
, debugstr_a(dn
) );
243 if (!ld
) return LDAP_PARAM_ERROR
;
244 if (dn
&& !(dnW
= strAtoW( dn
))) return LDAP_NO_MEMORY
;
246 ret
= ldap_delete_sW( ld
, dnW
);
251 /***********************************************************************
252 * ldap_delete_sW (WLDAP32.@)
254 * Delete an entry from a directory tree (synchronous operation).
257 * ld [I] Pointer to an LDAP context.
258 * dn [I] DN of the entry to delete.
261 * Success: LDAP_SUCCESS
262 * Failure: An LDAP error code.
264 ULONG CDECL
ldap_delete_sW( LDAP
*ld
, WCHAR
*dn
)
266 TRACE( "(%p, %s)\n", ld
, debugstr_w(dn
) );
267 return ldap_delete_ext_sW( ld
, dn
, NULL
, NULL
);