wined3d: Use wined3d_mask_from_size() in stateblock_savedstates_set_all().
[wine.git] / dlls / wldap32 / rename.c
blobf6b343521c5c352df105bedfe07843bfaca75971
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"
25 #include "winldap.h"
27 #include "wine/debug.h"
28 #include "winldap_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
32 /***********************************************************************
33 * ldap_rename_extA (WLDAP32.@)
35 * See ldap_rename_extW.
37 ULONG CDECL ldap_rename_extA( LDAP *ld, char *dn, char *newrdn, char *newparent, int delete,
38 LDAPControlA **serverctrls, LDAPControlA **clientctrls, ULONG *message )
40 ULONG ret = LDAP_NO_MEMORY;
41 WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
42 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
44 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(newrdn), debugstr_a(newparent),
45 delete, serverctrls, clientctrls, message );
47 if (!ld || !message) return LDAP_PARAM_ERROR;
49 if (dn && !(dnW = strAtoW( dn ))) goto exit;
50 if (newrdn && !(newrdnW = strAtoW( newrdn ))) goto exit;
51 if (newparent && !(newparentW = strAtoW( newparent ))) goto exit;
52 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
53 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
55 ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW, message );
57 exit:
58 free( dnW );
59 free( newrdnW );
60 free( newparentW );
61 controlarrayfreeW( serverctrlsW );
62 controlarrayfreeW( clientctrlsW );
63 return ret;
66 /***********************************************************************
67 * ldap_rename_extW (WLDAP32.@)
69 * Change the DN of a directory entry (asynchronous operation).
71 * PARAMS
72 * ld [I] Pointer to an LDAP context.
73 * dn [I] DN of the entry to change.
74 * newrdn [I] New RDN for the entry.
75 * newparent [I] New parent for the entry.
76 * delete [I] Delete old RDN?
77 * serverctrls [I] Array of LDAP server controls.
78 * clientctrls [I] Array of LDAP client controls.
79 * message [O] Message ID of the operation.
81 * RETURNS
82 * Success: LDAP_SUCCESS
83 * Failure: An LDAP error code.
85 * NOTES
86 * Call ldap_result with the message ID to get the result of
87 * the operation. Cancel the operation by calling ldap_abandon
88 * with the message ID.
90 ULONG CDECL ldap_rename_extW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newparent, int delete,
91 LDAPControlW **serverctrls, LDAPControlW **clientctrls, ULONG *message )
93 ULONG ret = LDAP_NO_MEMORY;
94 char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
95 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
97 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(newrdn), debugstr_w(newparent),
98 delete, serverctrls, clientctrls, message );
100 if (!ld || !message) return LDAP_PARAM_ERROR;
102 if (dn && !(dnU = strWtoU( dn ))) goto exit;
103 if (newrdn && !(newrdnU = strWtoU( newrdn ))) goto exit;
104 if (newparent && !(newparentU = strWtoU( newparent ))) goto exit;
105 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
106 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
107 else
109 struct ldap_rename_params params = { CTX(ld), dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU, message };
110 ret = map_error( LDAP_CALL( ldap_rename, &params ));
112 exit:
113 free( dnU );
114 free( newrdnU );
115 free( newparentU );
116 controlarrayfreeU( serverctrlsU );
117 controlarrayfreeU( clientctrlsU );
118 return ret;
121 /***********************************************************************
122 * ldap_rename_ext_sA (WLDAP32.@)
124 * See ldap_rename_ext_sW.
126 ULONG CDECL ldap_rename_ext_sA( LDAP *ld, char *dn, char *newrdn, char *newparent, int delete,
127 LDAPControlA **serverctrls, LDAPControlA **clientctrls )
129 ULONG ret = LDAP_NO_MEMORY;
130 WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
131 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
133 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(newrdn), debugstr_a(newparent),
134 delete, serverctrls, clientctrls );
136 if (!ld) return LDAP_PARAM_ERROR;
138 if (dn && !(dnW = strAtoW( dn ))) goto exit;
139 if (newrdn && !(newrdnW = strAtoW( newrdn ))) goto exit;
140 if (newparent && !(newparentW = strAtoW( newparent ))) goto exit;
141 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
142 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
144 ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW );
146 exit:
147 free( dnW );
148 free( newrdnW );
149 free( newparentW );
150 controlarrayfreeW( serverctrlsW );
151 controlarrayfreeW( clientctrlsW );
152 return ret;
154 /***********************************************************************
155 * ldap_rename_ext_sW (WLDAP32.@)
157 * Change the DN of a directory entry (synchronous operation).
159 * PARAMS
160 * ld [I] Pointer to an LDAP context.
161 * dn [I] DN of the entry to change.
162 * newrdn [I] New RDN for the entry.
163 * newparent [I] New parent for the entry.
164 * delete [I] Delete old RDN?
165 * serverctrls [I] Array of LDAP server controls.
166 * clientctrls [I] Array of LDAP client controls.
168 * RETURNS
169 * Success: LDAP_SUCCESS
170 * Failure: An LDAP error code.
172 ULONG CDECL ldap_rename_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newparent, int delete,
173 LDAPControlW **serverctrls, LDAPControlW **clientctrls )
175 ULONG ret = LDAP_PARAM_ERROR;
176 char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
177 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
179 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(newrdn), debugstr_w(newparent),
180 delete, serverctrls, clientctrls );
182 if (!ld) return LDAP_PARAM_ERROR;
184 if (dn && !(dnU = strWtoU( dn ))) goto exit;
185 if (newrdn && !(newrdnU = strWtoU( newrdn ))) goto exit;
186 if (newparent && !(newparentU = strWtoU( newparent ))) goto exit;
187 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
188 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
189 else
191 struct ldap_rename_s_params params = { CTX(ld), dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU };
192 ret = map_error( LDAP_CALL( ldap_rename_s, &params ));
194 exit:
195 free( dnU );
196 free( newrdnU );
197 free( newparentU );
198 controlarrayfreeU( serverctrlsU );
199 controlarrayfreeU( clientctrlsU );
200 return ret;