*/
{
- BerElement tber;
+ BerElement *tber;
unsigned long tlen, ttag;
- tber = *op->o_ber;
- ttag = ber_skip_tag( &tber, &tlen );
- if ( ber_peek_tag( &tber, &tlen ) == LBER_SEQUENCE ) {
- Debug( LDAP_DEBUG_ANY, "version 3.0 detected\n", 0, 0, 0 );
+ tber = ber_dup( op->o_ber );
+ ttag = ber_skip_tag( tber, &tlen );
+ if ( ber_peek_tag( tber, &tlen ) == LBER_SEQUENCE ) {
+ Debug( LDAP_DEBUG_ANY, "bind: version 3.0 detected\n", 0, 0, 0 );
conn->c_version = 30;
rc = ber_scanf(ber, "{{iato}}", &version, &cdn, &method, &cred);
} else {
rc = ber_scanf( ber, "{iato}", &version, &cdn, &method, &cred );
}
+
+ ber_free( tber, 1 );
}
#else
rc = ber_scanf( ber, "{iato}", &version, &cdn, &method, &cred );
#endif
if ( rc == LBER_ERROR ) {
- Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
"decoding error" );
return;
free( cred.bv_val );
}
- ldap_pvt_thread_mutex_lock( &conn->c_dnmutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
conn->c_protocol = version;
conn->c_dn = NULL;
}
- ldap_pvt_thread_mutex_unlock( &conn->c_dnmutex );
+ 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_dnmutex );
+ ldap_pvt_thread_mutex_lock( &conn->c_mutex );
conn->c_protocol = version;
conn->c_dn = NULL;
}
- ldap_pvt_thread_mutex_unlock( &conn->c_dnmutex );
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
send_ldap_result( conn, op, LDAP_SUCCESS,
NULL, NULL );
ndn = suffixAlias( ndn, op, be );
if ( (*be->be_bind)( be, conn, op, ndn, method, &cred, &edn ) == 0 ) {
- ldap_pvt_thread_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 );
- ldap_pvt_thread_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 );