Make CryptImport/ExportPublicKeyInfoEx behave the way MSDN describes
[wine/gsoc-2012-control.git] / dlls / wldap32 / modrdn.c
blob17ab03b99ae64da9a8def294a8c3957b0883bea4
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 #else
35 #define LDAP_NOT_SUPPORTED 0x5c
36 #endif
38 #include "winldap_private.h"
39 #include "wldap32.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
43 ULONG ldap_modrdnA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
45 ULONG ret = LDAP_NOT_SUPPORTED;
46 #ifdef HAVE_LDAP
47 WCHAR *dnW = NULL, *newdnW = NULL;
49 ret = WLDAP32_LDAP_NO_MEMORY;
51 TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) );
53 if (!ld || !newdn) return ~0UL;
55 if (dn) {
56 dnW = strAtoW( dn );
57 if (!dnW) goto exit;
60 newdnW = strAtoW( newdn );
61 if (!newdnW) goto exit;
63 ret = ldap_modrdnW( ld, dnW, newdnW );
65 exit:
66 strfreeW( dnW );
67 strfreeW( newdnW );
69 #endif
70 return ret;
73 ULONG ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
75 ULONG ret = LDAP_NOT_SUPPORTED;
76 #ifdef HAVE_LDAP
77 char *dnU = NULL, *newdnU = NULL;
79 ret = WLDAP32_LDAP_NO_MEMORY;
81 TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
83 if (!ld || !newdn) return ~0UL;
85 if (dn) {
86 dnU = strWtoU( dn );
87 if (!dnU) goto exit;
90 newdnU = strWtoU( newdn );
91 if (!newdnU) goto exit;
93 ret = ldap_modrdn( ld, dn ? dnU : "", newdnU );
95 exit:
96 strfreeU( dnU );
97 strfreeU( newdnU );
99 #endif
100 return ret;
103 ULONG ldap_modrdn2A( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
105 ULONG ret = LDAP_NOT_SUPPORTED;
106 #ifdef HAVE_LDAP
107 WCHAR *dnW = NULL, *newdnW = NULL;
109 ret = WLDAP32_LDAP_NO_MEMORY;
111 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
113 if (!ld || !newdn) return ~0UL;
115 if (dn) {
116 dnW = strAtoW( dn );
117 if (!dnW) goto exit;
120 newdnW = strAtoW( newdn );
121 if (!newdnW) goto exit;
123 ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
125 exit:
126 strfreeW( dnW );
127 strfreeW( newdnW );
129 #endif
130 return ret;
133 ULONG ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
135 ULONG ret = LDAP_NOT_SUPPORTED;
136 #ifdef HAVE_LDAP
137 char *dnU = NULL, *newdnU = NULL;
139 ret = WLDAP32_LDAP_NO_MEMORY;
141 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
143 if (!ld || !newdn) return ~0UL;
145 if (dn) {
146 dnU = strWtoU( dn );
147 if (!dnU) goto exit;
150 newdnU = strWtoU( newdn );
151 if (!newdnU) goto exit;
153 ret = ldap_modrdn2( ld, dn ? dnU : "", newdnU, delete );
155 exit:
156 strfreeU( dnU );
157 strfreeU( newdnU );
159 #endif
160 return ret;
163 ULONG ldap_modrdn2_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
165 ULONG ret = LDAP_NOT_SUPPORTED;
166 #ifdef HAVE_LDAP
167 WCHAR *dnW = NULL, *newdnW = NULL;
169 ret = WLDAP32_LDAP_NO_MEMORY;
171 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
173 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
175 if (dn) {
176 dnW = strAtoW( dn );
177 if (!dnW) goto exit;
180 newdnW = strAtoW( newdn );
181 if (!newdnW) goto exit;
183 ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
185 exit:
186 strfreeW( dnW );
187 strfreeW( newdnW );
189 #endif
190 return ret;
193 ULONG ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
195 ULONG ret = LDAP_NOT_SUPPORTED;
196 #ifdef HAVE_LDAP
197 char *dnU = NULL, *newdnU = NULL;
199 ret = WLDAP32_LDAP_NO_MEMORY;
201 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
203 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
205 if (dn) {
206 dnU = strWtoU( dn );
207 if (!dnU) goto exit;
210 newdnU = strWtoU( newdn );
211 if (!newdnU) goto exit;
213 ret = ldap_modrdn2_s( ld, dn ? dnU : "", newdnU, delete );
215 exit:
216 strfreeU( dnU );
217 strfreeU( newdnU );
219 #endif
220 return ret;
223 ULONG ldap_modrdn_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
225 ULONG ret = LDAP_NOT_SUPPORTED;
226 #ifdef HAVE_LDAP
227 WCHAR *dnW = NULL, *newdnW = NULL;
229 ret = WLDAP32_LDAP_NO_MEMORY;
231 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
233 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
235 if (dn) {
236 dnW = strAtoW( dn );
237 if (!dnW) goto exit;
240 newdnW = strAtoW( newdn );
241 if (!newdnW) goto exit;
243 ret = ldap_modrdn_sW( ld, dnW, newdnW );
245 exit:
246 strfreeW( dnW );
247 strfreeW( newdnW );
249 #endif
250 return ret;
253 ULONG ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
255 ULONG ret = LDAP_NOT_SUPPORTED;
256 #ifdef HAVE_LDAP
257 char *dnU = NULL, *newdnU = NULL;
259 ret = WLDAP32_LDAP_NO_MEMORY;
261 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
263 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
265 if (dn) {
266 dnU = strWtoU( dn );
267 if (!dnU) goto exit;
270 newdnU = strWtoU( newdn );
271 if (!newdnU) goto exit;
273 ret = ldap_modrdn_s( ld, dn ? dnU : "", newdnU );
275 exit:
276 strfreeU( dnU );
277 strfreeU( newdnU );
279 #endif
280 return ret;