]> git.sur5r.net Git - openldap/commitdiff
ITS#5401
authorQuanah Gibson-Mount <quanah@openldap.org>
Wed, 9 Jul 2008 22:53:13 +0000 (22:53 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 9 Jul 2008 22:53:13 +0000 (22:53 +0000)
CHANGES
servers/slapd/overlays/syncprov.c

diff --git a/CHANGES b/CHANGES
index dc8baff994d86b6024e7d9ddf89b82214f830949..5835a6eefa5415bb901efdf5cec92d39712c4c0a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@ OpenLDAP 2.3.43 Engineering
        Fixed liblber ber_get_next length decoding (ITS#5580)
        Fixed slapd replog timestamps (ITS#5532)
        Fixed slapd socket assert (ITS#5489)
+       Fixed slapo-syncprov psearch on closed connection (ITS#5401, ITS#5565)
 
 OpenLDAP 2.3.42 Release (2008/05/28)
        Fixed libldap file descriptor leak with SELinux (ITS#5507)
index e44b834f5f9787123268ceecb30b9f0165795649..a284d2ae0a619d3df6801445ce98f03ec0ea928f 100644 (file)
@@ -1840,12 +1840,10 @@ syncprov_detach_op( Operation *op, syncops *so, slap_overinst *on )
        op2->o_do_not_cache = 1;
 
        /* Add op2 to conn so abandon will find us */
-       ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
        op->o_conn->c_n_ops_executing++;
        op->o_conn->c_n_ops_completed--;
        LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op2, o_next );
        so->s_flags |= PS_IS_DETACHED;
-       ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 
        /* Prevent anyone else from trying to send a result for this op */
        op->o_abandon = 1;
@@ -1933,15 +1931,27 @@ syncprov_search_response( Operation *op, SlapReply *rs )
 
                        /* Detach this Op from frontend control */
                        ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
+                       ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 
-                       /* Turn off the refreshing flag */
-                       ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+                       /* But not if this connection was closed along the way */
+                       if ( op->o_abandon ) {
+                               ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+                               ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
+                               /* syncprov_ab_cleanup will free this syncop */
+                               return SLAPD_ABANDON;
 
-                       syncprov_detach_op( op, ss->ss_so, on );
+                       } else {
+                               /* Turn off the refreshing flag */
+                               ss->ss_so->s_flags ^= PS_IS_REFRESHING;
+
+                               syncprov_detach_op( op, ss->ss_so, on );
 
-                       /* If there are queued responses, fire them off */
-                       if ( ss->ss_so->s_res )
-                               syncprov_qstart( ss->ss_so );
+                               ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+                               /* If there are queued responses, fire them off */
+                               if ( ss->ss_so->s_res )
+                                       syncprov_qstart( ss->ss_so );
+                       }
                        ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
 
                        return LDAP_SUCCESS;