X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fbind.c;h=778471118278005e13599982e1b837367e2baaeb;hb=dc07e765f263ef459dcd2afd1ece01cfc85a0edd;hp=cf0b2af328eb65760cf0bdbc633c703acc35942a;hpb=5ef648a109669cd4a8a776f2233a51436cebcdb8;p=openldap diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index cf0b2af328..7784711182 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -57,25 +57,27 @@ do_bind( */ { - 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; @@ -135,7 +137,7 @@ do_bind( free( cred.bv_val ); } - ldap_pvt_thread_mutex_lock( &conn->c_dnmutex ); + ldap_pvt_thread_mutex_lock( &conn->c_mutex ); conn->c_protocol = version; @@ -149,7 +151,7 @@ do_bind( 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; @@ -168,7 +170,7 @@ do_bind( 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; @@ -182,7 +184,7 @@ do_bind( 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 ); @@ -203,7 +205,7 @@ do_bind( 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; @@ -228,7 +230,7 @@ do_bind( 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 );