From be5bf8022d98309659818b75ebdefdecd86a2f3d Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Sun, 24 Jul 2005 17:10:46 +0000 Subject: [PATCH] Implement ldap_sasl_bind* functions. --- dlls/wldap32/bind.c | 142 +++++++++++++++++++++++++++++++++++++++++ dlls/wldap32/winldap_private.h | 4 ++ dlls/wldap32/wldap32.spec | 4 ++ 3 files changed, 150 insertions(+) diff --git a/dlls/wldap32/bind.c b/dlls/wldap32/bind.c index d9ad8e68d40..4605ba304d7 100644 --- a/dlls/wldap32/bind.c +++ b/dlls/wldap32/bind.c @@ -133,6 +133,148 @@ ULONG ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method ) return ret; } +ULONG ldap_sasl_bindA( WLDAP32_LDAP *ld, const PCHAR dn, + const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls, + PLDAPControlA *clientctrls, int *message ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + WCHAR *dnW, *mechanismW; + LDAPControlW **serverctrlsW, **clientctrlsW; + + TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), + debugstr_a(mechanism), cred, serverctrls, clientctrls, message ); + + dnW = strAtoW( dn ); + if (!dnW) return LDAP_NO_MEMORY; + + mechanismW = strAtoW( mechanism ); + if (!mechanismW) return LDAP_NO_MEMORY; + + serverctrlsW = controlarrayAtoW( serverctrls ); + if (!serverctrlsW) return LDAP_NO_MEMORY; + + clientctrlsW = controlarrayAtoW( clientctrls ); + if (!clientctrlsW) return LDAP_NO_MEMORY; + + ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message ); + + strfreeW( dnW ); + strfreeW( mechanismW ); + controlarrayfreeW( serverctrlsW ); + controlarrayfreeW( clientctrlsW ); + +#endif + return ret; +} + +ULONG 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; + LDAPControl **serverctrlsU, **clientctrlsU; + + TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), + debugstr_w(mechanism), cred, serverctrls, clientctrls, message ); + + dnU = strWtoU( dn ); + if (!dnU) return LDAP_NO_MEMORY; + + mechanismU = strWtoU( mechanism ); + if (!mechanismU) return LDAP_NO_MEMORY; + + serverctrlsU = controlarrayWtoU( serverctrls ); + if (!serverctrlsU) return LDAP_NO_MEMORY; + + clientctrlsU = controlarrayWtoU( clientctrls ); + if (!clientctrlsU) return LDAP_NO_MEMORY; + + ret = ldap_sasl_bind( ld, dnU, mechanismU, (struct berval *)cred, + serverctrlsU, clientctrlsU, message ); + + strfreeU( dnU ); + strfreeU( mechanismU ); + controlarrayfreeU( serverctrlsU ); + controlarrayfreeU( clientctrlsU ); + +#endif + return ret; +} + +ULONG ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn, + const PCHAR mechanism, const BERVAL *cred, PLDAPControlA *serverctrls, + PLDAPControlA *clientctrls, PBERVAL *serverdata ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + WCHAR *dnW, *mechanismW; + LDAPControlW **serverctrlsW, **clientctrlsW; + + TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn), + debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata ); + + dnW = strAtoW( dn ); + if (!dnW) return LDAP_NO_MEMORY; + + mechanismW = strAtoW( mechanism ); + if (!mechanismW) return LDAP_NO_MEMORY; + + serverctrlsW = controlarrayAtoW( serverctrls ); + if (!serverctrlsW) return LDAP_NO_MEMORY; + + clientctrlsW = controlarrayAtoW( clientctrls ); + if (!clientctrlsW) return LDAP_NO_MEMORY; + + ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata ); + + strfreeW( dnW ); + strfreeW( mechanismW ); + controlarrayfreeW( serverctrlsW ); + controlarrayfreeW( clientctrlsW ); + +#endif + return ret; +} + +ULONG ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn, + const PWCHAR mechanism, const BERVAL *cred, PLDAPControlW *serverctrls, + PLDAPControlW *clientctrls, PBERVAL *serverdata ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + char *dnU, *mechanismU; + LDAPControl **serverctrlsU, **clientctrlsU; + + TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn), + debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata ); + + dnU = strWtoU( dn ); + if (!dnU) return LDAP_NO_MEMORY; + + mechanismU = strWtoU( mechanism ); + if (!mechanismU) return LDAP_NO_MEMORY; + + serverctrlsU = controlarrayWtoU( serverctrls ); + if (!serverctrlsU) return LDAP_NO_MEMORY; + + clientctrlsU = controlarrayWtoU( clientctrls ); + if (!clientctrlsU) return LDAP_NO_MEMORY; + + ret = ldap_sasl_bind_s( ld, dnU, mechanismU, (struct berval *)cred, + serverctrlsU, clientctrlsU, (struct berval **)serverdata ); + + strfreeU( dnU ); + strfreeU( mechanismU ); + controlarrayfreeU( serverctrlsU ); + controlarrayfreeU( clientctrlsU ); + +#endif + return ret; +} + ULONG ldap_simple_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd ) { ULONG ret = LDAP_NOT_SUPPORTED; diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h index 22ba779714e..16e14dde8e4 100644 --- a/dlls/wldap32/winldap_private.h +++ b/dlls/wldap32/winldap_private.h @@ -103,6 +103,10 @@ WLDAP32_LDAP *ldap_initA(const PCHAR,ULONG); WLDAP32_LDAP *ldap_initW(const PWCHAR,ULONG); WLDAP32_LDAP *ldap_openA(PCHAR,ULONG); WLDAP32_LDAP *ldap_openW(PWCHAR,ULONG); +ULONG ldap_sasl_bindA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,int*); +ULONG ldap_sasl_bindW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,int*); +ULONG ldap_sasl_bind_sA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,PBERVAL*); +ULONG ldap_sasl_bind_sW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,PBERVAL*); ULONG ldap_searchA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG); ULONG ldap_searchW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG); ULONG ldap_search_sA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,WLDAP32_LDAPMessage**); diff --git a/dlls/wldap32/wldap32.spec b/dlls/wldap32/wldap32.spec index d674272df1a..3baf714f491 100644 --- a/dlls/wldap32/wldap32.spec +++ b/dlls/wldap32/wldap32.spec @@ -25,6 +25,10 @@ @ cdecl ldap_open(str long) ldap_openA @ cdecl ldap_openA(str long) @ cdecl ldap_openW(wstr long) +@ cdecl ldap_sasl_bindA(ptr str str ptr ptr ptr ptr) +@ cdecl ldap_sasl_bindW(ptr wstr wstr ptr ptr ptr ptr) +@ cdecl ldap_sasl_bind_sA(ptr str str ptr ptr ptr ptr) +@ cdecl ldap_sasl_bind_sW(ptr wstr wstr ptr ptr ptr ptr) @ cdecl ldap_search(ptr str long str ptr long) ldap_searchA @ cdecl ldap_searchA(ptr str long str ptr long) @ cdecl ldap_searchW(ptr wstr long wstr ptr long) -- 2.11.4.GIT