Skip to content
Snippets Groups Projects
Commit 0e7a9da7 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Cyrus SASL locking

parent 46f73142
No related branches found
No related tags found
No related merge requests found
......@@ -16,11 +16,13 @@
#include <ac/ctype.h>
#include "ldap-int.h"
#ifdef HAVE_CYRUS_SASL
#ifdef LDAP_R_COMPILE
#include "ldap_pvt_thread.h"
ldap_pvt_thread_mutex_t ldap_int_sasl_mutex;
#endif
#ifdef HAVE_CYRUS_SASL
#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 ) {
......
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment