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;
|
||||
}
|
||||
|
||||
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.@)
|
||||
*
|
||||
|
|
|
@ -59,8 +59,6 @@ C_ASSERT( sizeof(struct timevalU) == sizeof(struct timeval) );
|
|||
|
||||
static LDAPMod *nullmods[] = { NULL };
|
||||
|
||||
static const struct ldap_callbacks *callbacks;
|
||||
|
||||
static void * CDECL wrap_ber_alloc_t( int 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 )
|
||||
{
|
||||
#ifdef HAVE_SASL_SASL_H
|
||||
C_ASSERT( sizeof(struct sasl_interactU) == sizeof(struct sasl_interact) );
|
||||
return callbacks->sasl_interact( ld, flags, defaults, interact );
|
||||
struct sasl_interactive_bind_id *id = defaults;
|
||||
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
|
||||
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 )
|
||||
{
|
||||
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
|
||||
callbacks = ptr_in;
|
||||
*(const struct ldap_funcs **)ptr_out = &funcs;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -83,22 +83,15 @@ typedef struct timevalU
|
|||
LONG_PTR tv_usec;
|
||||
} LDAP_TIMEVALU;
|
||||
|
||||
#ifndef SASL_CB_LIST_END
|
||||
#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
|
||||
struct sasl_interactive_bind_id
|
||||
{
|
||||
ULONG_PTR id;
|
||||
const char *challenge;
|
||||
const char *prompt;
|
||||
const char *defresult;
|
||||
const void *result;
|
||||
unsigned int len;
|
||||
} sasl_interact_tU;
|
||||
unsigned char* user;
|
||||
ULONG user_len;
|
||||
unsigned char* domain;
|
||||
ULONG domain_len;
|
||||
unsigned char* password;
|
||||
ULONG password_len;
|
||||
};
|
||||
|
||||
struct ldap_funcs
|
||||
{
|
||||
|
@ -179,11 +172,4 @@ struct ldap_funcs
|
|||
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;
|
||||
|
|
|
@ -31,10 +31,6 @@ HINSTANCE hwldap32;
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@ -45,7 +41,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
|||
case DLL_PROCESS_ATTACH:
|
||||
hwldap32 = 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" );
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue