/*********************************************************************** * ldap_search_extW (WLDAP32.@) * * Search a directory tree (asynchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * base [I] Starting point for the search. * scope [I] Search scope. One of LDAP_SCOPE_BASE, * LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE. * filter [I] Search filter. * attrs [I] Attributes to return. * attrsonly [I] Return no values, only attributes. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * timelimit [I] Timeout in seconds. * sizelimit [I] Maximum number of entries to return. Zero means unlimited. * message [O] Message ID of the search operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Call ldap_result with the message ID to get the result of * the operation. Cancel the operation by calling ldap_abandon * with the message ID. */ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *baseU = NULL, *filterU = NULL, **attrsU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; struct timeval tv, *tvp = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n", ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly, serverctrls, clientctrls, timelimit, sizelimit, message ); if (!ld) return ~0u; if (base) { baseU = strWtoU( base ); if (!baseU) goto exit; } if (filter) { filterU = strWtoU( filter ); if (!filterU) goto exit; } if (attrs) { attrsU = strarrayWtoU( attrs ); if (!attrsU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } if (timelimit) { tv.tv_sec = timelimit; tv.tv_usec = 0; tvp = &tv; } ret = map_error( ldap_search_ext( ld, baseU, scope, filterU, attrsU, attrsonly, serverctrlsU, clientctrlsU, tvp, sizelimit, (int *)message )); exit: strfreeU( baseU ); strfreeU( filterU ); strarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_compare_extW (WLDAP32.@) * * Check if an attribute has a certain value (asynchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of entry to compare value for. * attr [I] Attribute to compare value for. * value [I] string encoded value to compare. * data [I] berval encoded value to compare. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * message [O] Message ID of the compare operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Set value to compare strings or data to compare binary values. If * both are non-NULL, data will be used. The serverctrls and clientctrls * parameters are optional and should be set to NULL if not used. */ ULONG CDECL ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU = NULL, *attrU = NULL, *valueU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; struct berval val = { 0, NULL }; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(attr), debugstr_w(value), data, serverctrls, clientctrls, message ); if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR; if (!attr) return WLDAP32_LDAP_NO_MEMORY; if (dn) { dnU = strWtoU( dn ); if (!dnU) goto exit; } attrU = strWtoU( attr ); if (!attrU) goto exit; if (!data) { if (value) { valueU = strWtoU( value ); if (!valueU) goto exit; val.bv_len = strlen( valueU ); val.bv_val = valueU; } } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = ldap_compare_ext( ld, dn ? dnU : "", attrU, data ? (struct berval *)data : &val, serverctrlsU, clientctrlsU, (int *)message ); exit: strfreeU( dnU ); strfreeU( attrU ); strfreeU( valueU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_parse_vlv_controlW (WLDAP32.@) * * Parse a virtual list view control. * * PARAMS * ld [I] Pointer to an LDAP context. * control [I] Controls obtained from a result message. * targetpos [O] Position of the target in the result list. * listcount [O] Estimate of the number of results in the list. * context [O] Server side context. * errcode [O] Error code from the listview operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Free the server context with ber_bvfree. */ INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control, PULONG targetpos, PULONG listcount, struct WLDAP32_berval **context, PINT errcode ) { int ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP LDAPControl **controlU = NULL; #ifdef HAVE_LDAP_PARSE_VLV_CONTROL unsigned long pos, count; #elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL) ber_int_t pos, count; LDAPControl *vlvcontrol = NULL; unsigned int i; #endif TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos, listcount, context, errcode ); if (!ld || !control) return ~0u; controlU = controlarrayWtoU( control ); if (!controlU) return WLDAP32_LDAP_NO_MEMORY; #ifdef HAVE_LDAP_PARSE_VLV_CONTROL if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count, (struct berval **)context, errcode ))) { *targetpos = pos; *listcount = count; } #elif defined(HAVE_LDAP_PARSE_VLVRESPONSE_CONTROL) for (i = 0; controlU[i]; i++) { if (!strcmp( LDAP_CONTROL_VLVRESPONSE, controlU[i]->ldctl_oid )) vlvcontrol = controlU[i]; } if (!vlvcontrol) { controlarrayfreeU( controlU ); return WLDAP32_LDAP_CONTROL_NOT_FOUND; } if (!(ret = ldap_parse_vlvresponse_control( ld, vlvcontrol, &pos, &count, (struct berval **)context, errcode ))) { *targetpos = pos; *listcount = count; } #endif controlarrayfreeU( controlU ); #endif return map_error( ret ); }
/*********************************************************************** * ldap_search_ext_sW (WLDAP32.@) * * Search a directory tree (synchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * base [I] Starting point for the search. * scope [I] Search scope. One of LDAP_SCOPE_BASE, * LDAP_SCOPE_ONELEVEL and LDAP_SCOPE_SUBTREE. * filter [I] Search filter. * attrs [I] Attributes to return. * attrsonly [I] Return no values, only attributes. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * timeout [I] Timeout in seconds. * sizelimit [I] Maximum number of entries to return. Zero means unlimited. * res [O] Results of the search operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Call ldap_msgfree to free the results. */ ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, PWCHAR base, ULONG scope, PWCHAR filter, PWCHAR attrs[], ULONG attrsonly, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, struct l_timeval* timeout, ULONG sizelimit, WLDAP32_LDAPMessage **res ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *baseU = NULL, *filterU = NULL, **attrsU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, %p, 0x%08x, %p)\n", ld, debugstr_w(base), scope, debugstr_w(filter), attrs, attrsonly, serverctrls, clientctrls, timeout, sizelimit, res ); if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR; if (base) { baseU = strWtoU( base ); if (!baseU) goto exit; } if (filter) { filterU = strWtoU( filter ); if (!filterU) goto exit; } if (attrs) { attrsU = strarrayWtoU( attrs ); if (!attrsU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = map_error( ldap_search_ext_s( ld, baseU, scope, filterU, attrsU, attrsonly, serverctrlsU, clientctrlsU, (struct timeval *)timeout, sizelimit, res )); exit: strfreeU( baseU ); strfreeU( filterU ); strarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_parse_sort_controlW (WLDAP32.@) * * Parse a sort control. * * PARAMS * ld [I] Pointer to an LDAP context. * control [I] Control obtained from a result message. * result [O] Result code. * attr [O] Failing attribute. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * If the function fails, free the failing attribute with ldap_memfree. */ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control, ULONG *result, PWCHAR *attr ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *attrU = NULL; LDAPControl **controlU = NULL; #ifdef HAVE_LDAP_PARSE_SORT_CONTROL unsigned long res; #elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL) ber_int_t res; LDAPControl *sortcontrol = NULL; unsigned int i; #endif TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (!control) return WLDAP32_LDAP_CONTROL_NOT_FOUND; controlU = controlarrayWtoU( control ); if (!controlU) return WLDAP32_LDAP_NO_MEMORY; #ifdef HAVE_LDAP_PARSE_SORT_CONTROL if (!(ret = ldap_parse_sort_control( ld, controlU, &res, &attrU ))) { *result = res; *attr = strUtoW( attrU ); } #elif defined(HAVE_LDAP_PARSE_SORTRESPONSE_CONTROL) for (i = 0; controlU[i]; i++) { if (!strcmp( LDAP_SERVER_RESP_SORT_OID, controlU[i]->ldctl_oid )) sortcontrol = controlU[i]; } if (!sortcontrol) { controlarrayfreeU( controlU ); return WLDAP32_LDAP_CONTROL_NOT_FOUND; } if (!(ret = ldap_parse_sortresponse_control( ld, sortcontrol, &res, &attrU ))) { *result = res; *attr = strUtoW( attrU ); } #endif controlarrayfreeU( controlU ); #endif return map_error( ret ); }
/*********************************************************************** * ldap_sasl_bind_sW (WLDAP32.@) * * Authenticate with an LDAP server using SASL (synchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of entry to bind as. * mechanism [I] Authentication method. * cred [I] Credentials. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * serverdata [O] Authentication response from the server. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * The serverctrls and clientctrls parameters are optional and should * be set to NULL if not used. */ ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn, const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, PBERVAL *serverdata ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU, *mechanismU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; struct berval credU; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata ); if (!ld || !dn || !mechanism || !cred || !serverdata) return WLDAP32_LDAP_PARAM_ERROR; dnU = strWtoU( dn ); if (!dnU) goto exit; mechanismU = strWtoU( mechanism ); if (!mechanismU) goto exit; if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } credU.bv_len = cred->bv_len; credU.bv_val = cred->bv_val; ret = map_error( ldap_sasl_bind_s( ld, dnU, mechanismU, &credU, serverctrlsU, clientctrlsU, (struct berval **)serverdata )); exit: strfreeU( dnU ); strfreeU( mechanismU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control, PULONG targetpos, PULONG listcount, struct WLDAP32_berval **context, PINT errcode ) { int ret = LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP LDAPControl **controlU = NULL; TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos, listcount, context, errcode ); if (!ld) return ~0UL; if (control) { controlU = controlarrayWtoU( control ); if (!controlU) return WLDAP32_LDAP_NO_MEMORY; } ret = ldap_parse_vlv_control( ld, controlU, targetpos, listcount, (struct berval **)context, errcode ); controlarrayfreeU( controlU ); #endif return ret; }
ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control, ULONG *result, PWCHAR *attr ) { ULONG ret = LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *attrU = NULL; LDAPControl **controlU = NULL; TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr ); if (!ld) return ~0UL; if (control) { controlU = controlarrayWtoU( control ); if (!controlU) return WLDAP32_LDAP_NO_MEMORY; } ret = ldap_parse_sort_control( ld, controlU, result, &attrU ); *attr = strUtoW( attrU ); controlarrayfreeU( controlU ); #endif return ret; }
/*********************************************************************** * ldap_add_extW (WLDAP32.@) * * Add an entry to a directory tree (asynchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of the entry to add. * attrs [I] Pointer to an array of LDAPModW structures, each * specifying an attribute and its values to add. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * message [O] Message ID of the add operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Call ldap_result with the message ID to get the result of * the operation. The serverctrls and clientctrls parameters are * optional and should be set to NULL if not used. */ ULONG CDECL ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[], PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU = NULL; LDAPMod **attrsU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; int dummy; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), attrs, serverctrls, clientctrls, message ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnU = strWtoU( dn ); if (!dnU) goto exit; } if (attrs) { attrsU = modarrayWtoU( attrs ); if (!attrsU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = map_error( ldap_add_ext( ld, dn ? dnU : "", attrs ? attrsU : nullattrs, serverctrlsU, clientctrlsU, message ? (int *)message : &dummy )); exit: strfreeU( dnU ); modarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_extended_operation_sW (WLDAP32.@) * * Perform an extended operation (synchronous mode). * * PARAMS * ld [I] Pointer to an LDAP context. * oid [I] OID of the extended operation. * data [I] Data needed by the operation. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * retoid [O] OID of the server response message. * retdata [O] Data returned by the server. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * The data parameter should be set to NULL if the operation * requires no data. The serverctrls, clientctrls, retoid and * and retdata parameters are also optional. Set to NULL if not * used. Free retoid and retdata after use with ldap_memfree. */ ULONG CDECL ldap_extended_operation_sW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, PWCHAR *retoid, struct WLDAP32_berval **retdata ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *oidU = NULL, *retoidU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p, %p)\n", ld, debugstr_w(oid), data, serverctrls, clientctrls, retoid, retdata ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (oid) { oidU = strWtoU( oid ); if (!oidU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = map_error( ldap_extended_operation_s( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU, clientctrlsU, &retoidU, (struct berval **)retdata )); if (retoid && retoidU) { *retoid = strUtoW( retoidU ); if (!*retoid) ret = WLDAP32_LDAP_NO_MEMORY; ldap_memfree( retoidU ); } exit: strfreeU( oidU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_modify_extW (WLDAP32.@) * * Change an entry in a directory tree (asynchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of the entry to change. * mods [I] Pointer to an array of LDAPModW structures, each * specifying an attribute and its values to change. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * message [O] Message ID of the modify operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Call ldap_result with the message ID to get the result of * the operation. The serverctrls and clientctrls parameters are * optional and should be set to NULL if not used. */ ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *mods[], PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU = NULL; LDAPMod **modsU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; int dummy; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), mods, serverctrls, clientctrls, message ); if (!ld) return ~0UL; if (dn) { dnU = strWtoU( dn ); if (!dnU) goto exit; } if (mods) { modsU = modarrayWtoU( mods ); if (!modsU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = ldap_modify_ext( ld, dn ? dnU : "", mods ? modsU : nullmods, serverctrlsU, clientctrlsU, message ? (int *)message : &dummy ); exit: strfreeU( dnU ); modarrayfreeU( modsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_sasl_bindW (WLDAP32.@) * * Authenticate with an LDAP server using SASL (asynchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of entry to bind as. * mechanism [I] Authentication method. * cred [I] Credentials. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * message [O] Message ID of the bind operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * The serverctrls and clientctrls parameters are optional and should * be set to NULL if not used. */ ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn, const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, int *message ) { ULONG ret = LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU, *mechanismU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), debugstr_w(mechanism), cred, serverctrls, clientctrls, message ); if (!ld || !dn || !mechanism || !cred || !message) return WLDAP32_LDAP_PARAM_ERROR; dnU = strWtoU( dn ); if (!dnU) goto exit; mechanismU = strWtoU( mechanism ); if (!mechanismU) goto exit; if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = ldap_sasl_bind( ld, dnU, mechanismU, (struct berval *)cred, serverctrlsU, clientctrlsU, message ); exit: strfreeU( dnU ); strfreeU( mechanismU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_extended_operationW (WLDAP32.@) * * Perform an extended operation (asynchronous mode). * * PARAMS * ld [I] Pointer to an LDAP context. * oid [I] OID of the extended operation. * data [I] Data needed by the operation. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * message [O] Message ID of the extended operation. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * The data parameter should be set to NULL if the operation * requires no data. Call ldap_result with the message ID to * get the result of the operation or ldap_abandon to cancel * the operation. The serverctrls and clientctrls parameters * are optional and should be set to NULL if not used. Call * ldap_close_extended_op to close the operation. */ ULONG CDECL ldap_extended_operationW( WLDAP32_LDAP *ld, PWCHAR oid, struct WLDAP32_berval *data, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *oidU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_w(oid), data, serverctrls, clientctrls, message ); if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR; if (oid) { oidU = strWtoU( oid ); if (!oidU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = map_error( ldap_extended_operation( ld, oid ? oidU : "", (struct berval *)data, serverctrlsU, clientctrlsU, (int *)message )); exit: strfreeU( oidU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_delete_ext_sW (WLDAP32.@) * * Delete an entry from a directory tree (synchronous operation). * * PARAMS * ld [I] Pointer to an LDAP context. * dn [I] DN of the entry to delete. * serverctrls [I] Array of LDAP server controls. * clientctrls [I] Array of LDAP client controls. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * The serverctrls and clientctrls parameters are optional and * should be set to NULL if not used. */ ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PLDAPControlW *serverctrls, PLDAPControlW *clientctrls ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP char *dnU = NULL; LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL; TRACE( "(%p, %s, %p, %p)\n", ld, debugstr_w(dn), serverctrls, clientctrls ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnU = strWtoU( dn ); if (!dnU) goto exit; } if (serverctrls) { serverctrlsU = controlarrayWtoU( serverctrls ); if (!serverctrlsU) goto exit; } if (clientctrls) { clientctrlsU = controlarrayWtoU( clientctrls ); if (!clientctrlsU) goto exit; } ret = map_error( ldap_delete_ext_s( ld, dn ? dnU : "", serverctrlsU, clientctrlsU )); exit: strfreeU( dnU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); #endif return ret; }
/*********************************************************************** * ldap_set_optionW (WLDAP32.@) * * Set option values for a given LDAP context. * * PARAMS * ld [I] Pointer to an LDAP context. * option [I] Option to set values for. * value [I] Pointer to option values. * * RETURNS * Success: LDAP_SUCCESS * Failure: An LDAP error code. * * NOTES * Set value to LDAP_OPT_ON or LDAP_OPT_OFF for on/off options. */ ULONG CDECL ldap_set_optionW( WLDAP32_LDAP *ld, int option, void *value ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP TRACE( "(%p, 0x%08x, %p)\n", ld, option, value ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; switch (option) { case WLDAP32_LDAP_OPT_SERVER_CONTROLS: { LDAPControl **ctrlsU; ctrlsU = controlarrayWtoU( value ); if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY; ret = map_error( ldap_set_option( ld, option, ctrlsU )); controlarrayfreeU( ctrlsU ); return ret; } case WLDAP32_LDAP_OPT_DEREF: case WLDAP32_LDAP_OPT_DESC: case WLDAP32_LDAP_OPT_ERROR_NUMBER: case WLDAP32_LDAP_OPT_PROTOCOL_VERSION: case WLDAP32_LDAP_OPT_REFERRALS: case WLDAP32_LDAP_OPT_SIZELIMIT: case WLDAP32_LDAP_OPT_TIMELIMIT: return map_error( ldap_set_option( ld, option, value )); case WLDAP32_LDAP_OPT_CACHE_ENABLE: case WLDAP32_LDAP_OPT_CACHE_FN_PTRS: case WLDAP32_LDAP_OPT_CACHE_STRATEGY: case WLDAP32_LDAP_OPT_IO_FN_PTRS: case WLDAP32_LDAP_OPT_REBIND_ARG: case WLDAP32_LDAP_OPT_REBIND_FN: case WLDAP32_LDAP_OPT_RESTART: case WLDAP32_LDAP_OPT_THREAD_FN_PTRS: return WLDAP32_LDAP_LOCAL_ERROR; case WLDAP32_LDAP_OPT_API_FEATURE_INFO: case WLDAP32_LDAP_OPT_API_INFO: return WLDAP32_LDAP_UNWILLING_TO_PERFORM; case WLDAP32_LDAP_OPT_AREC_EXCLUSIVE: case WLDAP32_LDAP_OPT_AUTO_RECONNECT: case WLDAP32_LDAP_OPT_CLIENT_CERTIFICATE: case WLDAP32_LDAP_OPT_DNSDOMAIN_NAME: case WLDAP32_LDAP_OPT_ENCRYPT: case WLDAP32_LDAP_OPT_ERROR_STRING: case WLDAP32_LDAP_OPT_FAST_CONCURRENT_BIND: case WLDAP32_LDAP_OPT_GETDSNAME_FLAGS: case WLDAP32_LDAP_OPT_HOST_NAME: case WLDAP32_LDAP_OPT_HOST_REACHABLE: case WLDAP32_LDAP_OPT_PING_KEEP_ALIVE: case WLDAP32_LDAP_OPT_PING_LIMIT: case WLDAP32_LDAP_OPT_PING_WAIT_TIME: case WLDAP32_LDAP_OPT_PROMPT_CREDENTIALS: case WLDAP32_LDAP_OPT_REF_DEREF_CONN_PER_MSG: case WLDAP32_LDAP_OPT_REFERRAL_CALLBACK: case WLDAP32_LDAP_OPT_REFERRAL_HOP_LIMIT: case WLDAP32_LDAP_OPT_ROOTDSE_CACHE: case WLDAP32_LDAP_OPT_SASL_METHOD: case WLDAP32_LDAP_OPT_SECURITY_CONTEXT: case WLDAP32_LDAP_OPT_SEND_TIMEOUT: case WLDAP32_LDAP_OPT_SERVER_CERTIFICATE: case WLDAP32_LDAP_OPT_SERVER_ERROR: case WLDAP32_LDAP_OPT_SERVER_EXT_ERROR: case WLDAP32_LDAP_OPT_SIGN: case WLDAP32_LDAP_OPT_SSL: case WLDAP32_LDAP_OPT_SSL_INFO: case WLDAP32_LDAP_OPT_SSPI_FLAGS: case WLDAP32_LDAP_OPT_TCP_KEEPALIVE: FIXME( "Unsupported option: 0x%02x\n", option ); return WLDAP32_LDAP_NOT_SUPPORTED; default: FIXME( "Unknown option: 0x%02x\n", option ); return WLDAP32_LDAP_LOCAL_ERROR; } #endif return ret; }