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
23 #include "wine/port.h"
24 #include "wine/debug.h"
35 #define LDAP_NOT_SUPPORTED 0x5c
38 #include "winldap_private.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
43 ULONG ldap_modrdnA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
45 ULONG ret = LDAP_NOT_SUPPORTED;
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;
60 newdnW = strAtoW( newdn );
61 if (!newdnW) goto exit;
63 ret = ldap_modrdnW( ld, dnW, newdnW );
73 ULONG ldap_modrdnW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
75 ULONG ret = LDAP_NOT_SUPPORTED;
77 char *dnU = NULL, *newdnU = NULL;
80 ret = WLDAP32_LDAP_NO_MEMORY;
82 TRACE( "(%p, %s, %s)\n", ld, debugstr_w(dn), debugstr_w(newdn) );
84 if (!ld || !newdn) return ~0UL;
91 newdnU = strWtoU( newdn );
92 if (!newdnU) goto exit;
94 ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL, &msg );
96 if (ret == LDAP_SUCCESS)
109 ULONG ldap_modrdn2A( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
111 ULONG ret = LDAP_NOT_SUPPORTED;
113 WCHAR *dnW = NULL, *newdnW = NULL;
115 ret = WLDAP32_LDAP_NO_MEMORY;
117 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
119 if (!ld || !newdn) return ~0UL;
126 newdnW = strAtoW( newdn );
127 if (!newdnW) goto exit;
129 ret = ldap_modrdn2W( ld, dnW, newdnW, delete );
139 ULONG ldap_modrdn2W( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
141 ULONG ret = LDAP_NOT_SUPPORTED;
143 char *dnU = NULL, *newdnU = NULL;
146 ret = WLDAP32_LDAP_NO_MEMORY;
148 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
150 if (!ld || !newdn) return ~0UL;
157 newdnU = strWtoU( newdn );
158 if (!newdnU) goto exit;
160 ret = ldap_rename( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL, &msg );
162 if (ret == LDAP_SUCCESS)
175 ULONG ldap_modrdn2_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn, INT delete )
177 ULONG ret = LDAP_NOT_SUPPORTED;
179 WCHAR *dnW = NULL, *newdnW = NULL;
181 ret = WLDAP32_LDAP_NO_MEMORY;
183 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_a(dn), newdn, delete );
185 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
192 newdnW = strAtoW( newdn );
193 if (!newdnW) goto exit;
195 ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete );
205 ULONG ldap_modrdn2_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn, INT delete )
207 ULONG ret = LDAP_NOT_SUPPORTED;
209 char *dnU = NULL, *newdnU = NULL;
211 ret = WLDAP32_LDAP_NO_MEMORY;
213 TRACE( "(%p, %s, %p, 0x%02x)\n", ld, debugstr_w(dn), newdn, delete );
215 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
222 newdnU = strWtoU( newdn );
223 if (!newdnU) goto exit;
225 ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, delete, NULL, NULL );
235 ULONG ldap_modrdn_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn )
237 ULONG ret = LDAP_NOT_SUPPORTED;
239 WCHAR *dnW = NULL, *newdnW = NULL;
241 ret = WLDAP32_LDAP_NO_MEMORY;
243 TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), newdn );
245 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
252 newdnW = strAtoW( newdn );
253 if (!newdnW) goto exit;
255 ret = ldap_modrdn_sW( ld, dnW, newdnW );
265 ULONG ldap_modrdn_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newdn )
267 ULONG ret = LDAP_NOT_SUPPORTED;
269 char *dnU = NULL, *newdnU = NULL;
271 ret = WLDAP32_LDAP_NO_MEMORY;
273 TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), newdn );
275 if (!ld || !newdn) return WLDAP32_LDAP_PARAM_ERROR;
282 newdnU = strWtoU( newdn );
283 if (!newdnU) goto exit;
285 ret = ldap_rename_s( ld, dn ? dnU : "", newdnU, NULL, 1, NULL, NULL );