mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Improve error handling for the bind functions.
This commit is contained in:
parent
40ac6ee641
commit
aea0ad9172
@ -45,18 +45,25 @@ ULONG ldap_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *credW;
|
WCHAR *dnW = NULL, *credW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_a(dn), cred, method );
|
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_a(dn), cred, method );
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
if (!ld) return ~0UL;
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
credW = strAtoW( cred );
|
if (dn) {
|
||||||
if (!credW) return LDAP_NO_MEMORY;
|
dnW = strAtoW( dn );
|
||||||
|
if (!dnW) goto exit;
|
||||||
|
}
|
||||||
|
if (cred) {
|
||||||
|
credW = strAtoW( cred );
|
||||||
|
if (!credW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_bindW( ld, dnW, credW, method );
|
ret = ldap_bindW( ld, dnW, credW, method );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( credW );
|
strfreeW( credW );
|
||||||
|
|
||||||
@ -68,18 +75,25 @@ ULONG ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *credU;
|
char *dnU = NULL, *credU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_w(dn), cred, method );
|
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_w(dn), cred, method );
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
if (!ld) return ~0UL;
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
credU = strWtoU( cred );
|
if (dn) {
|
||||||
if (!credU) return LDAP_NO_MEMORY;
|
dnU = strWtoU( dn );
|
||||||
|
if (!dnU) goto exit;
|
||||||
|
}
|
||||||
|
if (cred) {
|
||||||
|
credU = strWtoU( cred );
|
||||||
|
if (!credU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_bind( ld, dnU, credU, method );
|
ret = ldap_bind( ld, dnU, credU, method );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( credU );
|
strfreeU( credU );
|
||||||
|
|
||||||
@ -91,18 +105,25 @@ ULONG ldap_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR cred, ULONG method )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *credW;
|
WCHAR *dnW = NULL, *credW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_a(dn), cred, method );
|
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_a(dn), cred, method );
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
credW = strAtoW( cred );
|
if (dn) {
|
||||||
if (!credW) return LDAP_NO_MEMORY;
|
dnW = strAtoW( dn );
|
||||||
|
if (!dnW) goto exit;
|
||||||
|
}
|
||||||
|
if (cred) {
|
||||||
|
credW = strAtoW( cred );
|
||||||
|
if (!credW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_bind_sW( ld, dnW, credW, method );
|
ret = ldap_bind_sW( ld, dnW, credW, method );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( credW );
|
strfreeW( credW );
|
||||||
|
|
||||||
@ -114,18 +135,25 @@ ULONG ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *credU;
|
char *dnU = NULL, *credU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_w(dn), cred, method );
|
TRACE( "(%p, %s, %p, 0x%08lx)\n", ld, debugstr_w(dn), cred, method );
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
credU = strWtoU( cred );
|
if (dn) {
|
||||||
if (!credU) return LDAP_NO_MEMORY;
|
dnU = strWtoU( dn );
|
||||||
|
if (!dnU) goto exit;
|
||||||
|
}
|
||||||
|
if (cred) {
|
||||||
|
credU = strWtoU( cred );
|
||||||
|
if (!credU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_bind_s( ld, dnU, credU, method );
|
ret = ldap_bind_s( ld, dnU, credU, method );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( credU );
|
strfreeU( credU );
|
||||||
|
|
||||||
@ -139,26 +167,34 @@ ULONG ldap_sasl_bindA( WLDAP32_LDAP *ld, const PCHAR dn,
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *mechanismW;
|
WCHAR *dnW, *mechanismW = NULL;
|
||||||
LDAPControlW **serverctrlsW, **clientctrlsW;
|
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
|
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
|
||||||
debugstr_a(mechanism), cred, serverctrls, clientctrls, message );
|
debugstr_a(mechanism), cred, serverctrls, clientctrls, message );
|
||||||
|
|
||||||
|
if (!ld || !dn || !mechanism || !cred || !message)
|
||||||
|
return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
dnW = strAtoW( dn );
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
if (!dnW) goto exit;
|
||||||
|
|
||||||
mechanismW = strAtoW( mechanism );
|
mechanismW = strAtoW( mechanism );
|
||||||
if (!mechanismW) return LDAP_NO_MEMORY;
|
if (!mechanismW) goto exit;
|
||||||
|
|
||||||
serverctrlsW = controlarrayAtoW( serverctrls );
|
if (serverctrls) {
|
||||||
if (!serverctrlsW) return LDAP_NO_MEMORY;
|
serverctrlsW = controlarrayAtoW( serverctrls );
|
||||||
|
if (!serverctrlsW) goto exit;
|
||||||
clientctrlsW = controlarrayAtoW( clientctrls );
|
}
|
||||||
if (!clientctrlsW) return LDAP_NO_MEMORY;
|
if (clientctrls) {
|
||||||
|
clientctrlsW = controlarrayAtoW( clientctrls );
|
||||||
|
if (!clientctrlsW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message );
|
ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( mechanismW );
|
strfreeW( mechanismW );
|
||||||
controlarrayfreeW( serverctrlsW );
|
controlarrayfreeW( serverctrlsW );
|
||||||
@ -174,27 +210,35 @@ ULONG ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn,
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *mechanismU;
|
char *dnU, *mechanismU = NULL;
|
||||||
LDAPControl **serverctrlsU, **clientctrlsU;
|
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
|
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
|
||||||
debugstr_w(mechanism), cred, serverctrls, clientctrls, message );
|
debugstr_w(mechanism), cred, serverctrls, clientctrls, message );
|
||||||
|
|
||||||
|
if (!ld || !dn || !mechanism || !cred || !message)
|
||||||
|
return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
dnU = strWtoU( dn );
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
if (!dnU) goto exit;
|
||||||
|
|
||||||
mechanismU = strWtoU( mechanism );
|
mechanismU = strWtoU( mechanism );
|
||||||
if (!mechanismU) return LDAP_NO_MEMORY;
|
if (!mechanismU) goto exit;
|
||||||
|
|
||||||
serverctrlsU = controlarrayWtoU( serverctrls );
|
if (serverctrls) {
|
||||||
if (!serverctrlsU) return LDAP_NO_MEMORY;
|
serverctrlsU = controlarrayWtoU( serverctrls );
|
||||||
|
if (!serverctrlsU) goto exit;
|
||||||
clientctrlsU = controlarrayWtoU( clientctrls );
|
}
|
||||||
if (!clientctrlsU) return LDAP_NO_MEMORY;
|
if (clientctrls) {
|
||||||
|
clientctrlsU = controlarrayWtoU( clientctrls );
|
||||||
|
if (!clientctrlsU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_sasl_bind( ld, dnU, mechanismU, (struct berval *)cred,
|
ret = ldap_sasl_bind( ld, dnU, mechanismU, (struct berval *)cred,
|
||||||
serverctrlsU, clientctrlsU, message );
|
serverctrlsU, clientctrlsU, message );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( mechanismU );
|
strfreeU( mechanismU );
|
||||||
controlarrayfreeU( serverctrlsU );
|
controlarrayfreeU( serverctrlsU );
|
||||||
@ -210,26 +254,34 @@ ULONG ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn,
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *mechanismW;
|
WCHAR *dnW, *mechanismW = NULL;
|
||||||
LDAPControlW **serverctrlsW, **clientctrlsW;
|
LDAPControlW **serverctrlsW = NULL, **clientctrlsW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
|
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_a(dn),
|
||||||
debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata );
|
debugstr_a(mechanism), cred, serverctrls, clientctrls, serverdata );
|
||||||
|
|
||||||
|
if (!ld || !dn || !mechanism || !cred || !serverdata)
|
||||||
|
return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
dnW = strAtoW( dn );
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
if (!dnW) goto exit;
|
||||||
|
|
||||||
mechanismW = strAtoW( mechanism );
|
mechanismW = strAtoW( mechanism );
|
||||||
if (!mechanismW) return LDAP_NO_MEMORY;
|
if (!mechanismW) goto exit;
|
||||||
|
|
||||||
serverctrlsW = controlarrayAtoW( serverctrls );
|
if (serverctrls) {
|
||||||
if (!serverctrlsW) return LDAP_NO_MEMORY;
|
serverctrlsW = controlarrayAtoW( serverctrls );
|
||||||
|
if (!serverctrlsW) goto exit;
|
||||||
clientctrlsW = controlarrayAtoW( clientctrls );
|
}
|
||||||
if (!clientctrlsW) return LDAP_NO_MEMORY;
|
if (clientctrls) {
|
||||||
|
clientctrlsW = controlarrayAtoW( clientctrls );
|
||||||
|
if (!clientctrlsW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata );
|
ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( mechanismW );
|
strfreeW( mechanismW );
|
||||||
controlarrayfreeW( serverctrlsW );
|
controlarrayfreeW( serverctrlsW );
|
||||||
@ -245,27 +297,35 @@ ULONG ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn,
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *mechanismU;
|
char *dnU, *mechanismU = NULL;
|
||||||
LDAPControl **serverctrlsU, **clientctrlsU;
|
LDAPControl **serverctrlsU = NULL, **clientctrlsU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
|
TRACE( "(%p, %s, %s, %p, %p, %p, %p)\n", ld, debugstr_w(dn),
|
||||||
debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata );
|
debugstr_w(mechanism), cred, serverctrls, clientctrls, serverdata );
|
||||||
|
|
||||||
|
if (!ld || !dn || !mechanism || !cred || !serverdata)
|
||||||
|
return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
dnU = strWtoU( dn );
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
if (!dnU) goto exit;
|
||||||
|
|
||||||
mechanismU = strWtoU( mechanism );
|
mechanismU = strWtoU( mechanism );
|
||||||
if (!mechanismU) return LDAP_NO_MEMORY;
|
if (!mechanismU) goto exit;
|
||||||
|
|
||||||
serverctrlsU = controlarrayWtoU( serverctrls );
|
if (serverctrls) {
|
||||||
if (!serverctrlsU) return LDAP_NO_MEMORY;
|
serverctrlsU = controlarrayWtoU( serverctrls );
|
||||||
|
if (!serverctrlsU) goto exit;
|
||||||
clientctrlsU = controlarrayWtoU( clientctrls );
|
}
|
||||||
if (!clientctrlsU) return LDAP_NO_MEMORY;
|
if (clientctrls) {
|
||||||
|
clientctrlsU = controlarrayWtoU( clientctrls );
|
||||||
|
if (!clientctrlsU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_sasl_bind_s( ld, dnU, mechanismU, (struct berval *)cred,
|
ret = ldap_sasl_bind_s( ld, dnU, mechanismU, (struct berval *)cred,
|
||||||
serverctrlsU, clientctrlsU, (struct berval **)serverdata );
|
serverctrlsU, clientctrlsU, (struct berval **)serverdata );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( mechanismU );
|
strfreeU( mechanismU );
|
||||||
controlarrayfreeU( serverctrlsU );
|
controlarrayfreeU( serverctrlsU );
|
||||||
@ -279,18 +339,25 @@ ULONG ldap_simple_bindA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *passwdW;
|
WCHAR *dnW = NULL, *passwdW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
|
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
if (!ld) return ~0UL;
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
passwdW = strAtoW( passwd );
|
if (dn) {
|
||||||
if (!passwdW) return LDAP_NO_MEMORY;
|
dnW = strAtoW( dn );
|
||||||
|
if (!dnW) goto exit;
|
||||||
|
}
|
||||||
|
if (passwd) {
|
||||||
|
passwdW = strAtoW( passwd );
|
||||||
|
if (!passwdW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_simple_bindW( ld, dnW, passwdW );
|
ret = ldap_simple_bindW( ld, dnW, passwdW );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( passwdW );
|
strfreeW( passwdW );
|
||||||
|
|
||||||
@ -302,18 +369,25 @@ ULONG ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *passwdU;
|
char *dnU = NULL, *passwdU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
|
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
if (!ld) return ~0UL;
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
passwdU = strWtoU( passwd );
|
if (dn) {
|
||||||
if (!passwdU) return LDAP_NO_MEMORY;
|
dnU = strWtoU( dn );
|
||||||
|
if (!dnU) goto exit;
|
||||||
|
}
|
||||||
|
if (passwd) {
|
||||||
|
passwdU = strWtoU( passwd );
|
||||||
|
if (!passwdU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_simple_bind( ld, dnU, passwdU );
|
ret = ldap_simple_bind( ld, dnU, passwdU );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( passwdU );
|
strfreeU( passwdU );
|
||||||
|
|
||||||
@ -325,18 +399,25 @@ ULONG ldap_simple_bind_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR passwd )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
WCHAR *dnW, *passwdW;
|
WCHAR *dnW = NULL, *passwdW = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
|
TRACE( "(%p, %s, %p)\n", ld, debugstr_a(dn), passwd );
|
||||||
|
|
||||||
dnW = strAtoW( dn );
|
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
if (!dnW) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
passwdW = strAtoW( passwd );
|
if (dn) {
|
||||||
if (!passwdW) return LDAP_NO_MEMORY;
|
dnW = strAtoW( dn );
|
||||||
|
if (!dnW) goto exit;
|
||||||
|
}
|
||||||
|
if (passwd) {
|
||||||
|
passwdW = strAtoW( passwd );
|
||||||
|
if (!passwdW) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_simple_bind_sW( ld, dnW, passwdW );
|
ret = ldap_simple_bind_sW( ld, dnW, passwdW );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeW( dnW );
|
strfreeW( dnW );
|
||||||
strfreeW( passwdW );
|
strfreeW( passwdW );
|
||||||
|
|
||||||
@ -348,18 +429,25 @@ ULONG ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
|
|||||||
{
|
{
|
||||||
ULONG ret = LDAP_NOT_SUPPORTED;
|
ULONG ret = LDAP_NOT_SUPPORTED;
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
char *dnU, *passwdU;
|
char *dnU = NULL, *passwdU = NULL;
|
||||||
|
ret = LDAP_NO_MEMORY;
|
||||||
|
|
||||||
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
|
TRACE( "(%p, %s, %p)\n", ld, debugstr_w(dn), passwd );
|
||||||
|
|
||||||
dnU = strWtoU( dn );
|
if (!ld) return WLDAP32_LDAP_PARAM_ERROR;
|
||||||
if (!dnU) return LDAP_NO_MEMORY;
|
|
||||||
|
|
||||||
passwdU = strWtoU( passwd );
|
if (dn) {
|
||||||
if (!passwdU) return LDAP_NO_MEMORY;
|
dnU = strWtoU( dn );
|
||||||
|
if (!dnU) goto exit;
|
||||||
|
}
|
||||||
|
if (passwd) {
|
||||||
|
passwdU = strWtoU( passwd );
|
||||||
|
if (!passwdU) goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ldap_simple_bind_s( ld, dnU, passwdU );
|
ret = ldap_simple_bind_s( ld, dnU, passwdU );
|
||||||
|
|
||||||
|
exit:
|
||||||
strfreeU( dnU );
|
strfreeU( dnU );
|
||||||
strfreeU( passwdU );
|
strfreeU( passwdU );
|
||||||
|
|
||||||
@ -373,7 +461,11 @@ ULONG WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
|
|||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
|
|
||||||
TRACE( "(%p)\n", ld );
|
TRACE( "(%p)\n", ld );
|
||||||
ret = ldap_unbind( ld );
|
|
||||||
|
if (ld)
|
||||||
|
ret = ldap_unbind( ld );
|
||||||
|
else
|
||||||
|
ret = WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@ -385,7 +477,11 @@ ULONG WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
|
|||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
|
|
||||||
TRACE( "(%p)\n", ld );
|
TRACE( "(%p)\n", ld );
|
||||||
ret = ldap_unbind_s( ld );
|
|
||||||
|
if (ld)
|
||||||
|
ret = ldap_unbind_s( ld );
|
||||||
|
else
|
||||||
|
ret = WLDAP32_LDAP_PARAM_ERROR;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -22,6 +22,27 @@
|
|||||||
* native headers.
|
* native headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
WLDAP32_LDAP_SERVER_DOWN = 0x51,
|
||||||
|
WLDAP32_LDAP_LOCAL_ERROR = 0x52,
|
||||||
|
WLDAP32_LDAP_ENCODING_ERROR = 0x53,
|
||||||
|
WLDAP32_LDAP_DECODING_ERROR = 0x54,
|
||||||
|
WLDAP32_LDAP_TIMEOUT = 0x55,
|
||||||
|
WLDAP32_LDAP_AUTH_UNKNOWN = 0x56,
|
||||||
|
WLDAP32_LDAP_FILTER_ERROR = 0x57,
|
||||||
|
WLDAP32_LDAP_USER_CANCELLED = 0x58,
|
||||||
|
WLDAP32_LDAP_PARAM_ERROR = 0x59,
|
||||||
|
WLDAP32_LDAP_NO_MEMORY = 0x5a,
|
||||||
|
WLDAP32_LDAP_CONNECT_ERROR = 0x5b,
|
||||||
|
WLDAP32_LDAP_NOT_SUPPORTED = 0x5c,
|
||||||
|
WLDAP32_LDAP_NO_RESULTS_RETURNED = 0x5e,
|
||||||
|
WLDAP32_LDAP_CONTROL_NOT_FOUND = 0x5d,
|
||||||
|
WLDAP32_LDAP_MORE_RESULTS_TO_RETURN = 0x5f,
|
||||||
|
|
||||||
|
WLDAP32_LDAP_CLIENT_LOOP = 0x60,
|
||||||
|
WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED = 0x61
|
||||||
|
} LDAP_RETCODE;
|
||||||
|
|
||||||
typedef struct ldap
|
typedef struct ldap
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
Loading…
Reference in New Issue
Block a user