]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/connection.c
remove dbenv->lock_put() call from transaction-protected operations
[openldap] / servers / slapd / connection.c
index 5f4a463e27df1a1bbde43f315d6d04998ac3a71e..a93af0d11679b6b19f2934aa1053dfd50cbd8260 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <ac/socket.h>
 #include <ac/errno.h>
-#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/time.h>
 #include <ac/unistd.h>
@@ -605,7 +604,6 @@ void connection2anonymous( Connection *c )
        }
        c->c_cdn.bv_len = 0;
 
-       c->c_authc_backend = NULL;
        c->c_authz_backend = NULL;
     
     {
@@ -741,9 +739,7 @@ static void connection_abandon( Connection *c )
        Operation *o;
 
        LDAP_STAILQ_FOREACH(o, &c->c_ops, o_next) {
-               ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
                o->o_abandon = 1;
-               ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
        }
 
        /* remove pending operations */
@@ -909,19 +905,26 @@ void connection_done( Connection *c )
  * calls the appropriate stub to handle it.
  */
 
+#ifdef SLAPD_MONITOR
 #define INCR_OP(var,index) \
        do { \
                ldap_pvt_thread_mutex_lock( &num_ops_mutex ); \
                (var)[(index)]++; \
                ldap_pvt_thread_mutex_unlock( &num_ops_mutex ); \
        } while (0)
+#else /* !SLAPD_MONITOR */
+#define INCR_OP(var,index) 
+#endif /* !SLAPD_MONITOR */
 
 static void *
 connection_operation( void *arg_v )
 {
        int rc;
        struct co_arg   *arg = arg_v;
-       ber_tag_t tag = arg->co_op->o_tag, oldtag = tag;
+       ber_tag_t tag = arg->co_op->o_tag;
+#ifdef SLAPD_MONITOR
+       ber_tag_t oldtag = tag;
+#endif /* SLAPD_MONITOR */
        Connection *conn = arg->co_conn;
 
        ldap_pvt_thread_mutex_lock( &num_ops_mutex );
@@ -1011,12 +1014,15 @@ connection_operation( void *arg_v )
                break;
        }
 
+#ifdef SLAPD_MONITOR
        oldtag = tag;
+#endif /* SLAPD_MONITOR */
        if( rc == SLAPD_DISCONNECT ) tag = LBER_ERROR;
 
 operations_error:
        ldap_pvt_thread_mutex_lock( &num_ops_mutex );
        num_ops_completed++;
+#ifdef SLAPD_MONITOR
        switch (oldtag) {
        case LDAP_REQ_BIND:
                num_ops_completed_[SLAP_OP_BIND]++;
@@ -1049,6 +1055,7 @@ operations_error:
                num_ops_completed_[SLAP_OP_EXTENDED]++;
                break;
        }
+#endif /* SLAPD_MONITOR */
        ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
 
        ldap_pvt_thread_mutex_lock( &conn->c_mutex );
@@ -1182,7 +1189,7 @@ int connection_read(ber_socket_t s)
 
                } else if ( rc == 0 ) {
                        void *ssl;
-                       char *authid;
+                       struct berval authid = { 0, NULL };
 
                        c->c_needs_tls_accept = 0;
 
@@ -1194,8 +1201,21 @@ int connection_read(ber_socket_t s)
                                c->c_ssf = c->c_tls_ssf;
                        }
 
-                       authid = (char *)ldap_pvt_tls_get_peer( ssl );
-                       slap_sasl_external( c, c->c_tls_ssf, authid );
+                       rc = dnX509peerNormalize( ssl, &authid );
+                       if ( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                               "connection_read: conn %lu unable to get TLS client DN, error %d\n",
+                                       c->c_connid, rc));
+#else
+                               Debug( LDAP_DEBUG_TRACE,
+                               "connection_read(%d): unable to get TLS client DN "
+                               "error=%d id=%lu\n",
+                               s, rc, c->c_connid );
+#endif
+                       }
+                       slap_sasl_external( c, c->c_tls_ssf, authid.bv_val );
+                       if ( authid.bv_val )    free( authid.bv_val );
                }
                connection_return( c );
                ldap_pvt_thread_mutex_unlock( &connections_mutex );
@@ -1403,6 +1423,8 @@ connection_input(
 
        op = slap_op_alloc( ber, msgid, tag, conn->c_n_ops_received++ );
 
+       op->vrFilter = NULL;
+
        op->o_pagedresults_state = conn->c_pagedresults_state;
 
 #ifdef LDAP_CONNECTIONLESS