/*********************************************************************** * ldap_modrdnA (WLDAP32.@) * * See ldap_modrdnW. */ ULONG CDECL ldap_modrdnA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR newdn ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL, *newdnW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(newdn) ); if (!ld || !newdn) return ~0u; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } newdnW = strAtoW( newdn ); if (!newdnW) goto exit; ret = ldap_modrdnW( ld, dnW, newdnW ); exit: strfreeW( dnW ); strfreeW( newdnW ); #endif return ret; }
/*********************************************************************** * ldap_bindA (WLDAP32.@) * * See ldap_bindW. */ ULONG CDECL ldap_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL, *credW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, 0x%08x)\n", ld, debugstr_a(dn), cred, method ); if (!ld) return ~0u; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (cred) { credW = strAtoW( cred ); if (!credW) goto exit; } ret = ldap_bindW( ld, dnW, credW, method ); exit: strfreeW( dnW ); strfreeW( credW ); #endif return ret; }
static HRESULT generate_moniker(char *baseurl, char *url, DWORD flags, IMoniker **moniker) { WCHAR *urlW; HRESULT hr; if (flags & URLF_RELATIVEURL) { char *combined; if (!baseurl) return E_FAIL; combined = combine_url(baseurl, url); if (!combined) return E_OUTOFMEMORY; urlW = strAtoW(combined); heap_free(combined); if (!urlW) return E_OUTOFMEMORY; } else { urlW = strAtoW(url); if (!urlW) return E_OUTOFMEMORY; } hr = CreateURLMoniker(NULL, urlW, moniker); heap_free(urlW); return hr; }
/*********************************************************************** * ldap_simple_bind_sA (WLDAP32.@) * * See ldap_simple_bind_sW. */ ULONG CDECL ldap_simple_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL, *passwdW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (passwd) { passwdW = strAtoW( passwd ); if (!passwdW) goto exit; } ret = ldap_simple_bind_sW( ld, dnW, passwdW ); exit: strfreeW( dnW ); strfreeW( passwdW ); #endif return ret; }
/*********************************************************************** * ldap_search_extA (WLDAP32.@) * * See ldap_search_extW. */ ULONG CDECL ldap_search_extA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter, PCHAR attrs[], ULONG attrsonly, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG timelimit, ULONG sizelimit, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = 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_a(base), scope, debugstr_a(filter), attrs, attrsonly, serverctrls, clientctrls, timelimit, sizelimit, message ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (base) { baseW = strAtoW( base ); if (!baseW) goto exit; } if (filter) { filterW = strAtoW( filter ); if (!filterW) goto exit; } if (attrs) { attrsW = strarrayAtoW( attrs ); if (!attrsW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_search_extW( ld, baseW, scope, filterW, attrsW, attrsonly, serverctrlsW, clientctrlsW, timelimit, sizelimit, message ); exit: strfreeW( baseW ); strfreeW( filterW ); strarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_compare_extA (WLDAP32.@) * * See ldap_compare_extW. */ ULONG CDECL ldap_compare_extA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value, struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(attr), debugstr_a(value), data, serverctrls, clientctrls, message ); if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (attr) { attrW = strAtoW( attr ); if (!attrW) goto exit; } if (value) { valueW = strAtoW( value ); if (!valueW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_compare_extW( ld, dnW, attrW, valueW, data, serverctrlsW, clientctrlsW, message ); exit: strfreeW( dnW ); strfreeW( attrW ); strfreeW( valueW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_addA (WLDAP32.@) * * See ldap_addW. */ ULONG CDECL ldap_addA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[] ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; LDAPModW **attrsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), attrs ); if (!ld) return ~0u; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (attrs) { attrsW = modarrayAtoW( attrs ); if (!attrsW) goto exit; } ret = ldap_addW( ld, dnW, attrsW ); exit: strfreeW( dnW ); modarrayfreeW( attrsW ); #endif return ret; }
static HRESULT downloadcb_create(InstallEngine *engine, HANDLE event, char *file_name, char *id, char *display, DWORD dl_size, struct downloadcb **callback) { struct downloadcb *cb; cb = heap_alloc_zero(sizeof(*cb)); if (!cb) return E_OUTOFMEMORY; cb->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl; cb->ref = 1; cb->hr = E_FAIL; cb->id = id; cb->display = display; cb->engine = engine; cb->dl_size = dl_size; cb->dl_previous_kb = engine->thread.downloaded_kb; cb->event_done = event; cb->file_name = strAtoW(file_name); if (!cb->file_name) { heap_free(cb); return E_OUTOFMEMORY; } IInstallEngine2_AddRef(&engine->IInstallEngine2_iface); *callback = cb; return S_OK; }
/*********************************************************************** * ldap_ufn2dnA (WLDAP32.@) * * See ldap_ufn2dnW. */ ULONG CDECL ldap_ufn2dnA( PCHAR ufn, PCHAR *dn ) { ULONG ret = WLDAP32_LDAP_SUCCESS; #ifdef HAVE_LDAP PWCHAR ufnW = NULL, dnW = NULL; TRACE( "(%s, %p)\n", debugstr_a(ufn), dn ); if (!dn) return WLDAP32_LDAP_PARAM_ERROR; *dn = NULL; if (ufn) { ufnW = strAtoW( ufn ); if (!ufnW) return WLDAP32_LDAP_NO_MEMORY; } ret = ldap_ufn2dnW( ufnW, &dnW ); if (dnW) { *dn = strWtoA( dnW ); if (!*dn) ret = WLDAP32_LDAP_NO_MEMORY; } strfreeW( ufnW ); ldap_memfreeW( dnW ); #endif return ret; }
/*********************************************************************** * ldap_modify_sA (WLDAP32.@) * * See ldap_modify_sW. */ ULONG CDECL ldap_modify_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[] ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; LDAPModW **modsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), mods ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (mods) { modsW = modarrayAtoW( mods ); if (!modsW) goto exit; } ret = ldap_modify_sW( ld, dnW, modsW ); exit: strfreeW( dnW ); modarrayfreeW( modsW ); #endif return ret; }
/*********************************************************************** * ldap_sasl_bind_sA (WLDAP32.@) * * See ldap_sasl_bind_sW. */ ULONG CDECL ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn, const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, PBERVAL *serverdata ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW, *mechanismW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata ); if (!ld || !dn || !mechanism || !cred || !serverdata) return WLDAP32_LDAP_PARAM_ERROR; dnW = strAtoW( dn ); if (!dnW) goto exit; mechanismW = strAtoW( mechanism ); if (!mechanismW) goto exit; if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata ); exit: strfreeW( dnW ); strfreeW( mechanismW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_search_stA (WLDAP32.@) * * See ldap_search_stW. */ ULONG CDECL ldap_search_stA( WLDAP32_LDAP *ld, const PCHAR base, ULONG scope, const PCHAR filter, PCHAR attrs[], ULONG attrsonly, struct l_timeval *timeout, WLDAP32_LDAPMessage **res ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p)\n", ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly, timeout, res ); if (!ld || !res) return WLDAP32_LDAP_PARAM_ERROR; if (base) { baseW = strAtoW( base ); if (!baseW) goto exit; } if (filter) { filterW = strAtoW( filter ); if (!filterW) goto exit; } if (attrs) { attrsW = strarrayAtoW( attrs ); if (!attrsW) goto exit; } ret = ldap_search_stW( ld, baseW, scope, filterW, attrsW, attrsonly, timeout, res ); exit: strfreeW( baseW ); strfreeW( filterW ); strarrayfreeW( attrsW ); #endif return ret; }
/* create a page control by hand */ static ULONG create_page_control( ULONG pagesize, struct WLDAP32_berval *cookie, UCHAR critical, PLDAPControlW *control ) { LDAPControlW *ctrl; BerElement *ber; ber_tag_t tag; struct berval *berval, null_cookie = { 0, NULL }; INT ret, len; char *val; ber = ber_alloc_t( LBER_USE_DER ); if (!ber) return WLDAP32_LDAP_NO_MEMORY; if (cookie) tag = ber_printf( ber, "{iO}", (ber_int_t)pagesize, cookie ); else tag = ber_printf( ber, "{iO}", (ber_int_t)pagesize, &null_cookie ); ret = ber_flatten( ber, &berval ); ber_free( ber, 1 ); if (tag == LBER_ERROR) return WLDAP32_LDAP_ENCODING_ERROR; if (ret == -1) return WLDAP32_LDAP_NO_MEMORY; /* copy the berval so it can be properly freed by the caller */ val = HeapAlloc( GetProcessHeap(), 0, berval->bv_len ); if (!val) return WLDAP32_LDAP_NO_MEMORY; len = berval->bv_len; memcpy( val, berval->bv_val, len ); ber_bvfree( berval ); ctrl = HeapAlloc( GetProcessHeap(), 0, sizeof(LDAPControlW) ); if (!ctrl) { HeapFree( GetProcessHeap(), 0, val ); return WLDAP32_LDAP_NO_MEMORY; } ctrl->ldctl_oid = strAtoW( LDAP_PAGED_RESULT_OID_STRING ); ctrl->ldctl_value.bv_len = len; ctrl->ldctl_value.bv_val = val; ctrl->ldctl_iscritical = critical; *control = ctrl; return WLDAP32_LDAP_SUCCESS; }
/*********************************************************************** * ldap_searchA (WLDAP32.@) * * See ldap_searchW. */ ULONG CDECL ldap_searchA( WLDAP32_LDAP *ld, PCHAR base, ULONG scope, PCHAR filter, PCHAR attrs[], ULONG attrsonly ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *baseW = NULL, *filterW = NULL, **attrsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x)\n", ld, debugstr_a(base), scope, debugstr_a(filter), attrs, attrsonly ); if (!ld) return ~0u; if (base) { baseW = strAtoW( base ); if (!baseW) goto exit; } if (filter) { filterW = strAtoW( filter ); if (!filterW) goto exit; } if (attrs) { attrsW = strarrayAtoW( attrs ); if (!attrsW) goto exit; } ret = ldap_searchW( ld, baseW, scope, filterW, attrsW, attrsonly ); exit: strfreeW( baseW ); strfreeW( filterW ); strarrayfreeW( attrsW ); #endif return ret; }
/*********************************************************************** * ldap_compareA (WLDAP32.@) * * See ldap_compareW. */ ULONG CDECL ldap_compareA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL, *attrW = NULL, *valueW = NULL; ret = ~0UL; TRACE( "(%p, %s, %s, %s)\n", ld, debugstr_a(dn), debugstr_a(attr), debugstr_a(value) ); if (!ld || !attr) return ~0UL; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } attrW = strAtoW( attr ); if (!attrW) goto exit; if (value) { valueW = strAtoW( value ); if (!valueW) goto exit; } ret = ldap_compareW( ld, dnW, attrW, valueW ); exit: strfreeW( dnW ); strfreeW( attrW ); strfreeW( valueW ); #endif return ret; }
/*********************************************************************** * ldap_extended_operation_sA (WLDAP32.@) * * See ldap_extended_operation_sW. */ ULONG CDECL ldap_extended_operation_sA( WLDAP32_LDAP *ld, PCHAR oid, struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, PCHAR *retoid, struct WLDAP32_berval **retdata ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *oidW = NULL, *retoidW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p, %p)\n", ld, debugstr_a(oid), data, serverctrls, clientctrls, retoid, retdata ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (oid) { oidW = strAtoW( oid ); if (!oidW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_extended_operation_sW( ld, oidW, data, serverctrlsW, clientctrlsW, &retoidW, retdata ); if (retoid && retoidW) { *retoid = strWtoA( retoidW ); if (!*retoid) ret = WLDAP32_LDAP_NO_MEMORY; ldap_memfreeW( retoidW ); } exit: strfreeW( oidW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_add_ext_sA (WLDAP32.@) * * See ldap_add_ext_sW. */ ULONG CDECL ldap_add_ext_sA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[], PLDAPControlA *serverctrls, PLDAPControlA *clientctrls ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; LDAPModW **attrsW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), attrs, serverctrls, clientctrls ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (attrs) { attrsW = modarrayAtoW( attrs ); if (!attrsW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_add_ext_sW( ld, dnW, attrsW, serverctrlsW, clientctrlsW ); exit: strfreeW( dnW ); modarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_modify_extA (WLDAP32.@) * * See ldap_modify_extW. */ ULONG CDECL ldap_modify_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *mods[], PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; LDAPModW **modsW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), mods, serverctrls, clientctrls, message ); if (!ld) return ~0u; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (mods) { modsW = modarrayAtoW( mods ); if (!modsW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message ); exit: strfreeW( dnW ); modarrayfreeW( modsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_check_filterA (WLDAP32.@) * * See ldap_check_filterW. */ ULONG CDECL ldap_check_filterA( WLDAP32_LDAP *ld, PCHAR filter ) { ULONG ret; WCHAR *filterW = NULL; TRACE( "(%p, %s)\n", ld, debugstr_a(filter) ); if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (filter) { filterW = strAtoW( filter ); if (!filterW) return WLDAP32_LDAP_NO_MEMORY; } ret = ldap_check_filterW( ld, filterW ); strfreeW( filterW ); return ret; }
/*********************************************************************** * ldap_explode_dnA (WLDAP32.@) * * See ldap_explode_dnW. */ PCHAR * CDECL ldap_explode_dnA( PCHAR dn, ULONG notypes ) { PCHAR *ret = NULL; #ifdef HAVE_LDAP WCHAR *dnW, **retW; TRACE( "(%s, 0x%08x)\n", debugstr_a(dn), notypes ); dnW = strAtoW( dn ); if (!dnW) return NULL; retW = ldap_explode_dnW( dnW, notypes ); ret = strarrayWtoA( retW ); strfreeW( dnW ); ldap_value_freeW( retW ); #endif return ret; }
/*********************************************************************** * ldap_dn2ufnA (WLDAP32.@) * * See ldap_dn2ufnW. */ PCHAR CDECL ldap_dn2ufnA( PCHAR dn ) { PCHAR ret = NULL; #ifdef HAVE_LDAP WCHAR *dnW, *retW; TRACE( "(%s)\n", debugstr_a(dn) ); dnW = strAtoW( dn ); if (!dnW) return NULL; retW = ldap_dn2ufnW( dnW ); ret = strWtoA( retW ); strfreeW( dnW ); ldap_memfreeW( retW ); #endif return ret; }
/*********************************************************************** * ldap_deleteA (WLDAP32.@) * * See ldap_deleteW. */ ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, PCHAR dn ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; TRACE( "(%p, %s)\n", ld, debugstr_a(dn) ); if (!ld) return ~0u; if (dn) { dnW = strAtoW( dn ); if (!dnW) return WLDAP32_LDAP_NO_MEMORY; } ret = ldap_deleteW( ld, dnW ); strfreeW( dnW ); #endif return ret; }
/*********************************************************************** * ldap_get_valuesA (WLDAP32.@) * * See ldap_get_valuesW. */ PCHAR * CDECL ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, PCHAR attr ) { PCHAR *ret = NULL; #ifdef HAVE_LDAP WCHAR *attrW = NULL, **retW; TRACE( "(%p, %p, %s)\n", ld, entry, debugstr_a(attr) ); if (!ld || !entry || !attr) return NULL; attrW = strAtoW( attr ); if (!attrW) return NULL; retW = ldap_get_valuesW( ld, entry, attrW ); ret = strarrayWtoA( retW ); ldap_value_freeW( retW ); strfreeW( attrW ); #endif return ret; }
/*********************************************************************** * ldap_delete_extA (WLDAP32.@) * * See ldap_delete_extW. */ ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, PCHAR dn, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *dnW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; TRACE( "(%p, %s, %p, %p, %p)\n", ld, debugstr_a(dn), serverctrls, clientctrls, message ); ret = WLDAP32_LDAP_NO_MEMORY; if (!ld) return WLDAP32_LDAP_PARAM_ERROR; if (dn) { dnW = strAtoW( dn ); if (!dnW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message ); exit: strfreeW( dnW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_extended_operationA (WLDAP32.@) * * See ldap_extended_operationW. */ ULONG CDECL ldap_extended_operationA( WLDAP32_LDAP *ld, PCHAR oid, struct WLDAP32_berval *data, PLDAPControlA *serverctrls, PLDAPControlA *clientctrls, ULONG *message ) { ULONG ret = WLDAP32_LDAP_NOT_SUPPORTED; #ifdef HAVE_LDAP WCHAR *oidW = NULL; LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL; ret = WLDAP32_LDAP_NO_MEMORY; TRACE( "(%p, %s, %p, %p, %p, %p)\n", ld, debugstr_a(oid), data, serverctrls, clientctrls, message ); if (!ld || !message) return WLDAP32_LDAP_PARAM_ERROR; if (oid) { oidW = strAtoW( oid ); if (!oidW) goto exit; } if (serverctrls) { serverctrlsW = controlarrayAtoW( serverctrls ); if (!serverctrlsW) goto exit; } if (clientctrls) { clientctrlsW = controlarrayAtoW( clientctrls ); if (!clientctrlsW) goto exit; } ret = ldap_extended_operationW( ld, oidW, data, serverctrlsW, clientctrlsW, message ); exit: strfreeW( oidW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); #endif return ret; }
/*********************************************************************** * ldap_get_values_lenA (WLDAP32.@) * * See ldap_get_values_lenW. */ struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *message, PCHAR attr ) { #ifdef HAVE_LDAP WCHAR *attrW = NULL; struct WLDAP32_berval **ret; TRACE( "(%p, %p, %s)\n", ld, message, debugstr_a(attr) ); if (!ld || !message || !attr) return NULL; attrW = strAtoW( attr ); if (!attrW) return NULL; ret = ldap_get_values_lenW( ld, message, attrW ); strfreeW( attrW ); return ret; #else return NULL; #endif }
/*********************************************************************** * ldap_get_optionA (WLDAP32.@) * * See ldap_get_optionW. */ ULONG CDECL ldap_get_optionA( 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 || !value) return WLDAP32_LDAP_PARAM_ERROR; switch (option) { case WLDAP32_LDAP_OPT_API_FEATURE_INFO: { LDAPAPIFeatureInfoW featureW; LDAPAPIFeatureInfoA *featureA = value; if (!featureA->ldapaif_name) return WLDAP32_LDAP_PARAM_ERROR; featureW.ldapaif_info_version = featureA->ldapaif_info_version; featureW.ldapaif_name = strAtoW( featureA->ldapaif_name ); featureW.ldapaif_version = 0; if (!featureW.ldapaif_name) return WLDAP32_LDAP_NO_MEMORY; ret = ldap_get_optionW( ld, option, &featureW ); featureA->ldapaif_version = featureW.ldapaif_version; strfreeW( featureW.ldapaif_name ); return ret; } case WLDAP32_LDAP_OPT_API_INFO: { LDAPAPIInfoW infoW; LDAPAPIInfoA *infoA = value; memset( &infoW, 0, sizeof(LDAPAPIInfoW) ); infoW.ldapai_info_version = infoA->ldapai_info_version; ret = ldap_get_optionW( ld, option, &infoW ); infoA->ldapai_api_version = infoW.ldapai_api_version; infoA->ldapai_protocol_version = infoW.ldapai_protocol_version; if (infoW.ldapai_extensions) { infoA->ldapai_extensions = strarrayWtoA( infoW.ldapai_extensions ); if (!infoA->ldapai_extensions) return WLDAP32_LDAP_NO_MEMORY; } if (infoW.ldapai_vendor_name) { infoA->ldapai_vendor_name = strWtoA( infoW.ldapai_vendor_name ); if (!infoA->ldapai_vendor_name) { ldap_value_freeW( infoW.ldapai_extensions ); return WLDAP32_LDAP_NO_MEMORY; } } infoA->ldapai_vendor_version = infoW.ldapai_vendor_version; ldap_value_freeW( infoW.ldapai_extensions ); ldap_memfreeW( infoW.ldapai_vendor_name ); 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 ldap_get_optionW( 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 LDAP_LOCAL_ERROR; 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_CONTROLS: 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; }