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
;
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;
90 newdnU
= strWtoU( newdn
);
91 if (!newdnU
) goto exit
;
93 ret
= ldap_modrdn( ld
, dn
? dnU
: "", newdnU
);
103 ULONG
ldap_modrdn2A( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
, INT
delete )
105 ULONG ret
= LDAP_NOT_SUPPORTED
;
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;
120 newdnW
= strAtoW( newdn
);
121 if (!newdnW
) goto exit
;
123 ret
= ldap_modrdn2W( ld
, dnW
, newdnW
, delete );
133 ULONG
ldap_modrdn2W( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
, INT
delete )
135 ULONG ret
= LDAP_NOT_SUPPORTED
;
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;
150 newdnU
= strWtoU( newdn
);
151 if (!newdnU
) goto exit
;
153 ret
= ldap_modrdn2( ld
, dn
? dnU
: "", newdnU
, delete );
163 ULONG
ldap_modrdn2_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
, INT
delete )
165 ULONG ret
= LDAP_NOT_SUPPORTED
;
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
;
180 newdnW
= strAtoW( newdn
);
181 if (!newdnW
) goto exit
;
183 ret
= ldap_modrdn2_sW( ld
, dnW
, newdnW
, delete );
193 ULONG
ldap_modrdn2_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
, INT
delete )
195 ULONG ret
= LDAP_NOT_SUPPORTED
;
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
;
210 newdnU
= strWtoU( newdn
);
211 if (!newdnU
) goto exit
;
213 ret
= ldap_modrdn2_s( ld
, dn
? dnU
: "", newdnU
, delete );
223 ULONG
ldap_modrdn_sA( WLDAP32_LDAP
*ld
, PCHAR dn
, PCHAR newdn
)
225 ULONG ret
= LDAP_NOT_SUPPORTED
;
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
;
240 newdnW
= strAtoW( newdn
);
241 if (!newdnW
) goto exit
;
243 ret
= ldap_modrdn_sW( ld
, dnW
, newdnW
);
253 ULONG
ldap_modrdn_sW( WLDAP32_LDAP
*ld
, PWCHAR dn
, PWCHAR newdn
)
255 ULONG ret
= LDAP_NOT_SUPPORTED
;
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
;
270 newdnU
= strWtoU( newdn
);
271 if (!newdnU
) goto exit
;
273 ret
= ldap_modrdn_s( ld
, dn
? dnU
: "", newdnU
);