]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
Vienna Bulk Commit
[openldap] / servers / slapd / bind.c
index cf0b2af328eb65760cf0bdbc633c703acc35942a..778471118278005e13599982e1b837367e2baaeb 100644 (file)
@@ -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 );