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

search.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_searchA     (WLDAP32.@)
00043  *
00044  * See ldap_searchW.
00045  */
00046 ULONG CDECL ldap_searchA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
00047     PCHAR attrs[], ULONG attrsonly )
00048 {
00049     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00050 #ifdef HAVE_LDAP
00051     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
00052 
00053     ret = WLDAP32_LDAP_NO_MEMORY;
00054 
00055     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_a(base),
00056            scope, debugstr_a(filter), attrs, attrsonly );
00057 
00058     if (!ld) return ~0u;
00059 
00060     if (base) {
00061         baseW = strAtoW( base );
00062         if (!baseW) goto exit;
00063     }
00064     if (filter) {
00065         filterW = strAtoW( filter );
00066         if (!filterW) goto exit;
00067     }
00068     if (attrs) {
00069         attrsW = strarrayAtoW( attrs );
00070         if (!attrsW) goto exit;
00071     }
00072 
00073     ret = ldap_searchW( ld, baseW, scope, filterW, attrsW, attrsonly );
00074 
00075 exit:
00076     strfreeW( baseW );
00077     strfreeW( filterW );
00078     strarrayfreeW( attrsW );
00079 
00080 #endif
00081     return ret;
00082 }
00083 
00084 /***********************************************************************
00085  *      ldap_searchW     (WLDAP32.@)
00086  *
00087  * Search a directory tree (asynchronous operation).
00088  *
00089  * PARAMS
00090  *  ld        [I] Pointer to an LDAP context.
00091  *  base      [I] Starting point for the search.
00092  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
00093  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
00094  *  filter    [I] Search filter.
00095  *  attrs     [I] Attributes to return.
00096  *  attrsonly [I] Return no values, only attributes.
00097  *
00098  * RETURNS
00099  *  Success: Message ID of the search operation.
00100  *  Failure: ~0u
00101  *
00102  * NOTES
00103  *  Call ldap_result with the message ID to get the result of
00104  *  the operation. Cancel the operation by calling ldap_abandon
00105  *  with the message ID.
00106  */
00107 ULONG CDECL ldap_searchW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
00108     PWCHAR attrs[], ULONG attrsonly )
00109 {
00110     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00111 #ifdef HAVE_LDAP
00112     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
00113     int msg;
00114 
00115     ret = WLDAP32_LDAP_NO_MEMORY;
00116 
00117     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_w(base),
00118            scope, debugstr_w(filter), attrs, attrsonly );
00119 
00120     if (!ld) return ~0u;
00121 
00122     if (base) {
00123         baseU = strWtoU( base );
00124         if (!baseU) goto exit;
00125     }
00126     if (filter) {
00127         filterU = strWtoU( filter );
00128         if (!filterU) goto exit;
00129     }
00130     if (attrs) {
00131         attrsU = strarrayWtoU( attrs );
00132         if (!attrsU) goto exit;
00133     }
00134 
00135     ret = ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
00136                            NULL, NULL, NULL, 0, &msg );
00137 
00138     if (ret == LDAP_SUCCESS)
00139         ret = msg;
00140     else
00141         ret = ~0u;
00142 
00143 exit:
00144     strfreeU( baseU );
00145     strfreeU( filterU );
00146     strarrayfreeU( attrsU );
00147 
00148 #endif
00149     return ret;
00150 }
00151 
00152 /***********************************************************************
00153  *      ldap_search_extA     (WLDAP32.@)
00154  *
00155  * See ldap_search_extW.
00156  */
00157 ULONG CDECL ldap_search_extA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
00158     PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
00159     PLDAPControlA *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
00160 {
00161     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00162 #ifdef HAVE_LDAP
00163     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
00164     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00165 
00166     ret = WLDAP32_LDAP_NO_MEMORY;
00167 
00168     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
00169            ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
00170            serverctrls, clientctrls, timelimit, sizelimit, message );
00171 
00172     if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
00173 
00174     if (base) {
00175         baseW = strAtoW( base );
00176         if (!baseW) goto exit;
00177     }
00178     if (filter)
00179     {
00180         filterW = strAtoW( filter );
00181         if (!filterW) goto exit;
00182     }
00183     if (attrs) {
00184         attrsW = strarrayAtoW( attrs );
00185         if (!attrsW) goto exit;
00186     }
00187     if (serverctrls) {
00188         serverctrlsW = controlarrayAtoW( serverctrls );
00189         if (!serverctrlsW) goto exit;
00190     }
00191     if (clientctrls) {
00192         clientctrlsW = controlarrayAtoW( clientctrls );
00193         if (!clientctrlsW) goto exit;
00194     }
00195 
00196     ret = ldap_search_extW( ld, baseW, scope, filterW, attrsW, attrsonly,
00197                             serverctrlsW, clientctrlsW, timelimit, sizelimit, message );
00198 
00199 exit:
00200     strfreeW( baseW );
00201     strfreeW( filterW );
00202     strarrayfreeW( attrsW );
00203     controlarrayfreeW( serverctrlsW );
00204     controlarrayfreeW( clientctrlsW );
00205 
00206 #endif
00207     return ret;
00208 }
00209 
00210 /***********************************************************************
00211  *      ldap_search_extW     (WLDAP32.@)
00212  *
00213  * Search a directory tree (asynchronous operation).
00214  *
00215  * PARAMS
00216  *  ld          [I] Pointer to an LDAP context.
00217  *  base        [I] Starting point for the search.
00218  *  scope       [I] Search scope. One of LDAP_SCOPE_BASE,
00219  *                  LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
00220  *  filter      [I] Search filter.
00221  *  attrs       [I] Attributes to return.
00222  *  attrsonly   [I] Return no values, only attributes.
00223  *  serverctrls [I] Array of LDAP server controls.
00224  *  clientctrls [I] Array of LDAP client controls.
00225  *  timelimit   [I] Timeout in seconds.
00226  *  sizelimit   [I] Maximum number of entries to return. Zero means unlimited.
00227  *  message     [O] Message ID of the search operation.
00228  *
00229  * RETURNS
00230  *  Success: LDAP_SUCCESS
00231  *  Failure: An LDAP error code.
00232  *
00233  * NOTES
00234  *  Call ldap_result with the message ID to get the result of
00235  *  the operation. Cancel the operation by calling ldap_abandon
00236  *  with the message ID.
00237  */
00238 ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
00239     PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
00240     PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message )
00241 {
00242     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00243 #ifdef HAVE_LDAP
00244     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
00245     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00246     struct timeval tv;
00247 
00248     ret = WLDAP32_LDAP_NO_MEMORY;
00249 
00250     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n",
00251            ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
00252            serverctrls, clientctrls, timelimit, sizelimit, message );
00253 
00254     if (!ld) return ~0u;
00255 
00256     if (base) {
00257         baseU = strWtoU( base );
00258         if (!baseU) goto exit;
00259     }
00260     if (filter) {
00261         filterU = strWtoU( filter );
00262         if (!filterU) goto exit;
00263     }
00264     if (attrs) {
00265         attrsU = strarrayWtoU( attrs );
00266         if (!attrsU) goto exit;
00267     }
00268     if (serverctrls) {
00269         serverctrlsU = controlarrayWtoU( serverctrls );
00270         if (!serverctrlsU) goto exit;
00271     }
00272     if (clientctrls) {
00273         clientctrlsU = controlarrayWtoU( clientctrls );
00274         if (!clientctrlsU) goto exit;
00275     }
00276 
00277     tv.tv_sec = timelimit;
00278     tv.tv_usec = 0;
00279 
00280     ret = map_error( ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly,
00281                                       serverctrlsU, clientctrlsU, &tv, sizelimit, (int *)message ));
00282 
00283 exit:
00284     strfreeU( baseU );
00285     strfreeU( filterU );
00286     strarrayfreeU( attrsU );
00287     controlarrayfreeU( serverctrlsU );
00288     controlarrayfreeU( clientctrlsU );
00289 
00290 #endif
00291     return ret;
00292 }
00293 
00294 /***********************************************************************
00295  *      ldap_search_ext_sA     (WLDAP32.@)
00296  *
00297  * See ldap_search_ext_sW.
00298  */
00299 ULONG CDECL ldap_search_ext_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope,
00300     PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls,
00301     PLDAPControlA *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
00302 {
00303     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00304 #ifdef HAVE_LDAP
00305     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
00306     LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
00307 
00308     ret = WLDAP32_LDAP_NO_MEMORY;
00309 
00310     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
00311            ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly,
00312            serverctrls, clientctrls, timeout, sizelimit, res );
00313 
00314     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00315 
00316     if (base) {
00317         baseW = strAtoW( base );
00318         if (!baseW) goto exit;
00319     }
00320     if (filter) {
00321         filterW = strAtoW( filter );
00322         if (!filterW) goto exit;
00323     }
00324     if (attrs) {
00325         attrsW = strarrayAtoW( attrs );
00326         if (!attrsW) goto exit;
00327     }
00328     if (serverctrls) {
00329         serverctrlsW = controlarrayAtoW( serverctrls );
00330         if (!serverctrlsW) goto exit;
00331     }
00332     if (clientctrls) {
00333         clientctrlsW = controlarrayAtoW( clientctrls );
00334         if (!clientctrlsW) goto exit;
00335     }
00336 
00337     ret = ldap_search_ext_sW( ld, baseW, scope, filterW, attrsW, attrsonly,
00338                               serverctrlsW, clientctrlsW, timeout, sizelimit, res );
00339 
00340 exit:
00341     strfreeW( baseW );
00342     strfreeW( filterW );
00343     strarrayfreeW( attrsW );
00344     controlarrayfreeW( serverctrlsW );
00345     controlarrayfreeW( clientctrlsW );
00346 
00347 #endif
00348     return ret;
00349 }
00350 
00351 /***********************************************************************
00352  *      ldap_search_ext_sW     (WLDAP32.@)
00353  *
00354  * Search a directory tree (synchronous operation).
00355  *
00356  * PARAMS
00357  *  ld          [I] Pointer to an LDAP context.
00358  *  base        [I] Starting point for the search.
00359  *  scope       [I] Search scope. One of LDAP_SCOPE_BASE,
00360  *                  LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
00361  *  filter      [I] Search filter.
00362  *  attrs       [I] Attributes to return.
00363  *  attrsonly   [I] Return no values, only attributes.
00364  *  serverctrls [I] Array of LDAP server controls.
00365  *  clientctrls [I] Array of LDAP client controls.
00366  *  timeout     [I] Timeout in seconds.
00367  *  sizelimit   [I] Maximum number of entries to return. Zero means unlimited.
00368  *  res         [O] Results of the search operation.
00369  *
00370  * RETURNS
00371  *  Success: LDAP_SUCCESS
00372  *  Failure: An LDAP error code.
00373  *
00374  * NOTES
00375  *  Call ldap_msgfree to free the results.
00376  */
00377 ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope,
00378     PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls,
00379     PLDAPControlW *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res )
00380 {
00381     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00382 #ifdef HAVE_LDAP
00383     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
00384     LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
00385 
00386     ret = WLDAP32_LDAP_NO_MEMORY;
00387 
00388     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n",
00389            ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly,
00390            serverctrls, clientctrls, timeout, sizelimit, res );
00391 
00392     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00393 
00394     if (base) {
00395         baseU = strWtoU( base );
00396         if (!baseU) goto exit;
00397     }
00398     if (filter) {
00399         filterU = strWtoU( filter );
00400         if (!filterU) goto exit;
00401     }
00402     if (attrs) {
00403         attrsU = strarrayWtoU( attrs );
00404         if (!attrsU) goto exit;
00405     }
00406     if (serverctrls) {
00407         serverctrlsU = controlarrayWtoU( serverctrls );
00408         if (!serverctrlsU) goto exit;
00409     }
00410     if (clientctrls) {
00411         clientctrlsU = controlarrayWtoU( clientctrls );
00412         if (!clientctrlsU) goto exit;
00413     }
00414 
00415     ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
00416                                         serverctrlsU, clientctrlsU, (struct timeval *)timeout,
00417                                         sizelimit, res ));
00418 
00419 exit:
00420     strfreeU( baseU );
00421     strfreeU( filterU );
00422     strarrayfreeU( attrsU );
00423     controlarrayfreeU( serverctrlsU );
00424     controlarrayfreeU( clientctrlsU );
00425 
00426 #endif
00427     return ret;
00428 }
00429 
00430 /***********************************************************************
00431  *      ldap_search_sA     (WLDAP32.@)
00432  *
00433  * See ldap_search_sW.
00434  */
00435 ULONG CDECL ldap_search_sA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter,
00436     PCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
00437 {
00438     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00439 #ifdef HAVE_LDAP
00440     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
00441 
00442     ret = WLDAP32_LDAP_NO_MEMORY;
00443 
00444     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_a(base),
00445            scope, debugstr_a(filter), attrs, attrsonly, res );
00446 
00447     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00448 
00449     if (base) {
00450         baseW = strAtoW( base );
00451         if (!baseW) goto exit;
00452     }
00453     if (filter) {
00454         filterW = strAtoW( filter );
00455         if (!filterW) goto exit;
00456     }
00457     if (attrs) {
00458         attrsW = strarrayAtoW( attrs );
00459         if (!attrsW) goto exit;
00460     }
00461 
00462     ret = ldap_search_sW( ld, baseW, scope, filterW, attrsW, attrsonly, res );
00463 
00464 exit:
00465     strfreeW( baseW );
00466     strfreeW( filterW );
00467     strarrayfreeW( attrsW );
00468 
00469 #endif
00470     return ret;
00471 }
00472 
00473 /***********************************************************************
00474  *      ldap_search_sW     (WLDAP32.@)
00475  *
00476  * Search a directory tree (synchronous operation).
00477  *
00478  * PARAMS
00479  *  ld        [I] Pointer to an LDAP context.
00480  *  base      [I] Starting point for the search.
00481  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
00482  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
00483  *  filter    [I] Search filter.
00484  *  attrs     [I] Attributes to return.
00485  *  attrsonly [I] Return no values, only attributes.
00486  *  res       [O] Results of the search operation.
00487  *
00488  * RETURNS
00489  *  Success: LDAP_SUCCESS
00490  *  Failure: An LDAP error code.
00491  *
00492  * NOTES
00493  *  Call ldap_msgfree to free the results.
00494  */
00495 ULONG CDECL ldap_search_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter,
00496     PWCHAR attrs[], ULONG attrsonly, WLDAP32_LDAPMessage **res )
00497 {
00498     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00499 #ifdef HAVE_LDAP
00500     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
00501 
00502     ret = WLDAP32_LDAP_NO_MEMORY;
00503 
00504     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p)\n", ld, debugstr_w(base),
00505            scope, debugstr_w(filter), attrs, attrsonly, res );
00506 
00507     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00508 
00509     if (base) {
00510         baseU = strWtoU( base );
00511         if (!baseU) goto exit;
00512     }
00513     if (filter) {
00514         filterU = strWtoU( filter );
00515         if (!filterU) goto exit;
00516     }
00517     if (attrs) {
00518         attrsU = strarrayWtoU( attrs );
00519         if (!attrsU) goto exit;
00520     }
00521 
00522     ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
00523                                         NULL, NULL, NULL, 0, res ));
00524 
00525 exit:
00526     strfreeU( baseU );
00527     strfreeU( filterU );
00528     strarrayfreeU( attrsU );
00529 
00530 #endif
00531     return ret;
00532 }
00533 
00534 /***********************************************************************
00535  *      ldap_search_stA     (WLDAP32.@)
00536  *
00537  * See ldap_search_stW.
00538  */
00539 ULONG CDECL ldap_search_stA( WLDAP32_LDAP *ld, const PCHAR base, ULONG scope,
00540     const PCHAR filter, PCHAR attrs[], ULONG attrsonly,
00541     struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
00542 {
00543     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00544 #ifdef HAVE_LDAP
00545     WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL;
00546 
00547     ret = WLDAP32_LDAP_NO_MEMORY;
00548 
00549     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
00550            debugstr_a(base), scope, debugstr_a(filter), attrs,
00551            attrsonly, timeout, res );
00552 
00553     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00554 
00555     if (base) {
00556         baseW = strAtoW( base );
00557         if (!baseW) goto exit;
00558     }
00559     if (filter) {
00560         filterW = strAtoW( filter );
00561         if (!filterW) goto exit;
00562     }
00563     if (attrs) {
00564         attrsW = strarrayAtoW( attrs );
00565         if (!attrsW) goto exit;
00566     }
00567 
00568     ret = ldap_search_stW( ld, baseW, scope, filterW, attrsW, attrsonly,
00569                            timeout, res );
00570 
00571 exit:
00572     strfreeW( baseW );
00573     strfreeW( filterW );
00574     strarrayfreeW( attrsW );
00575 
00576 #endif
00577     return ret;
00578 }
00579 
00580 /***********************************************************************
00581  *      ldap_search_stW     (WLDAP32.@)
00582  *
00583  * Search a directory tree (synchronous operation).
00584  *
00585  * PARAMS
00586  *  ld        [I] Pointer to an LDAP context.
00587  *  base      [I] Starting point for the search.
00588  *  scope     [I] Search scope. One of LDAP_SCOPE_BASE,
00589  *                LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE.
00590  *  filter    [I] Search filter.
00591  *  attrs     [I] Attributes to return.
00592  *  attrsonly [I] Return no values, only attributes.
00593  *  timeout   [I] Timeout in seconds.
00594  *  res       [O] Results of the search operation.
00595  *
00596  * RETURNS
00597  *  Success: LDAP_SUCCESS
00598  *  Failure: An LDAP error code.
00599  *
00600  * NOTES
00601  *  Call ldap_msgfree to free the results.
00602  */
00603 ULONG CDECL ldap_search_stW( WLDAP32_LDAP *ld, const PWCHAR base, ULONG scope,
00604     const PWCHAR filter, PWCHAR attrs[], ULONG attrsonly,
00605     struct l_timeval *timeout, WLDAP32_LDAPMessage **res )
00606 {
00607     ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED;
00608 #ifdef HAVE_LDAP
00609     char *baseU = NULL, *filterU = NULL, **attrsU = NULL;
00610 
00611     ret = WLDAP32_LDAP_NO_MEMORY;
00612 
00613     TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld,
00614            debugstr_w(base), scope, debugstr_w(filter), attrs,
00615            attrsonly, timeout, res );
00616 
00617     if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR;
00618 
00619     if (base) {
00620         baseU = strWtoU( base );
00621         if (!baseU) goto exit;
00622     }
00623     if (filter) {
00624         filterU = strWtoU( filter );
00625         if (!filterU) goto exit;
00626     }
00627     if (attrs) {
00628         attrsU = strarrayWtoU( attrs );
00629         if (!attrsU) goto exit;
00630     }
00631 
00632     ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly,
00633                                         NULL, NULL, (struct timeval *)timeout, 0, res ));
00634 
00635 exit:
00636     strfreeU( baseU );
00637     strfreeU( filterU );
00638     strarrayfreeU( attrsU );
00639 
00640 #endif
00641     return ret;
00642 }

Generated on Fri May 25 2012 04:21:59 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.