From d5ebfb545664b46a25a9ce11d67f8bf272002a74 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 20 Jul 2005 17:47:53 +0000 Subject: [PATCH] Implement ldap_simple_bind* and ldap_unbind* functions. --- dlls/wldap32/bind.c | 116 +++++++++++++++++++++++++++++++++++++++++ dlls/wldap32/winldap_private.h | 6 +++ dlls/wldap32/wldap32.spec | 8 +++ 3 files changed, 130 insertions(+) diff --git a/dlls/wldap32/bind.c b/dlls/wldap32/bind.c index a2b65bd8f88..d9ad8e68d40 100644 --- a/dlls/wldap32/bind.c +++ b/dlls/wldap32/bind.c @@ -132,3 +132,119 @@ ULONG ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method ) #endif return ret; } + +ULONG ldap_simple_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + WCHAR *dnW, *passwdW; + + TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd ); + + dnW = strAtoW( dn ); + if (!dnW) return LDAP_NO_MEMORY; + + passwdW = strAtoW( passwd ); + if (!passwdW) return LDAP_NO_MEMORY; + + ret = ldap_simple_bindW( ld, dnW, passwdW ); + + strfreeW( dnW ); + strfreeW( passwdW ); + +#endif + return ret; +} + +ULONG ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + char *dnU, *passwdU; + + TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd ); + + dnU = strWtoU( dn ); + if (!dnU) return LDAP_NO_MEMORY; + + passwdU = strWtoU( passwd ); + if (!passwdU) return LDAP_NO_MEMORY; + + ret = ldap_simple_bind( ld, dnU, passwdU ); + + strfreeU( dnU ); + strfreeU( passwdU ); + +#endif + return ret; +} + +ULONG ldap_simple_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + WCHAR *dnW, *passwdW; + + TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd ); + + dnW = strAtoW( dn ); + if (!dnW) return LDAP_NO_MEMORY; + + passwdW = strAtoW( passwd ); + if (!passwdW) return LDAP_NO_MEMORY; + + ret = ldap_simple_bind_sW( ld, dnW, passwdW ); + + strfreeW( dnW ); + strfreeW( passwdW ); + +#endif + return ret; +} + +ULONG ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + char *dnU, *passwdU; + + TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd ); + + dnU = strWtoU( dn ); + if (!dnU) return LDAP_NO_MEMORY; + + passwdU = strWtoU( passwd ); + if (!passwdU) return LDAP_NO_MEMORY; + + ret = ldap_simple_bind_s( ld, dnU, passwdU ); + + strfreeU( dnU ); + strfreeU( passwdU ); + +#endif + return ret; +} + +ULONG WLDAP32_ldap_unbind( WLDAP32_LDAP *ld ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + + TRACE( "(%p)\n", ld ); + ret = ldap_unbind( ld ); + +#endif + return ret; +} + +ULONG WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld ) +{ + ULONG ret = LDAP_NOT_SUPPORTED; +#ifdef HAVE_LDAP + + TRACE( "(%p)\n", ld ); + ret = ldap_unbind_s( ld ); + +#endif + return ret; +} diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h index 7f9d49d03ef..aeb3eab0abd 100644 --- a/dlls/wldap32/winldap_private.h +++ b/dlls/wldap32/winldap_private.h @@ -53,6 +53,12 @@ ULONG ldap_bindA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG); ULONG ldap_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG); ULONG ldap_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG); ULONG ldap_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG); +ULONG ldap_simple_bindA(WLDAP32_LDAP*,PCHAR,PCHAR); +ULONG ldap_simple_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR); +ULONG ldap_simple_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR); +ULONG ldap_simple_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR); +ULONG WLDAP32_ldap_unbind(WLDAP32_LDAP*); +ULONG WLDAP32_ldap_unbind_s(WLDAP32_LDAP*); ULONG LdapGetLastError(void); ULONG LdapMapErrorToWin32(ULONG); diff --git a/dlls/wldap32/wldap32.spec b/dlls/wldap32/wldap32.spec index 1d7eb520d61..82fe8560e44 100644 --- a/dlls/wldap32/wldap32.spec +++ b/dlls/wldap32/wldap32.spec @@ -22,3 +22,11 @@ @ stub ldap_open @ stub ldap_openA @ stub ldap_openW +@ cdecl ldap_simple_bind(ptr str str) ldap_simple_bindA +@ cdecl ldap_simple_bindA(ptr str str) +@ cdecl ldap_simple_bindW(ptr wstr wstr) +@ cdecl ldap_simple_bind_s(ptr str str) ldap_simple_bind_sA +@ cdecl ldap_simple_bind_sA(ptr str str) +@ cdecl ldap_simple_bind_sW(ptr wstr wstr) +@ cdecl ldap_unbind(ptr) WLDAP32_ldap_unbind +@ cdecl ldap_unbind_s(ptr) WLDAP32_ldap_unbind_s -- 2.11.4.GIT