Added descriptions for a few more machine types.
[wine/multimedia.git] / dlls / wldap32 / modify.c
blob2747a5af1ca03ca87ac5d1c888555341b1b87a04
1 /*
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
21 #include "config.h"
23 #include "wine/port.h"
24 #include "wine/debug.h"
26 #include <stdarg.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winnls.h"
32 #ifdef HAVE_LDAP_H
33 #include <ldap.h>
34 static LDAPMod *nullmods[] = { NULL };
35 #else
36 #define LDAP_NOT_SUPPORTED 0x5c
37 #endif
39 #include "winldap_private.h"
40 #include "wldap32.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
44 ULONG ldap_modifyA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
46 ULONG ret = LDAP_NOT_SUPPORTED;
47 #ifdef HAVE_LDAP
48 WCHAR *dnW = NULL;
49 LDAPModW **modsW = NULL;
51 ret = WLDAP32_LDAP_NO_MEMORY;
53 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
55 if (!ld) return ~0UL;
57 if (dn) {
58 dnW = strAtoW( dn );
59 if (!dnW) goto exit;
61 if (mods) {
62 modsW = modarrayAtoW( mods );
63 if (!modsW) goto exit;
66 ret = ldap_modifyW( ld, dnW, modsW );
68 exit:
69 strfreeW( dnW );
70 modarrayfreeW( modsW );
72 #endif
73 return ret;
76 ULONG ldap_modifyW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
78 ULONG ret = LDAP_NOT_SUPPORTED;
79 #ifdef HAVE_LDAP
80 char *dnU = NULL;
81 LDAPMod **modsU = NULL;
83 ret = WLDAP32_LDAP_NO_MEMORY;
85 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
87 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
89 if (dn) {
90 dnU = strWtoU( dn );
91 if (!dnU) goto exit;
93 if (mods) {
94 modsU = modarrayWtoU( mods );
95 if (!modsU) goto exit;
98 ret = ldap_modify( ld, dn ? dnU : "", mods ? modsU : nullmods );
100 exit:
101 strfreeU( dnU );
102 modarrayfreeU( modsU );
104 #endif
105 return ret;
108 ULONG ldap_modify_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
109 PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message )
111 ULONG ret = LDAP_NOT_SUPPORTED;
112 #ifdef HAVE_LDAP
113 WCHAR *dnW = NULL;
114 LDAPModW **modsW = NULL;
115 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
117 ret = WLDAP32_LDAP_NO_MEMORY;
119 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
120 serverctrls, clientctrls, message );
122 if (!ld) return ~0UL;
124 if (dn) {
125 dnW = strAtoW( dn );
126 if (!dnW) goto exit;
128 if (mods) {
129 modsW = modarrayAtoW( mods );
130 if (!modsW) goto exit;
132 if (serverctrls) {
133 serverctrlsW = controlarrayAtoW( serverctrls );
134 if (!serverctrlsW) goto exit;
136 if (clientctrls) {
137 clientctrlsW = controlarrayAtoW( clientctrls );
138 if (!clientctrlsW) goto exit;
141 ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
143 exit:
144 strfreeW( dnW );
145 modarrayfreeW( modsW );
146 controlarrayfreeW( serverctrlsW );
147 controlarrayfreeW( clientctrlsW );
149 #endif
150 return ret;
153 ULONG ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
154 PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message )
156 ULONG ret = LDAP_NOT_SUPPORTED;
157 #ifdef HAVE_LDAP
158 char *dnU = NULL;
159 LDAPMod **modsU = NULL;
160 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
161 int dummy;
163 ret = WLDAP32_LDAP_NO_MEMORY;
165 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
166 serverctrls, clientctrls, message );
168 if (!ld) return ~0UL;
170 if (dn) {
171 dnU = strWtoU( dn );
172 if (!dnU) goto exit;
174 if (mods) {
175 modsU = modarrayWtoU( mods );
176 if (!modsU) goto exit;
178 if (serverctrls) {
179 serverctrlsU = controlarrayWtoU( serverctrls );
180 if (!serverctrlsU) goto exit;
182 if (clientctrls) {
183 clientctrlsU = controlarrayWtoU( clientctrls );
184 if (!clientctrlsU) goto exit;
187 ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU,
188 clientctrlsU, message ? (int *)message : &dummy );
190 exit:
191 strfreeU( dnU );
192 modarrayfreeU( modsU );
193 controlarrayfreeU( serverctrlsU );
194 controlarrayfreeU( clientctrlsU );
196 #endif
197 return ret;
200 ULONG ldap_modify_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[],
201 PLDAPControlA *serverctrls, PLDAPControlA *clientctrls )
203 ULONG ret = LDAP_NOT_SUPPORTED;
204 #ifdef HAVE_LDAP
205 WCHAR *dnW = NULL;
206 LDAPModW **modsW = NULL;
207 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
209 ret = WLDAP32_LDAP_NO_MEMORY;
211 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods,
212 serverctrls, clientctrls );
214 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
216 if (dn) {
217 dnW = strAtoW( dn );
218 if (!dnW) goto exit;
220 if (mods) {
221 modsW = modarrayAtoW( mods );
222 if (!modsW) goto exit;
224 if (serverctrls) {
225 serverctrlsW = controlarrayAtoW( serverctrls );
226 if (!serverctrlsW) goto exit;
228 if (clientctrls) {
229 clientctrlsW = controlarrayAtoW( clientctrls );
230 if (!clientctrlsW) goto exit;
233 ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
235 exit:
236 strfreeW( dnW );
237 modarrayfreeW( modsW );
238 controlarrayfreeW( serverctrlsW );
239 controlarrayfreeW( clientctrlsW );
241 #endif
242 return ret;
245 ULONG ldap_modify_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[],
246 PLDAPControlW *serverctrls, PLDAPControlW *clientctrls )
248 ULONG ret = LDAP_NOT_SUPPORTED;
249 #ifdef HAVE_LDAP
250 char *dnU = NULL;
251 LDAPMod **modsU = NULL;
252 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
254 ret = WLDAP32_LDAP_NO_MEMORY;
256 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods,
257 serverctrls, clientctrls );
259 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
261 if (dn) {
262 dnU = strWtoU( dn );
263 if (!dnU) goto exit;
265 if (mods) {
266 modsU = modarrayWtoU( mods );
267 if (!modsU) goto exit;
269 if (serverctrls) {
270 serverctrlsU = controlarrayWtoU( serverctrls );
271 if (!serverctrlsU) goto exit;
273 if (clientctrls) {
274 clientctrlsU = controlarrayWtoU( clientctrls );
275 if (!clientctrlsU) goto exit;
278 ret = ldap_modify_ext_s( ld, dn ? dnU : "", mods ? modsU : nullmods,
279 serverctrlsU, clientctrlsU );
281 exit:
282 strfreeU( dnU );
283 modarrayfreeU( modsU );
284 controlarrayfreeU( serverctrlsU );
285 controlarrayfreeU( clientctrlsU );
287 #endif
288 return ret;
291 ULONG ldap_modify_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] )
293 ULONG ret = LDAP_NOT_SUPPORTED;
294 #ifdef HAVE_LDAP
295 WCHAR *dnW = NULL;
296 LDAPModW **modsW = NULL;
298 ret = WLDAP32_LDAP_NO_MEMORY;
300 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
302 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
304 if (dn) {
305 dnW = strAtoW( dn );
306 if (!dnW) goto exit;
308 if (mods) {
309 modsW = modarrayAtoW( mods );
310 if (!modsW) goto exit;
313 ret = ldap_modify_sW( ld, dnW, modsW );
315 exit:
316 strfreeW( dnW );
317 modarrayfreeW( modsW );
319 #endif
320 return ret;
323 ULONG ldap_modify_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[] )
325 ULONG ret = LDAP_NOT_SUPPORTED;
326 #ifdef HAVE_LDAP
327 char *dnU = NULL;
328 LDAPMod **modsU = NULL;
330 ret = WLDAP32_LDAP_NO_MEMORY;
332 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
334 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
336 if (dn) {
337 dnU = strWtoU( dn );
338 if (!dnU) goto exit;
340 if (mods) {
341 modsU = modarrayWtoU( mods );
342 if (!modsU) goto exit;
345 ret = ldap_modify_s( ld, dn ? dnU : "", mods ? modsU : nullmods );
347 exit:
348 strfreeU( dnU );
349 modarrayfreeU( modsU );
351 #endif
352 return ret;