Cyrus SASL locking

This commit is contained in:
Kurt Zeilenga 2001-06-25 06:56:08 +00:00
parent 46f731429e
commit 0e7a9da79d
2 changed files with 17 additions and 5 deletions

View File

@ -16,11 +16,13 @@
#include <ac/ctype.h>
#include "ldap-int.h"
#ifdef LDAP_R_COMPILE
#include "ldap_pvt_thread.h"
#endif
#ifdef HAVE_CYRUS_SASL
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_t ldap_int_sasl_mutex;
#endif
#include <sasl.h>
/*
@ -62,6 +64,8 @@ int ldap_int_sasl_init( void )
ldap_pvt_sasl_mutex_lock,
ldap_pvt_sasl_mutex_unlock,
ldap_pvt_sasl_mutex_dispose );
ldap_pvt_thread_mutex_init( &ldap_int_sasl_mutex );
#endif
if ( sasl_client_init( client_callbacks ) == SASL_OK ) {

View File

@ -37,7 +37,6 @@
#include "ldap-int.h"
/*
* ldap_sasl_bind - bind to the ldap server (and X.500).
* The dn (usually NULL), mechanism, and credentials are provided.
@ -417,13 +416,17 @@ ldap_sasl_interactive_bind_s(
{
int rc;
#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
ldap_pvt_thread_mutex_lock( &ldap_int_sasl_mutex );
#endif
if( mechs == NULL || *mechs == '\0' ) {
char *smechs;
rc = ldap_pvt_sasl_getmechs( ld, &smechs );
if( rc != LDAP_SUCCESS ) {
return rc;
goto done;
}
Debug( LDAP_DEBUG_TRACE,
@ -442,5 +445,10 @@ ldap_sasl_interactive_bind_s(
serverControls, clientControls,
flags, interact, defaults );
done:
#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
ldap_pvt_thread_mutex_unlock( &ldap_int_sasl_mutex );
#endif
return rc;
}