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

bind.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_bindA     (WLDAP32.@)
00043  *
00044  * See ldap_bindW.
00045  */
00046 ULONG CDECL ldap_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
00047 {
00048     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00049 #ifdef HAVE_LDAP
00050     WCHAR *dnW = NULL, *credW = NULL;
00051 
00052     ret = WLDAP32_LDAP_NO_MEMORY;
00053 
00054     TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_a(dn), cred, method );
00055 
00056     if (!ld) return ~0u;
00057 
00058     if (dn) {
00059         dnW = strAtoW( dn );
00060         if (!dnW) goto exit;
00061     }
00062     if (cred) {
00063         credW = strAtoW( cred );
00064         if (!credW) goto exit;
00065     }
00066 
00067     ret = ldap_bindW( ld, dnW, credW, method );
00068 
00069 exit:
00070     strfreeW( dnW );
00071     strfreeW( credW );
00072 
00073 #endif
00074     return ret;
00075 }
00076 
00077 /***********************************************************************
00078  *      ldap_bindW     (WLDAP32.@)
00079  *
00080  * Authenticate with an LDAP server (asynchronous operation).
00081  *
00082  * PARAMS
00083  *  ld      [I] Pointer to an LDAP context.
00084  *  dn      [I] DN of entry to bind as.
00085  *  cred    [I] Credentials (e.g. password string).
00086  *  method  [I] Authentication method.
00087  *
00088  * RETURNS
00089  *  Success: Message ID of the bind operation.
00090  *  Failure: An LDAP error code.
00091  *
00092  * NOTES
00093  *  Only LDAP_AUTH_SIMPLE is supported (just like native).
00094  */
00095 ULONG CDECL ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
00096 {
00097     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00098 #ifdef HAVE_LDAP
00099     char *dnU = NULL, *credU = NULL;
00100     struct berval pwd = { 0, NULL };
00101     int msg;
00102 
00103     ret = WLDAP32_LDAP_NO_MEMORY;
00104 
00105     TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_w(dn), cred, method );
00106 
00107     if (!ld) return ~0u;
00108     if (method != LDAP_AUTH_SIMPLE) return WLDAP32_LDAP_PARAM_ERROR;
00109 
00110     if (dn) {
00111         dnU = strWtoU( dn );
00112         if (!dnU) goto exit;
00113     }
00114     if (cred) {
00115         credU = strWtoU( cred );
00116         if (!credU) goto exit;
00117 
00118         pwd.bv_len = strlen( credU );
00119         pwd.bv_val = credU;
00120     }
00121 
00122     ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
00123 
00124     if (ret == LDAP_SUCCESS)
00125         ret = msg;
00126     else
00127         ret = ~0u;
00128 
00129 exit:
00130     strfreeU( dnU );
00131     strfreeU( credU );
00132 
00133 #endif
00134     return ret;
00135 }
00136 
00137 /***********************************************************************
00138  *      ldap_bind_sA     (WLDAP32.@)
00139  *
00140  * See ldap_bind_sW.
00141  */
00142 ULONG CDECL ldap_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
00143 {
00144     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00145 #ifdef HAVE_LDAP
00146     WCHAR *dnW = NULL, *credW = NULL;
00147 
00148     ret = WLDAP32_LDAP_NO_MEMORY;
00149 
00150     TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_a(dn), cred, method );
00151 
00152     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00153 
00154     if (dn) {
00155         dnW = strAtoW( dn );
00156         if (!dnW) goto exit;
00157     }
00158     if (cred) {
00159         credW = strAtoW( cred );
00160         if (!credW) goto exit;
00161     }
00162 
00163     ret = ldap_bind_sW( ld, dnW, credW, method );
00164 
00165 exit:
00166     strfreeW( dnW );
00167     strfreeW( credW );
00168 
00169 #endif
00170     return ret;
00171 }
00172 
00173 /***********************************************************************
00174  *      ldap_bind_sW     (WLDAP32.@)
00175  *
00176  * Authenticate with an LDAP server (synchronous operation).
00177  *
00178  * PARAMS
00179  *  ld      [I] Pointer to an LDAP context.
00180  *  dn      [I] DN of entry to bind as.
00181  *  cred    [I] Credentials (e.g. password string).
00182  *  method  [I] Authentication method.
00183  *
00184  * RETURNS
00185  *  Success: LDAP_SUCCESS
00186  *  Failure: An LDAP error code.
00187  */
00188 ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
00189 {
00190     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00191 #ifdef HAVE_LDAP
00192     char *dnU = NULL, *credU = NULL;
00193     struct berval pwd = { 0, NULL };
00194 
00195     ret = WLDAP32_LDAP_NO_MEMORY;
00196 
00197     TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_w(dn), cred, method );
00198 
00199     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00200     if (method != LDAP_AUTH_SIMPLE) return WLDAP32_LDAP_PARAM_ERROR;
00201 
00202     if (dn) {
00203         dnU = strWtoU( dn );
00204         if (!dnU) goto exit;
00205     }
00206     if (cred) {
00207         credU = strWtoU( cred );
00208         if (!credU) goto exit;
00209 
00210         pwd.bv_len = strlen( credU );
00211         pwd.bv_val = credU;
00212     }
00213 
00214     ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
00215 
00216 exit:
00217     strfreeU( dnU );
00218     strfreeU( credU );
00219 
00220 #endif
00221     return ret;
00222 }
00223 
00224 /***********************************************************************
00225  *      ldap_sasl_bindA     (WLDAP32.@)
00226  *
00227  * See ldap_sasl_bindW.
00228  */
00229 ULONG CDECL ldap_sasl_bindA( WLDAP32_LDAP *ld, const PCHAR dn,
00230     const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls,
00231     PLDAPControlA *clientctrls, int *message )
00232 {
00233     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00234 #ifdef HAVE_LDAP
00235     WCHAR *dnW, *mechanismW = NULL;
00236     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00237 
00238     ret = WLDAP32_LDAP_NO_MEMORY;
00239 
00240     TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
00241            debugstr_a(mechanism), cred, serverctrls, clientctrls, message );
00242 
00243     if (!ld || !dn || !mechanism || !cred || !message)
00244         return WLDAP32_LDAP_PARAM_ERROR;
00245 
00246     dnW = strAtoW( dn );
00247     if (!dnW) goto exit;
00248 
00249     mechanismW = strAtoW( mechanism );
00250     if (!mechanismW) goto exit;
00251 
00252     if (serverctrls) {
00253         serverctrlsW = controlarrayAtoW( serverctrls );
00254         if (!serverctrlsW) goto exit;
00255     }
00256     if (clientctrls) {
00257         clientctrlsW = controlarrayAtoW( clientctrls );
00258         if (!clientctrlsW) goto exit;
00259     }
00260 
00261     ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message );
00262 
00263 exit:
00264     strfreeW( dnW );
00265     strfreeW( mechanismW );
00266     controlarrayfreeW( serverctrlsW );
00267     controlarrayfreeW( clientctrlsW );
00268 
00269 #endif
00270     return ret;
00271 }
00272 
00273 /***********************************************************************
00274  *      ldap_sasl_bindW     (WLDAP32.@)
00275  *
00276  * Authenticate with an LDAP server using SASL (asynchronous operation).
00277  *
00278  * PARAMS
00279  *  ld          [I] Pointer to an LDAP context.
00280  *  dn          [I] DN of entry to bind as.
00281  *  mechanism   [I] Authentication method.
00282  *  cred        [I] Credentials.
00283  *  serverctrls [I] Array of LDAP server controls.
00284  *  clientctrls [I] Array of LDAP client controls.
00285  *  message     [O] Message ID of the bind operation. 
00286  *
00287  * RETURNS
00288  *  Success: LDAP_SUCCESS
00289  *  Failure: An LDAP error code.
00290  *
00291  * NOTES
00292  *  The serverctrls and clientctrls parameters are optional and should
00293  *  be set to NULL if not used.
00294  */
00295 ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn,
00296     const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls,
00297     PLDAPControlW *clientctrls, int *message )
00298 {
00299     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00300 #ifdef HAVE_LDAP
00301     char *dnU, *mechanismU = NULL;
00302     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00303     struct berval credU;
00304 
00305     ret = WLDAP32_LDAP_NO_MEMORY;
00306 
00307     TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
00308            debugstr_w(mechanism), cred, serverctrls, clientctrls, message );
00309 
00310     if (!ld || !dn || !mechanism || !cred || !message)
00311         return WLDAP32_LDAP_PARAM_ERROR;
00312 
00313     dnU = strWtoU( dn );
00314     if (!dnU) goto exit;
00315 
00316     mechanismU = strWtoU( mechanism );
00317     if (!mechanismU) goto exit;
00318 
00319     if (serverctrls) {
00320         serverctrlsU = controlarrayWtoU( serverctrls );
00321         if (!serverctrlsU) goto exit;
00322     }
00323     if (clientctrls) {
00324         clientctrlsU = controlarrayWtoU( clientctrls );
00325         if (!clientctrlsU) goto exit;
00326     }
00327 
00328     credU.bv_len = cred->bv_len;
00329     credU.bv_val = cred->bv_val;
00330 
00331     ret = map_error( ldap_sasl_bind( ld, dnU, mechanismU, &credU,
00332                                      serverctrlsU, clientctrlsU, message ));
00333 
00334 exit:
00335     strfreeU( dnU );
00336     strfreeU( mechanismU );
00337     controlarrayfreeU( serverctrlsU );
00338     controlarrayfreeU( clientctrlsU );
00339 
00340 #endif
00341     return ret;
00342 }
00343 
00344 /***********************************************************************
00345  *      ldap_sasl_bind_sA     (WLDAP32.@)
00346  *
00347  * See ldap_sasl_bind_sW.
00348  */
00349 ULONG CDECL ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn,
00350     const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls,
00351     PLDAPControlA *clientctrls, PBERVAL *serverdata )
00352 {
00353     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00354 #ifdef HAVE_LDAP
00355     WCHAR *dnW, *mechanismW = NULL;
00356     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00357 
00358     ret = WLDAP32_LDAP_NO_MEMORY;
00359 
00360     TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
00361            debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata );
00362 
00363     if (!ld || !dn || !mechanism || !cred || !serverdata)
00364         return WLDAP32_LDAP_PARAM_ERROR;
00365 
00366     dnW = strAtoW( dn );
00367     if (!dnW) goto exit;
00368 
00369     mechanismW = strAtoW( mechanism );
00370     if (!mechanismW) goto exit;
00371 
00372     if (serverctrls) {
00373         serverctrlsW = controlarrayAtoW( serverctrls );
00374         if (!serverctrlsW) goto exit;
00375     }
00376     if (clientctrls) {
00377         clientctrlsW = controlarrayAtoW( clientctrls );
00378         if (!clientctrlsW) goto exit;
00379     }
00380 
00381     ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata );
00382 
00383 exit:
00384     strfreeW( dnW );
00385     strfreeW( mechanismW );
00386     controlarrayfreeW( serverctrlsW );
00387     controlarrayfreeW( clientctrlsW );
00388 
00389 #endif
00390     return ret;
00391 }
00392 
00393 /***********************************************************************
00394  *      ldap_sasl_bind_sW     (WLDAP32.@)
00395  *
00396  * Authenticate with an LDAP server using SASL (synchronous operation).
00397  *
00398  * PARAMS
00399  *  ld          [I] Pointer to an LDAP context.
00400  *  dn          [I] DN of entry to bind as.
00401  *  mechanism   [I] Authentication method.
00402  *  cred        [I] Credentials.
00403  *  serverctrls [I] Array of LDAP server controls.
00404  *  clientctrls [I] Array of LDAP client controls.
00405  *  serverdata  [O] Authentication response from the server.
00406  *
00407  * RETURNS
00408  *  Success: LDAP_SUCCESS
00409  *  Failure: An LDAP error code.
00410  *
00411  * NOTES
00412  *  The serverctrls and clientctrls parameters are optional and should
00413  *  be set to NULL if not used.
00414  */
00415 ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn,
00416     const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls,
00417     PLDAPControlW *clientctrls, PBERVAL *serverdata )
00418 {
00419     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00420 #ifdef HAVE_LDAP
00421     char *dnU, *mechanismU = NULL;
00422     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00423     struct berval credU;
00424 
00425     ret = WLDAP32_LDAP_NO_MEMORY;
00426 
00427     TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
00428            debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata );
00429 
00430     if (!ld || !dn || !mechanism || !cred || !serverdata)
00431         return WLDAP32_LDAP_PARAM_ERROR;
00432 
00433     dnU = strWtoU( dn );
00434     if (!dnU) goto exit;
00435 
00436     mechanismU = strWtoU( mechanism );
00437     if (!mechanismU) goto exit;
00438 
00439     if (serverctrls) {
00440         serverctrlsU = controlarrayWtoU( serverctrls );
00441         if (!serverctrlsU) goto exit;
00442     }
00443     if (clientctrls) {
00444         clientctrlsU = controlarrayWtoU( clientctrls );
00445         if (!clientctrlsU) goto exit;
00446     }
00447 
00448     credU.bv_len = cred->bv_len;
00449     credU.bv_val = cred->bv_val;
00450 
00451     ret = map_error( ldap_sasl_bind_s( ld, dnU, mechanismU, &credU,
00452                                        serverctrlsU, clientctrlsU, (struct berval **)serverdata ));
00453 
00454 exit:
00455     strfreeU( dnU );
00456     strfreeU( mechanismU );
00457     controlarrayfreeU( serverctrlsU );
00458     controlarrayfreeU( clientctrlsU );
00459 
00460 #endif
00461     return ret;
00462 }
00463 
00464 /***********************************************************************
00465  *      ldap_simple_bindA     (WLDAP32.@)
00466  *
00467  * See ldap_simple_bindW.
00468  */
00469 ULONG CDECL ldap_simple_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
00470 {
00471     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00472 #ifdef HAVE_LDAP
00473     WCHAR *dnW = NULL, *passwdW = NULL;
00474 
00475     ret = WLDAP32_LDAP_NO_MEMORY;
00476 
00477     TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
00478 
00479     if (!ld) return ~0u;
00480 
00481     if (dn) {
00482         dnW = strAtoW( dn );
00483         if (!dnW) goto exit;
00484     }
00485     if (passwd) {
00486         passwdW = strAtoW( passwd );
00487         if (!passwdW) goto exit;
00488     }
00489 
00490     ret = ldap_simple_bindW( ld, dnW, passwdW );
00491 
00492 exit:
00493     strfreeW( dnW );
00494     strfreeW( passwdW );
00495 
00496 #endif
00497     return ret;
00498 }
00499 
00500 /***********************************************************************
00501  *      ldap_simple_bindW     (WLDAP32.@)
00502  *
00503  * Authenticate with an LDAP server (asynchronous operation).
00504  *
00505  * PARAMS
00506  *  ld      [I] Pointer to an LDAP context.
00507  *  dn      [I] DN of entry to bind as.
00508  *  passwd  [I] Password string.
00509  *
00510  * RETURNS
00511  *  Success: Message ID of the bind operation.
00512  *  Failure: An LDAP error code.
00513  *
00514  * NOTES
00515  *  Set dn and passwd to NULL to bind as an anonymous user. 
00516  */
00517 ULONG CDECL ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
00518 {
00519     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00520 #ifdef HAVE_LDAP
00521     char *dnU = NULL, *passwdU = NULL;
00522     struct berval pwd = { 0, NULL };
00523     int msg;
00524 
00525     ret = WLDAP32_LDAP_NO_MEMORY;
00526 
00527     TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
00528 
00529     if (!ld) return ~0u;
00530 
00531     if (dn) {
00532         dnU = strWtoU( dn );
00533         if (!dnU) goto exit;
00534     }
00535     if (passwd) {
00536         passwdU = strWtoU( passwd );
00537         if (!passwdU) goto exit;
00538 
00539         pwd.bv_len = strlen( passwdU );
00540         pwd.bv_val = passwdU;
00541     }
00542 
00543     ret = ldap_sasl_bind( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, &msg );
00544 
00545     if (ret == LDAP_SUCCESS)
00546         ret = msg;
00547     else
00548         ret = ~0u;
00549 
00550 exit:
00551     strfreeU( dnU );
00552     strfreeU( passwdU );
00553 
00554 #endif
00555     return ret;
00556 }
00557 
00558 /***********************************************************************
00559  *      ldap_simple_bind_sA     (WLDAP32.@)
00560  *
00561  * See ldap_simple_bind_sW.
00562  */
00563 ULONG CDECL ldap_simple_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
00564 {
00565     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00566 #ifdef HAVE_LDAP
00567     WCHAR *dnW = NULL, *passwdW = NULL;
00568 
00569     ret = WLDAP32_LDAP_NO_MEMORY;
00570 
00571     TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
00572 
00573     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00574 
00575     if (dn) {
00576         dnW = strAtoW( dn );
00577         if (!dnW) goto exit;
00578     }
00579     if (passwd) {
00580         passwdW = strAtoW( passwd );
00581         if (!passwdW) goto exit;
00582     }
00583 
00584     ret = ldap_simple_bind_sW( ld, dnW, passwdW );
00585 
00586 exit:
00587     strfreeW( dnW );
00588     strfreeW( passwdW );
00589 
00590 #endif
00591     return ret;
00592 }
00593 
00594 /***********************************************************************
00595  *      ldap_simple_bind_sW     (WLDAP32.@)
00596  *
00597  * Authenticate with an LDAP server (synchronous operation).
00598  *
00599  * PARAMS
00600  *  ld      [I] Pointer to an LDAP context.
00601  *  dn      [I] DN of entry to bind as.
00602  *  passwd  [I] Password string.
00603  *
00604  * RETURNS
00605  *  Success: LDAP_SUCCESS
00606  *  Failure: An LDAP error code.
00607  *
00608  * NOTES
00609  *  Set dn and passwd to NULL to bind as an anonymous user. 
00610  */
00611 ULONG CDECL ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
00612 {
00613     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00614 #ifdef HAVE_LDAP
00615     char *dnU = NULL, *passwdU = NULL;
00616     struct berval pwd = { 0, NULL };
00617 
00618     ret = WLDAP32_LDAP_NO_MEMORY;
00619 
00620     TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
00621 
00622     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00623 
00624     if (dn) {
00625         dnU = strWtoU( dn );
00626         if (!dnU) goto exit;
00627     }
00628     if (passwd) {
00629         passwdU = strWtoU( passwd );
00630         if (!passwdU) goto exit;
00631 
00632         pwd.bv_len = strlen( passwdU );
00633         pwd.bv_val = passwdU;
00634     }
00635 
00636     ret = map_error( ldap_sasl_bind_s( ld, dnU, LDAP_SASL_SIMPLE, &pwd, NULL, NULL, NULL ));
00637 
00638 exit:
00639     strfreeU( dnU );
00640     strfreeU( passwdU );
00641 
00642 #endif
00643     return ret;
00644 }
00645 
00646 /***********************************************************************
00647  *      ldap_unbind     (WLDAP32.@)
00648  *
00649  * Close LDAP connection and free resources (asynchronous operation).
00650  *
00651  * PARAMS
00652  *  ld  [I] Pointer to an LDAP context.
00653  *
00654  * RETURNS
00655  *  Success: LDAP_SUCCESS
00656  *  Failure: An LDAP error code.
00657  */
00658 ULONG CDECL WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
00659 {
00660     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00661 #ifdef HAVE_LDAP
00662 
00663     TRACE( "(%p)\n", ld );
00664 
00665     if (ld)
00666         ret = map_error( ldap_unbind_ext( ld, NULL, NULL ));
00667     else
00668         ret = WLDAP32_LDAP_PARAM_ERROR;
00669 
00670 #endif
00671     return ret;
00672 }
00673 
00674 /***********************************************************************
00675  *      ldap_unbind_s     (WLDAP32.@)
00676  *
00677  * Close LDAP connection and free resources (synchronous operation).
00678  *
00679  * PARAMS
00680  *  ld  [I] Pointer to an LDAP context.
00681  *
00682  * RETURNS
00683  *  Success: LDAP_SUCCESS
00684  *  Failure: An LDAP error code.
00685  */
00686 ULONG CDECL WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
00687 {
00688     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00689 #ifdef HAVE_LDAP
00690 
00691     TRACE( "(%p)\n", ld );
00692 
00693     if (ld)
00694         ret = map_error( ldap_unbind_ext_s( ld, NULL, NULL ));
00695     else
00696         ret = WLDAP32_LDAP_PARAM_ERROR;
00697 
00698 #endif
00699     return ret;
00700 }

Generated on Sat May 26 2012 04:25:33 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.