wldap32: Move the SASL callback to the Unix side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2173d2dcc8
commit
449fae545c
|
@ -138,38 +138,6 @@ exit:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CDECL sasl_interact_cb( void *ld, unsigned flags, void *defaults, void *interact )
|
|
||||||
{
|
|
||||||
SEC_WINNT_AUTH_IDENTITY_A *id = defaults;
|
|
||||||
struct sasl_interactU *sasl = interact;
|
|
||||||
|
|
||||||
TRACE( "(%p, 0x%08x, %p, %p)\n", ld, flags, defaults, interact );
|
|
||||||
|
|
||||||
while (sasl->id != SASL_CB_LIST_END)
|
|
||||||
{
|
|
||||||
TRACE( "sasl->id = %04lx\n", sasl->id );
|
|
||||||
|
|
||||||
if (sasl->id == SASL_CB_GETREALM)
|
|
||||||
{
|
|
||||||
sasl->result = id->Domain;
|
|
||||||
sasl->len = id->DomainLength;
|
|
||||||
}
|
|
||||||
else if (sasl->id == SASL_CB_USER)
|
|
||||||
{
|
|
||||||
sasl->result = id->User;
|
|
||||||
sasl->len = id->UserLength;
|
|
||||||
}
|
|
||||||
else if (sasl->id == SASL_CB_PASS)
|
|
||||||
{
|
|
||||||
sasl->result = id->Password;
|
|
||||||
sasl->len = id->PasswordLength;
|
|
||||||
}
|
|
||||||
sasl++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LDAP_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ldap_bind_sW (WLDAP32.@)
|
* ldap_bind_sW (WLDAP32.@)
|
||||||
*
|
*
|
||||||
|
|
|
@ -59,8 +59,6 @@ C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
|
||||||
|
|
||||||
static LDAPMod *nullmods[] = { NULL };
|
static LDAPMod *nullmods[] = { NULL };
|
||||||
|
|
||||||
static const struct ldap_callbacks *callbacks;
|
|
||||||
|
|
||||||
static void * CDECL wrap_ber_alloc_t( int options )
|
static void * CDECL wrap_ber_alloc_t( int options )
|
||||||
{
|
{
|
||||||
return ber_alloc_t( options );
|
return ber_alloc_t( options );
|
||||||
|
@ -553,8 +551,34 @@ static int CDECL wrap_ldap_sasl_bind_s( void *ld, const char *dn, const char *me
|
||||||
static int wrap_sasl_interact( LDAP *ld, unsigned int flags, void *defaults, void *interact )
|
static int wrap_sasl_interact( LDAP *ld, unsigned int flags, void *defaults, void *interact )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SASL_SASL_H
|
#ifdef HAVE_SASL_SASL_H
|
||||||
C_ASSERT( sizeof(struct sasl_interactU) == sizeof(struct sasl_interact) );
|
struct sasl_interactive_bind_id *id = defaults;
|
||||||
return callbacks->sasl_interact( ld, flags, defaults, interact );
|
struct sasl_interact *sasl = interact;
|
||||||
|
|
||||||
|
TRACE( "(%p, 0x%08x, %p, %p)\n", ld, flags, defaults, interact );
|
||||||
|
|
||||||
|
while (sasl->id != SASL_CB_LIST_END)
|
||||||
|
{
|
||||||
|
TRACE( "sasl->id = %04lx\n", sasl->id );
|
||||||
|
|
||||||
|
if (sasl->id == SASL_CB_GETREALM)
|
||||||
|
{
|
||||||
|
sasl->result = id->domain;
|
||||||
|
sasl->len = id->domain_len;
|
||||||
|
}
|
||||||
|
else if (sasl->id == SASL_CB_USER)
|
||||||
|
{
|
||||||
|
sasl->result = id->user;
|
||||||
|
sasl->len = id->user_len;
|
||||||
|
}
|
||||||
|
else if (sasl->id == SASL_CB_PASS)
|
||||||
|
{
|
||||||
|
sasl->result = id->password;
|
||||||
|
sasl->len = id->password_len;
|
||||||
|
}
|
||||||
|
sasl++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LDAP_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +702,6 @@ static const struct ldap_funcs funcs =
|
||||||
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
||||||
{
|
{
|
||||||
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
|
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
|
||||||
callbacks = ptr_in;
|
|
||||||
*(const struct ldap_funcs **)ptr_out = &funcs;
|
*(const struct ldap_funcs **)ptr_out = &funcs;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,22 +83,15 @@ typedef struct timevalU
|
||||||
LONG_PTR tv_usec;
|
LONG_PTR tv_usec;
|
||||||
} LDAP_TIMEVALU;
|
} LDAP_TIMEVALU;
|
||||||
|
|
||||||
#ifndef SASL_CB_LIST_END
|
struct sasl_interactive_bind_id
|
||||||
#define SASL_CB_LIST_END 0
|
|
||||||
#define SASL_CB_USER 0x4001
|
|
||||||
#define SASL_CB_PASS 0x4004
|
|
||||||
#define SASL_CB_GETREALM 0x4008
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct sasl_interactU
|
|
||||||
{
|
{
|
||||||
ULONG_PTR id;
|
unsigned char* user;
|
||||||
const char *challenge;
|
ULONG user_len;
|
||||||
const char *prompt;
|
unsigned char* domain;
|
||||||
const char *defresult;
|
ULONG domain_len;
|
||||||
const void *result;
|
unsigned char* password;
|
||||||
unsigned int len;
|
ULONG password_len;
|
||||||
} sasl_interact_tU;
|
};
|
||||||
|
|
||||||
struct ldap_funcs
|
struct ldap_funcs
|
||||||
{
|
{
|
||||||
|
@ -179,11 +172,4 @@ struct ldap_funcs
|
||||||
void (CDECL *fn_ldap_value_free_len)(struct bervalU **);
|
void (CDECL *fn_ldap_value_free_len)(struct bervalU **);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int CDECL sasl_interact_cb(void *, unsigned int, void *, void *) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
struct ldap_callbacks
|
|
||||||
{
|
|
||||||
int (CDECL *sasl_interact)(void *, unsigned int, void *, void *);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const struct ldap_funcs *ldap_funcs;
|
extern const struct ldap_funcs *ldap_funcs;
|
||||||
|
|
|
@ -31,10 +31,6 @@ HINSTANCE hwldap32;
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
|
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
|
||||||
|
|
||||||
const struct ldap_funcs *ldap_funcs = NULL;
|
const struct ldap_funcs *ldap_funcs = NULL;
|
||||||
const struct ldap_callbacks ldap_callbacks =
|
|
||||||
{
|
|
||||||
sasl_interact_cb
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
{
|
{
|
||||||
|
@ -45,7 +41,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
hwldap32 = hinst;
|
hwldap32 = hinst;
|
||||||
DisableThreadLibraryCalls( hinst );
|
DisableThreadLibraryCalls( hinst );
|
||||||
if (__wine_init_unix_lib( hinst, reason, &ldap_callbacks, &ldap_funcs ))
|
if (__wine_init_unix_lib( hinst, reason, NULL, &ldap_funcs ))
|
||||||
ERR( "No libldap support, expect problems\n" );
|
ERR( "No libldap support, expect problems\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue