Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendelete.c
Go to the documentation of this file.
00001 /* 00002 * WLDAP32 - LDAP support for Wine 00003 * 00004 * Copyright 2005 Hans Leidekker 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include "config.h" 00022 00023 #include "wine/port.h" 00024 #include "wine/debug.h" 00025 00026 #include <stdarg.h> 00027 00028 #include "windef.h" 00029 #include "winbase.h" 00030 #include "winnls.h" 00031 00032 #ifdef HAVE_LDAP_H 00033 #include <ldap.h> 00034 #endif 00035 00036 #include "winldap_private.h" 00037 #include "wldap32.h" 00038 00039 WINE_DEFAULT_DEBUG_CHANNEL(wldap32); 00040 00041 /*********************************************************************** 00042 * ldap_deleteA (WLDAP32.@) 00043 * 00044 * See ldap_deleteW. 00045 */ 00046 ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn ) 00047 { 00048 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00049 #ifdef HAVE_LDAP 00050 WCHAR *dnW = NULL; 00051 00052 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) ); 00053 00054 if (!ld) return ~0u; 00055 00056 if (dn) { 00057 dnW = strAtoW( dn ); 00058 if (!dnW) return WLDAP32_LDAP_NO_MEMORY; 00059 } 00060 00061 ret = ldap_deleteW( ld, dnW ); 00062 strfreeW( dnW ); 00063 00064 #endif 00065 return ret; 00066 } 00067 00068 /*********************************************************************** 00069 * ldap_deleteW (WLDAP32.@) 00070 * 00071 * Delete an entry from a directory tree (asynchronous operation). 00072 * 00073 * PARAMS 00074 * ld [I] Pointer to an LDAP context. 00075 * dn [I] DN of the entry to delete. 00076 * 00077 * RETURNS 00078 * Success: Message ID of the add operation. 00079 * Failure: An LDAP error code. 00080 * 00081 * NOTES 00082 * Call ldap_result with the message ID to get the result of 00083 * the operation. Cancel the operation by calling ldap_abandon 00084 * with the message ID. 00085 */ 00086 ULONG CDECL ldap_deleteW( WLDAP32_LDAP *ld, PWCHAR dn ) 00087 { 00088 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00089 #ifdef HAVE_LDAP 00090 char *dnU = NULL; 00091 int msg; 00092 00093 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) ); 00094 00095 if (!ld) return ~0u; 00096 00097 if (dn) { 00098 dnU = strWtoU( dn ); 00099 if (!dnU) return WLDAP32_LDAP_NO_MEMORY; 00100 } 00101 00102 ret = ldap_delete_ext( ld, dn ? dnU : "", NULL, NULL, &msg ); 00103 00104 if (ret == LDAP_SUCCESS) 00105 ret = msg; 00106 else 00107 ret = ~0u; 00108 00109 strfreeU( dnU ); 00110 00111 #endif 00112 return ret; 00113 } 00114 00115 /*********************************************************************** 00116 * ldap_delete_extA (WLDAP32.@) 00117 * 00118 * See ldap_delete_extW. 00119 */ 00120 ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls, 00121 PLDAPControlA *clientctrls, ULONG *message ) 00122 { 00123 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00124 #ifdef HAVE_LDAP 00125 WCHAR *dnW = NULL; 00126 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; 00127 00128 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls, 00129 clientctrls, message ); 00130 00131 ret = WLDAP32_LDAP_NO_MEMORY; 00132 00133 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00134 00135 if (dn) { 00136 dnW = strAtoW( dn ); 00137 if (!dnW) goto exit; 00138 } 00139 if (serverctrls) { 00140 serverctrlsW = controlarrayAtoW( serverctrls ); 00141 if (!serverctrlsW) goto exit; 00142 } 00143 if (clientctrls) { 00144 clientctrlsW = controlarrayAtoW( clientctrls ); 00145 if (!clientctrlsW) goto exit; 00146 } 00147 00148 ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message ); 00149 00150 exit: 00151 strfreeW( dnW ); 00152 controlarrayfreeW( serverctrlsW ); 00153 controlarrayfreeW( clientctrlsW ); 00154 00155 #endif 00156 return ret; 00157 } 00158 00159 /*********************************************************************** 00160 * ldap_delete_extW (WLDAP32.@) 00161 * 00162 * Delete an entry from a directory tree (asynchronous operation). 00163 * 00164 * PARAMS 00165 * ld [I] Pointer to an LDAP context. 00166 * dn [I] DN of the entry to delete. 00167 * serverctrls [I] Array of LDAP server controls. 00168 * clientctrls [I] Array of LDAP client controls. 00169 * message [O] Message ID of the delete operation. 00170 * 00171 * RETURNS 00172 * Success: LDAP_SUCCESS 00173 * Failure: An LDAP error code. 00174 * 00175 * NOTES 00176 * Call ldap_result with the message ID to get the result of 00177 * the operation. The serverctrls and clientctrls parameters are 00178 * optional and should be set to NULL if not used. 00179 */ 00180 ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls, 00181 PLDAPControlW *clientctrls, ULONG *message ) 00182 { 00183 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00184 #ifdef HAVE_LDAP 00185 char *dnU = NULL; 00186 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; 00187 int dummy; 00188 00189 TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_w(dn), serverctrls, 00190 clientctrls, message ); 00191 00192 ret = WLDAP32_LDAP_NO_MEMORY; 00193 00194 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00195 00196 if (dn) { 00197 dnU = strWtoU( dn ); 00198 if (!dnU) goto exit; 00199 } 00200 if (serverctrls) { 00201 serverctrlsU = controlarrayWtoU( serverctrls ); 00202 if (!serverctrlsU) goto exit; 00203 } 00204 if (clientctrls) { 00205 clientctrlsU = controlarrayWtoU( clientctrls ); 00206 if (!clientctrlsU) goto exit; 00207 } 00208 00209 ret = map_error( ldap_delete_ext( ld, dn ? dnU : "", serverctrlsU, clientctrlsU, 00210 message ? (int *)message : &dummy )); 00211 00212 exit: 00213 strfreeU( dnU ); 00214 controlarrayfreeU( serverctrlsU ); 00215 controlarrayfreeU( clientctrlsU ); 00216 00217 #endif 00218 return ret; 00219 } 00220 00221 /*********************************************************************** 00222 * ldap_delete_ext_sA (WLDAP32.@) 00223 * 00224 * See ldap_delete_ext_sW. 00225 */ 00226 ULONG CDECL ldap_delete_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls, 00227 PLDAPControlA *clientctrls ) 00228 { 00229 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00230 #ifdef HAVE_LDAP 00231 WCHAR *dnW = NULL; 00232 LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; 00233 00234 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_a(dn), serverctrls, 00235 clientctrls ); 00236 00237 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00238 00239 if (dn) { 00240 dnW = strAtoW( dn ); 00241 if (!dnW) goto exit; 00242 } 00243 if (serverctrls) { 00244 serverctrlsW = controlarrayAtoW( serverctrls ); 00245 if (!serverctrlsW) goto exit; 00246 } 00247 if (clientctrls) { 00248 clientctrlsW = controlarrayAtoW( clientctrls ); 00249 if (!clientctrlsW) goto exit; 00250 } 00251 00252 ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW ); 00253 00254 exit: 00255 strfreeW( dnW ); 00256 controlarrayfreeW( serverctrlsW ); 00257 controlarrayfreeW( clientctrlsW ); 00258 00259 #endif 00260 return ret; 00261 } 00262 00263 /*********************************************************************** 00264 * ldap_delete_ext_sW (WLDAP32.@) 00265 * 00266 * Delete an entry from a directory tree (synchronous operation). 00267 * 00268 * PARAMS 00269 * ld [I] Pointer to an LDAP context. 00270 * dn [I] DN of the entry to delete. 00271 * serverctrls [I] Array of LDAP server controls. 00272 * clientctrls [I] Array of LDAP client controls. 00273 * 00274 * RETURNS 00275 * Success: LDAP_SUCCESS 00276 * Failure: An LDAP error code. 00277 * 00278 * NOTES 00279 * The serverctrls and clientctrls parameters are optional and 00280 * should be set to NULL if not used. 00281 */ 00282 ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls, 00283 PLDAPControlW *clientctrls ) 00284 { 00285 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00286 #ifdef HAVE_LDAP 00287 char *dnU = NULL; 00288 LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; 00289 00290 TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls, 00291 clientctrls ); 00292 00293 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00294 00295 if (dn) { 00296 dnU = strWtoU( dn ); 00297 if (!dnU) goto exit; 00298 } 00299 if (serverctrls) { 00300 serverctrlsU = controlarrayWtoU( serverctrls ); 00301 if (!serverctrlsU) goto exit; 00302 } 00303 if (clientctrls) { 00304 clientctrlsU = controlarrayWtoU( clientctrls ); 00305 if (!clientctrlsU) goto exit; 00306 } 00307 00308 ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU )); 00309 00310 exit: 00311 strfreeU( dnU ); 00312 controlarrayfreeU( serverctrlsU ); 00313 controlarrayfreeU( clientctrlsU ); 00314 00315 #endif 00316 return ret; 00317 } 00318 00319 /*********************************************************************** 00320 * ldap_delete_sA (WLDAP32.@) 00321 * 00322 * See ldap_delete_sW. 00323 */ 00324 ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, PCHAR dn ) 00325 { 00326 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00327 #ifdef HAVE_LDAP 00328 WCHAR *dnW = NULL; 00329 00330 TRACE( "(%p, %s)\n", ld, debugstr_a(dn) ); 00331 00332 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00333 00334 if (dn) { 00335 dnW = strAtoW( dn ); 00336 if (!dnW) return WLDAP32_LDAP_NO_MEMORY; 00337 } 00338 00339 ret = ldap_delete_sW( ld, dnW ); 00340 strfreeW( dnW ); 00341 00342 #endif 00343 return ret; 00344 } 00345 00346 /*********************************************************************** 00347 * ldap_delete_sW (WLDAP32.@) 00348 * 00349 * Delete an entry from a directory tree (synchronous operation). 00350 * 00351 * PARAMS 00352 * ld [I] Pointer to an LDAP context. 00353 * dn [I] DN of the entry to delete. 00354 * 00355 * RETURNS 00356 * Success: LDAP_SUCCESS 00357 * Failure: An LDAP error code. 00358 */ 00359 ULONG CDECL ldap_delete_sW( WLDAP32_LDAP *ld, PWCHAR dn ) 00360 { 00361 ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; 00362 #ifdef HAVE_LDAP 00363 char *dnU = NULL; 00364 00365 TRACE( "(%p, %s)\n", ld, debugstr_w(dn) ); 00366 00367 if (!ld) return WLDAP32_LDAP_PARAM_ERROR; 00368 00369 if (dn) { 00370 dnU = strWtoU( dn ); 00371 if (!dnU) return WLDAP32_LDAP_NO_MEMORY; 00372 } 00373 00374 ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", NULL, NULL )); 00375 strfreeU( dnU ); 00376 00377 #endif 00378 return ret; 00379 } Generated on Mon May 28 2012 04:16:55 for ReactOS by
1.7.6.1
|