)
{
BerElement *ber = op->o_ber;
- int version, method, len;
+ int version, method;
char *cdn, *ndn;
unsigned long rc;
struct berval cred;
free( cred.bv_val );
}
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+
conn->c_protocol = version;
+ if ( conn->c_cdn != NULL ) {
+ free( conn->c_cdn );
+ conn->c_cdn = NULL;
+ }
+
+ if ( conn->c_dn != NULL ) {
+ free( conn->c_dn );
+ conn->c_dn = NULL;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+
send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
return;
}
free( cred.bv_val );
}
if ( cred.bv_len == 0 ) {
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+
conn->c_protocol = version;
+
+ if ( conn->c_cdn != NULL ) {
+ free( conn->c_cdn );
+ conn->c_cdn = NULL;
+ }
+
+ if ( conn->c_dn != NULL ) {
+ free( conn->c_dn );
+ conn->c_dn = NULL;
+ }
+
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+
send_ldap_result( conn, op, LDAP_SUCCESS,
NULL, NULL );
} else if ( default_referral && *default_referral ) {
return;
}
- if ( be->be_bind != NULL ) {
+ if ( be->be_bind ) {
/* alias suffix */
char *edn;
ndn = suffixAlias( ndn, op, be );
if ( (*be->be_bind)( be, conn, op, ndn, method, &cred, &edn ) == 0 ) {
- pthread_mutex_lock( &conn->c_dnmutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
conn->c_protocol = version;
Debug( LDAP_DEBUG_TRACE, "do_bind: bound \"%s\" to \"%s\"\n",
conn->c_cdn, conn->c_dn, method );
- pthread_mutex_unlock( &conn->c_dnmutex );
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
/* send this here to avoid a race condition */
send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );