wined3d: Implement locally defined boolean and integer constants in GLSL.
[wine/multimedia.git] / dlls / wldap32 / rename.c
blob1ca8a4dbd896d905f39e2920416bf8c8ca3a1f19
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 "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 CDECL ldap_rename_extA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
44 PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
45 PLDAPControlA *clientctrls, ULONG *message )
47 ULONG ret = LDAP_NOT_SUPPORTED;
48 #ifdef HAVE_LDAP
49 WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
50 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
52 ret = WLDAP32_LDAP_NO_MEMORY;
54 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn),
55 debugstr_a(newrdn), debugstr_a(newparent), delete,
56 serverctrls, clientctrls, message );
58 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
60 if (dn) {
61 dnW = strAtoW( dn );
62 if (!dnW) goto exit;
64 if (newrdn) {
65 newrdnW = strAtoW( newrdn );
66 if (!newrdnW) goto exit;
68 if (newparent) {
69 newparentW = strAtoW( newparent );
70 if (!newparentW) goto exit;
72 if (serverctrls) {
73 serverctrlsW = controlarrayAtoW( serverctrls );
74 if (!serverctrlsW) goto exit;
76 if (clientctrls) {
77 clientctrlsW = controlarrayAtoW( clientctrls );
78 if (!clientctrlsW) goto exit;
81 ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete,
82 serverctrlsW, clientctrlsW, message );
84 exit:
85 strfreeW( dnW );
86 strfreeW( newrdnW );
87 strfreeW( newparentW );
88 controlarrayfreeW( serverctrlsW );
89 controlarrayfreeW( clientctrlsW );
91 #endif
92 return ret;
95 ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
96 PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
97 PLDAPControlW *clientctrls, ULONG *message )
99 ULONG ret = LDAP_NOT_SUPPORTED;
100 #ifdef HAVE_LDAP
101 char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
102 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
104 ret = WLDAP32_LDAP_NO_MEMORY;
106 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn),
107 debugstr_w(newrdn), debugstr_w(newparent), delete,
108 serverctrls, clientctrls, message );
110 if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
112 if (dn) {
113 dnU = strWtoU( dn );
114 if (!dnU) goto exit;
116 if (newrdn) {
117 newrdnU = strWtoU( newrdn );
118 if (!newrdnU) goto exit;
120 if (newparent) {
121 newparentU = strWtoU( newparent );
122 if (!newparentU) goto exit;
124 if (serverctrls) {
125 serverctrlsU = controlarrayWtoU( serverctrls );
126 if (!serverctrlsU) goto exit;
128 if (clientctrls) {
129 clientctrlsU = controlarrayWtoU( clientctrls );
130 if (!clientctrlsU) goto exit;
133 ret = ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
134 delete, serverctrlsU, clientctrlsU, (int *)message );
136 exit:
137 strfreeU( dnU );
138 strfreeU( newrdnU );
139 strfreeU( newparentU );
140 controlarrayfreeU( serverctrlsU );
141 controlarrayfreeU( clientctrlsU );
143 #endif
144 return ret;
147 ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
148 PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
149 PLDAPControlA *clientctrls )
151 ULONG ret = LDAP_NOT_SUPPORTED;
152 #ifdef HAVE_LDAP
153 WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
154 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
156 ret = WLDAP32_LDAP_NO_MEMORY;
158 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn),
159 debugstr_a(newrdn), debugstr_a(newparent), delete,
160 serverctrls, clientctrls );
162 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
164 if (dn) {
165 dnW = strAtoW( dn );
166 if (!dnW) goto exit;
168 if (newrdn) {
169 newrdnW = strAtoW( newrdn );
170 if (!newrdnW) goto exit;
172 if (newparent) {
173 newparentW = strAtoW( newparent );
174 if (!newparentW) goto exit;
176 if (serverctrls) {
177 serverctrlsW = controlarrayAtoW( serverctrls );
178 if (!serverctrlsW) goto exit;
180 if (clientctrls) {
181 clientctrlsW = controlarrayAtoW( clientctrls );
182 if (!clientctrlsW) goto exit;
185 ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete,
186 serverctrlsW, clientctrlsW );
188 exit:
189 strfreeW( dnW );
190 strfreeW( newrdnW );
191 strfreeW( newparentW );
192 controlarrayfreeW( serverctrlsW );
193 controlarrayfreeW( clientctrlsW );
195 #endif
196 return ret;
199 ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
200 PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
201 PLDAPControlW *clientctrls )
203 ULONG ret = LDAP_NOT_SUPPORTED;
204 #ifdef HAVE_LDAP
205 char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
206 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
208 ret = WLDAP32_LDAP_NO_MEMORY;
210 TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn),
211 debugstr_w(newrdn), debugstr_w(newparent), delete,
212 serverctrls, clientctrls );
214 if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
216 if (dn) {
217 dnU = strWtoU( dn );
218 if (!dnU) goto exit;
220 if (newrdn) {
221 newrdnU = strWtoU( newrdn );
222 if (!newrdnU) goto exit;
224 if (newparent) {
225 newparentU = strWtoU( newparent );
226 if (!newparentU) goto exit;
228 if (serverctrls) {
229 serverctrlsU = controlarrayWtoU( serverctrls );
230 if (!serverctrlsU) goto exit;
232 if (clientctrls) {
233 clientctrlsU = controlarrayWtoU( clientctrls );
234 if (!clientctrlsU) goto exit;
237 ret = ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
238 delete, serverctrlsU, clientctrlsU );
240 exit:
241 strfreeU( dnU );
242 strfreeU( newrdnU );
243 strfreeU( newparentU );
244 controlarrayfreeU( serverctrlsU );
245 controlarrayfreeU( clientctrlsU );
247 #endif
248 return ret;