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 "winldap_private.h"
23 /***********************************************************************
24 * ldap_modrdnA (WLDAP32.@)
28 ULONG CDECL
ldap_modrdnA( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
)
30 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
32 WCHAR
*dnW
= NULL
, *newdnW
= NULL
;
34 ret
= WLDAP32_LDAP_NO_MEMORY
;
36 TRACE( "(%p, %s, %s)\n", ld
, debugstr_a(dn
), debugstr_a(newdn
) );
38 if (!ld
|| !newdn
) return ~0u;
45 newdnW
= strAtoW( newdn
);
46 if (!newdnW
) goto exit
;
48 ret
= ldap_modrdnW( ld
, dnW
, newdnW
);
58 /***********************************************************************
59 * ldap_modrdnW (WLDAP32.@)
61 * Change the RDN of a directory entry (asynchronous operation).
64 * ld [I] Pointer to an LDAP context.
65 * dn [I] DN of the entry to change.
66 * newdn [I] New DN for the entry.
69 * Success: Message ID of the modrdn operation.
70 * Failure: An LDAP error code.
73 * Call ldap_result with the message ID to get the result of
74 * the operation. Cancel the operation by calling ldap_abandon
75 * with the message ID.
77 ULONG CDECL
ldap_modrdnW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
)
79 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
81 char *dnU
= NULL
, *newdnU
= NULL
;
84 ret
= WLDAP32_LDAP_NO_MEMORY
;
86 TRACE( "(%p, %s, %s)\n", ld
, debugstr_w(dn
), debugstr_w(newdn
) );
88 if (!ld
|| !newdn
) return ~0u;
95 newdnU
= strWtoU( newdn
);
96 if (!newdnU
) goto exit
;
98 ret
= ldap_rename( ld
, dn
? dnU
: "", newdnU
, NULL
, 1, NULL
, NULL
, &msg
);
100 if (ret
== LDAP_SUCCESS
)
113 /***********************************************************************
114 * ldap_modrdn2A (WLDAP32.@)
118 ULONG CDECL
ldap_modrdn2A( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
, INT
delete )
120 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
122 WCHAR
*dnW
= NULL
, *newdnW
= NULL
;
124 ret
= WLDAP32_LDAP_NO_MEMORY
;
126 TRACE( "(%p, %s, %p, 0x%02x)\n", ld
, debugstr_a(dn
), newdn
, delete );
128 if (!ld
|| !newdn
) return ~0u;
135 newdnW
= strAtoW( newdn
);
136 if (!newdnW
) goto exit
;
138 ret
= ldap_modrdn2W( ld
, dnW
, newdnW
, delete );
148 /***********************************************************************
149 * ldap_modrdn2W (WLDAP32.@)
151 * Change the RDN of a directory entry (asynchronous operation).
154 * ld [I] Pointer to an LDAP context.
155 * dn [I] DN of the entry to change.
156 * newdn [I] New DN for the entry.
157 * delete [I] Delete old DN?
160 * Success: Message ID of the modrdn operation.
161 * Failure: An LDAP error code.
164 * Call ldap_result with the message ID to get the result of
165 * the operation. Cancel the operation by calling ldap_abandon
166 * with the message ID.
168 ULONG CDECL
ldap_modrdn2W( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
, INT
delete )
170 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
172 char *dnU
= NULL
, *newdnU
= NULL
;
175 ret
= WLDAP32_LDAP_NO_MEMORY
;
177 TRACE( "(%p, %s, %p, 0x%02x)\n", ld
, debugstr_w(dn
), newdn
, delete );
179 if (!ld
|| !newdn
) return ~0u;
186 newdnU
= strWtoU( newdn
);
187 if (!newdnU
) goto exit
;
189 ret
= ldap_rename( ld
, dn
? dnU
: "", newdnU
, NULL
, delete, NULL
, NULL
, &msg
);
191 if (ret
== LDAP_SUCCESS
)
204 /***********************************************************************
205 * ldap_modrdn2_sA (WLDAP32.@)
207 * See ldap_modrdn2_sW.
209 ULONG CDECL
ldap_modrdn2_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
, INT
delete )
211 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
213 WCHAR
*dnW
= NULL
, *newdnW
= NULL
;
215 ret
= WLDAP32_LDAP_NO_MEMORY
;
217 TRACE( "(%p, %s, %p, 0x%02x)\n", ld
, debugstr_a(dn
), newdn
, delete );
219 if (!ld
|| !newdn
) return WLDAP32_LDAP_PARAM_ERROR
;
226 newdnW
= strAtoW( newdn
);
227 if (!newdnW
) goto exit
;
229 ret
= ldap_modrdn2_sW( ld
, dnW
, newdnW
, delete );
239 /***********************************************************************
240 * ldap_modrdn2_sW (WLDAP32.@)
242 * Change the RDN of a directory entry (synchronous operation).
245 * ld [I] Pointer to an LDAP context.
246 * dn [I] DN of the entry to change.
247 * newdn [I] New DN for the entry.
248 * delete [I] Delete old DN?
251 * Success: LDAP_SUCCESS
252 * Failure: An LDAP error code.
254 ULONG CDECL
ldap_modrdn2_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
, INT
delete )
256 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
258 char *dnU
= NULL
, *newdnU
= NULL
;
260 ret
= WLDAP32_LDAP_NO_MEMORY
;
262 TRACE( "(%p, %s, %p, 0x%02x)\n", ld
, debugstr_w(dn
), newdn
, delete );
264 if (!ld
|| !newdn
) return WLDAP32_LDAP_PARAM_ERROR
;
271 newdnU
= strWtoU( newdn
);
272 if (!newdnU
) goto exit
;
274 ret
= map_error( ldap_rename_s( ld
, dn
? dnU
: "", newdnU
, NULL
, delete, NULL
, NULL
));
284 /***********************************************************************
285 * ldap_modrdn_sA (WLDAP32.@)
287 * See ldap_modrdn_sW.
289 ULONG CDECL
ldap_modrdn_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
)
291 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
293 WCHAR
*dnW
= NULL
, *newdnW
= NULL
;
295 ret
= WLDAP32_LDAP_NO_MEMORY
;
297 TRACE( "(%p, %s, %p)\n", ld
, debugstr_a(dn
), newdn
);
299 if (!ld
|| !newdn
) return WLDAP32_LDAP_PARAM_ERROR
;
306 newdnW
= strAtoW( newdn
);
307 if (!newdnW
) goto exit
;
309 ret
= ldap_modrdn_sW( ld
, dnW
, newdnW
);
319 /***********************************************************************
320 * ldap_modrdn_sW (WLDAP32.@)
322 * Change the RDN of a directory entry (synchronous operation).
325 * ld [I] Pointer to an LDAP context.
326 * dn [I] DN of the entry to change.
327 * newdn [I] New DN for the entry.
330 * Success: LDAP_SUCCESS
331 * Failure: An LDAP error code.
333 ULONG CDECL
ldap_modrdn_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
)
335 ULONG ret
= WLDAP32_LDAP_NOT_SUPPORTED
;
337 char *dnU
= NULL
, *newdnU
= NULL
;
339 ret
= WLDAP32_LDAP_NO_MEMORY
;
341 TRACE( "(%p, %s, %p)\n", ld
, debugstr_w(dn
), newdn
);
343 if (!ld
|| !newdn
) return WLDAP32_LDAP_PARAM_ERROR
;
350 newdnU
= strWtoU( newdn
);
351 if (!newdnU
) goto exit
;
353 ret
= map_error( ldap_rename_s( ld
, dn
? dnU
: "", newdnU
, NULL
, 1, NULL
, NULL
));