windowscodecs: Silence fixme for IID_CMetaBitmapRenderTarget.
[wine.git] / dlls / wldap32 / modify.c
blob6daa0d7b0f713f5a35edee03fc3599b6ed13a08d
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winnls.h"
26 #include "wine/debug.h"
27 #include "winldap_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
31 /***********************************************************************
32 * ldap_modifyA (WLDAP32.@)
34 ULONG CDECL ldap_modifyA( LDAP *ld, char *dn, LDAPModA **mods )
36 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
37 WCHAR *dnW = NULL;
38 LDAPModW **modsW = NULL;
40 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
42 if (!ld) return ~0u;
44 if (dn && !(dnW = strAtoW( dn ))) goto exit;
45 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
47 ret = ldap_modifyW( ld, dnW, modsW );
49 exit:
50 free( dnW );
51 modarrayfreeW( modsW );
52 return ret;
55 /***********************************************************************
56 * ldap_modifyW (WLDAP32.@)
58 ULONG CDECL ldap_modifyW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
60 ULONG ret, msg;
62 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
64 ret = ldap_modify_extW( ld, dn, mods, NULL, NULL, &msg );
65 if (ret == WLDAP32_LDAP_SUCCESS) return msg;
66 return ~0u;
69 /***********************************************************************
70 * ldap_modify_extA (WLDAP32.@)
72 ULONG CDECL ldap_modify_extA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
73 LDAPControlA **clientctrls, ULONG *message )
75 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
76 WCHAR *dnW = NULL;
77 LDAPModW **modsW = NULL;
78 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
80 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls, message );
82 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
84 if (dn && !(dnW = strAtoW( dn ))) goto exit;
85 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
86 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
87 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
89 ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message );
91 exit:
92 free( dnW );
93 modarrayfreeW( modsW );
94 controlarrayfreeW( serverctrlsW );
95 controlarrayfreeW( clientctrlsW );
96 return ret;
99 /***********************************************************************
100 * ldap_modify_extW (WLDAP32.@)
102 ULONG CDECL ldap_modify_extW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
103 LDAPControlW **clientctrls, ULONG *message )
105 ULONG ret;
106 char *dnU = NULL;
107 LDAPMod **modsU = NULL;
108 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
110 TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls, message );
112 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
113 if ((ret = WLDAP32_ldap_connect( ld, NULL ))) return ret;
115 ret = WLDAP32_LDAP_NO_MEMORY;
116 if (!(dnU = dn ? strWtoU( dn ) : strdup( "" ))) goto exit;
117 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
118 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
119 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
120 else
122 ret = map_error( ldap_modify_ext( CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU, (int *)message ) );
125 exit:
126 free( dnU );
127 modarrayfreeU( modsU );
128 controlarrayfreeU( serverctrlsU );
129 controlarrayfreeU( clientctrlsU );
130 return ret;
133 /***********************************************************************
134 * ldap_modify_ext_sA (WLDAP32.@)
136 ULONG CDECL ldap_modify_ext_sA( LDAP *ld, char *dn, LDAPModA **mods, LDAPControlA **serverctrls,
137 LDAPControlA **clientctrls )
139 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
140 WCHAR *dnW = NULL;
141 LDAPModW **modsW = NULL;
142 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
144 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls );
146 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
148 if (dn && !(dnW = strAtoW( dn ))) goto exit;
149 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
150 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
151 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
153 ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW );
155 exit:
156 free( dnW );
157 modarrayfreeW( modsW );
158 controlarrayfreeW( serverctrlsW );
159 controlarrayfreeW( clientctrlsW );
160 return ret;
163 /***********************************************************************
164 * ldap_modify_ext_sW (WLDAP32.@)
166 ULONG CDECL ldap_modify_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods, LDAPControlW **serverctrls,
167 LDAPControlW **clientctrls )
169 ULONG ret;
170 char *dnU = NULL;
171 LDAPMod **modsU = NULL;
172 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
174 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls );
176 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
177 if ((ret = WLDAP32_ldap_connect( ld, NULL ))) return ret;
179 ret = WLDAP32_LDAP_NO_MEMORY;
180 if (!(dnU = dn ? strWtoU( dn ) : strdup( "" ))) goto exit;
181 if (mods && !(modsU = modarrayWtoU( mods ))) goto exit;
182 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
183 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
184 else
186 ret = map_error( ldap_modify_ext_s( CTX(ld), dnU, modsU, serverctrlsU, clientctrlsU ) );
189 exit:
190 free( dnU );
191 modarrayfreeU( modsU );
192 controlarrayfreeU( serverctrlsU );
193 controlarrayfreeU( clientctrlsU );
194 return ret;
197 /***********************************************************************
198 * ldap_modify_sA (WLDAP32.@)
200 ULONG CDECL ldap_modify_sA( LDAP *ld, char *dn, LDAPModA **mods )
202 ULONG ret = WLDAP32_LDAP_NO_MEMORY;
203 WCHAR *dnW = NULL;
204 LDAPModW **modsW = NULL;
206 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods );
208 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
210 if (dn && !(dnW = strAtoW( dn ))) goto exit;
211 if (mods && !(modsW = modarrayAtoW( mods ))) goto exit;
213 ret = ldap_modify_sW( ld, dnW, modsW );
215 exit:
216 free( dnW );
217 modarrayfreeW( modsW );
218 return ret;
221 /***********************************************************************
222 * ldap_modify_sW (WLDAP32.@)
224 ULONG CDECL ldap_modify_sW( LDAP *ld, WCHAR *dn, LDAPModW **mods )
226 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), mods );
227 return ldap_modify_ext_sW( ld, dn, mods, NULL, NULL );