msvcrt: Fix strtof() error reporting for values out of float range.
[wine.git] / dlls / wldap32 / rename.c
blob8d8951f214b13a96cb51d6d9d751de9b1e52bb99
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;
108 ret = map_error( ldap_funcs->fn_ldap_rename( CTX(ld), dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU,
109 message ) );
110 exit:
111 free( dnU );
112 free( newrdnU );
113 free( newparentU );
114 controlarrayfreeU( serverctrlsU );
115 controlarrayfreeU( clientctrlsU );
116 return ret;
119 /***********************************************************************
120 * ldap_rename_ext_sA (WLDAP32.@)
122 * See ldap_rename_ext_sW.
124 ULONG CDECL ldap_rename_ext_sA( LDAP *ld, char *dn, char *newrdn, char *newparent, int delete,
125 LDAPControlA **serverctrls, LDAPControlA **clientctrls )
127 ULONG ret = LDAP_NO_MEMORY;
128 WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
129 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
131 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(newrdn), debugstr_a(newparent),
132 delete, serverctrls, clientctrls );
134 if (!ld) return LDAP_PARAM_ERROR;
136 if (dn && !(dnW = strAtoW( dn ))) goto exit;
137 if (newrdn && !(newrdnW = strAtoW( newrdn ))) goto exit;
138 if (newparent && !(newparentW = strAtoW( newparent ))) goto exit;
139 if (serverctrls && !(serverctrlsW = controlarrayAtoW( serverctrls ))) goto exit;
140 if (clientctrls && !(clientctrlsW = controlarrayAtoW( clientctrls ))) goto exit;
142 ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW );
144 exit:
145 free( dnW );
146 free( newrdnW );
147 free( newparentW );
148 controlarrayfreeW( serverctrlsW );
149 controlarrayfreeW( clientctrlsW );
150 return ret;
152 /***********************************************************************
153 * ldap_rename_ext_sW (WLDAP32.@)
155 * Change the DN of a directory entry (synchronous operation).
157 * PARAMS
158 * ld [I] Pointer to an LDAP context.
159 * dn [I] DN of the entry to change.
160 * newrdn [I] New RDN for the entry.
161 * newparent [I] New parent for the entry.
162 * delete [I] Delete old RDN?
163 * serverctrls [I] Array of LDAP server controls.
164 * clientctrls [I] Array of LDAP client controls.
166 * RETURNS
167 * Success: LDAP_SUCCESS
168 * Failure: An LDAP error code.
170 ULONG CDECL ldap_rename_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR *newparent, int delete,
171 LDAPControlW **serverctrls, LDAPControlW **clientctrls )
173 ULONG ret = LDAP_PARAM_ERROR;
174 char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
175 LDAPControlU **serverctrlsU = NULL, **clientctrlsU = NULL;
177 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(newrdn), debugstr_w(newparent),
178 delete, serverctrls, clientctrls );
180 if (!ld) return LDAP_PARAM_ERROR;
182 if (dn && !(dnU = strWtoU( dn ))) goto exit;
183 if (newrdn && !(newrdnU = strWtoU( newrdn ))) goto exit;
184 if (newparent && !(newparentU = strWtoU( newparent ))) goto exit;
185 if (serverctrls && !(serverctrlsU = controlarrayWtoU( serverctrls ))) goto exit;
186 if (clientctrls && !(clientctrlsU = controlarrayWtoU( clientctrls ))) goto exit;
188 ret = map_error( ldap_funcs->fn_ldap_rename_s( CTX(ld), dnU, newrdnU, newparentU, delete, serverctrlsU,
189 clientctrlsU ) );
190 exit:
191 free( dnU );
192 free( newrdnU );
193 free( newparentU );
194 controlarrayfreeU( serverctrlsU );
195 controlarrayfreeU( clientctrlsU );
196 return ret;