ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rename.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_rename_extA     (WLDAP32.@)
00043  *
00044  *  See ldap_rename_extW.
00045  */
00046 ULONG CDECL ldap_rename_extA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
00047     PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
00048     PLDAPControlA *clientctrls, ULONG *message )
00049 {
00050     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00051 #ifdef HAVE_LDAP
00052     WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
00053     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00054 
00055     ret = WLDAP32_LDAP_NO_MEMORY;
00056 
00057     TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_a(dn),
00058            debugstr_a(newrdn), debugstr_a(newparent), delete,
00059            serverctrls, clientctrls, message );
00060 
00061     if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
00062 
00063     if (dn) {
00064         dnW = strAtoW( dn );
00065         if (!dnW) goto exit;
00066     }
00067     if (newrdn) {
00068         newrdnW = strAtoW( newrdn );
00069         if (!newrdnW) goto exit;
00070     }
00071     if (newparent) {
00072         newparentW = strAtoW( newparent );
00073         if (!newparentW) goto exit;
00074     }
00075     if (serverctrls) {
00076         serverctrlsW = controlarrayAtoW( serverctrls );
00077         if (!serverctrlsW) goto exit;
00078     }
00079     if (clientctrls) {
00080         clientctrlsW = controlarrayAtoW( clientctrls );
00081         if (!clientctrlsW) goto exit;
00082     }
00083 
00084     ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete,
00085                             serverctrlsW, clientctrlsW, message );
00086 
00087 exit:
00088     strfreeW( dnW );
00089     strfreeW( newrdnW );
00090     strfreeW( newparentW );
00091     controlarrayfreeW( serverctrlsW );
00092     controlarrayfreeW( clientctrlsW );
00093 
00094 #endif
00095     return ret;
00096 }
00097 
00098 /***********************************************************************
00099  *      ldap_rename_extW     (WLDAP32.@)
00100  *
00101  * Change the DN of a directory entry (asynchronous operation).
00102  *
00103  * PARAMS
00104  *  ld          [I] Pointer to an LDAP context.
00105  *  dn          [I] DN of the entry to change.
00106  *  newrdn      [I] New RDN for the entry.
00107  *  newparent   [I] New parent for the entry.
00108  *  delete      [I] Delete old RDN?
00109  *  serverctrls [I] Array of LDAP server controls.
00110  *  clientctrls [I] Array of LDAP client controls.
00111  *  message     [O] Message ID of the operation.
00112  *
00113  * RETURNS
00114  *  Success: LDAP_SUCCESS
00115  *  Failure: An LDAP error code.
00116  *
00117  * NOTES
00118  *  Call ldap_result with the message ID to get the result of
00119  *  the operation. Cancel the operation by calling ldap_abandon
00120  *  with the message ID.
00121  */
00122 ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
00123     PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
00124     PLDAPControlW *clientctrls, ULONG *message )
00125 {
00126     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00127 #ifdef HAVE_LDAP
00128     char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
00129     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00130 
00131     ret = WLDAP32_LDAP_NO_MEMORY;
00132 
00133     TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p, %p)\n", ld, debugstr_w(dn),
00134            debugstr_w(newrdn), debugstr_w(newparent), delete,
00135            serverctrls, clientctrls, message );
00136 
00137     if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR;
00138 
00139     if (dn) {
00140         dnU = strWtoU( dn );
00141         if (!dnU) goto exit;
00142     }
00143     if (newrdn) {
00144         newrdnU = strWtoU( newrdn );
00145         if (!newrdnU) goto exit;
00146     }
00147     if (newparent) {
00148         newparentU = strWtoU( newparent );
00149         if (!newparentU) goto exit;
00150     }
00151     if (serverctrls) {
00152         serverctrlsU = controlarrayWtoU( serverctrls );
00153         if (!serverctrlsU) goto exit;
00154     }
00155     if (clientctrls) {
00156         clientctrlsU = controlarrayWtoU( clientctrls );
00157         if (!clientctrlsU) goto exit;
00158     }
00159 
00160     ret = map_error( ldap_rename( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
00161                                   delete, serverctrlsU, clientctrlsU, (int *)message ));
00162 
00163 exit:
00164     strfreeU( dnU );
00165     strfreeU( newrdnU );
00166     strfreeU( newparentU );
00167     controlarrayfreeU( serverctrlsU );
00168     controlarrayfreeU( clientctrlsU );
00169 
00170 #endif
00171     return ret;
00172 }
00173 
00174 /***********************************************************************
00175  *      ldap_rename_ext_sA     (WLDAP32.@)
00176  *
00177  *  See ldap_rename_ext_sW.
00178  */
00179 ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newrdn,
00180     PCHAR newparent, INT delete, PLDAPControlA *serverctrls,
00181     PLDAPControlA *clientctrls )
00182 {
00183     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00184 #ifdef HAVE_LDAP
00185     WCHAR *dnW = NULL, *newrdnW = NULL, *newparentW = NULL;
00186     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00187 
00188     ret = WLDAP32_LDAP_NO_MEMORY;
00189 
00190     TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_a(dn),
00191            debugstr_a(newrdn), debugstr_a(newparent), delete,
00192            serverctrls, clientctrls );
00193 
00194     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00195 
00196     if (dn) {
00197         dnW = strAtoW( dn );
00198         if (!dnW) goto exit;
00199     }
00200     if (newrdn) {
00201         newrdnW = strAtoW( newrdn );
00202         if (!newrdnW) goto exit;
00203     }
00204     if (newparent) {
00205         newparentW = strAtoW( newparent );
00206         if (!newparentW) goto exit;
00207     }
00208     if (serverctrls) {
00209         serverctrlsW = controlarrayAtoW( serverctrls );
00210         if (!serverctrlsW) goto exit;
00211     }
00212     if (clientctrls) {
00213         clientctrlsW = controlarrayAtoW( clientctrls );
00214         if (!clientctrlsW) goto exit;
00215     }
00216 
00217     ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete,
00218                               serverctrlsW, clientctrlsW );
00219 
00220 exit:
00221     strfreeW( dnW );
00222     strfreeW( newrdnW );
00223     strfreeW( newparentW );
00224     controlarrayfreeW( serverctrlsW );
00225     controlarrayfreeW( clientctrlsW );
00226 
00227 #endif
00228     return ret;
00229 }
00230 /***********************************************************************
00231  *      ldap_rename_ext_sW     (WLDAP32.@)
00232  *
00233  * Change the DN of a directory entry (synchronous operation).
00234  *
00235  * PARAMS
00236  *  ld          [I] Pointer to an LDAP context.
00237  *  dn          [I] DN of the entry to change.
00238  *  newrdn      [I] New RDN for the entry.
00239  *  newparent   [I] New parent for the entry.
00240  *  delete      [I] Delete old RDN?
00241  *  serverctrls [I] Array of LDAP server controls.
00242  *  clientctrls [I] Array of LDAP client controls.
00243  *
00244  * RETURNS
00245  *  Success: LDAP_SUCCESS
00246  *  Failure: An LDAP error code.
00247  */ 
00248 ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR newrdn,
00249     PWCHAR newparent, INT delete, PLDAPControlW *serverctrls,
00250     PLDAPControlW *clientctrls )
00251 {
00252     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00253 #ifdef HAVE_LDAP
00254     char *dnU = NULL, *newrdnU = NULL, *newparentU = NULL;
00255     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00256 
00257     ret = WLDAP32_LDAP_NO_MEMORY;
00258 
00259     TRACE( "(%p, %s, %s, %s, 0x%02x, %p, %p)\n", ld, debugstr_w(dn),
00260            debugstr_w(newrdn), debugstr_w(newparent), delete,
00261            serverctrls, clientctrls );
00262 
00263     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00264 
00265     if (dn) {
00266         dnU = strWtoU( dn );
00267         if (!dnU) goto exit;
00268     }
00269     if (newrdn) {
00270         newrdnU = strWtoU( newrdn );
00271         if (!newrdnU) goto exit;
00272     }
00273     if (newparent) {
00274         newparentU = strWtoU( newparent );
00275         if (!newparentU) goto exit;
00276     }
00277     if (serverctrls) {
00278         serverctrlsU = controlarrayWtoU( serverctrls );
00279         if (!serverctrlsU) goto exit;
00280     }
00281     if (clientctrls) {
00282         clientctrlsU = controlarrayWtoU( clientctrls );
00283         if (!clientctrlsU) goto exit;
00284     }
00285 
00286     ret = map_error( ldap_rename_s( ld, dn ? dnU : "", newrdn ? newrdnU : "", newparentU,
00287                                     delete, serverctrlsU, clientctrlsU ));
00288 
00289 exit:
00290     strfreeU( dnU );
00291     strfreeU( newrdnU );
00292     strfreeU( newparentU );
00293     controlarrayfreeU( serverctrlsU );
00294     controlarrayfreeU( clientctrlsU );
00295 
00296 #endif
00297     return ret;
00298 }

Generated on Sat May 26 2012 04:25:36 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.