]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/syncprov.c
Remove redundant isGrouporMember calls
[openldap] / servers / slapd / overlays / syncprov.c
index d7c857b6bae578b040ab509fd131bd9d0de28f7b..2f8686acecde99fd327ea91623917de1bd3eeb7d 100644 (file)
@@ -800,7 +800,7 @@ syncprov_sendresp( Operation *op, opcookie *opc, syncops *so,
                rs.sr_entry = *e;
                if ( rs.sr_entry->e_private )
                        rs.sr_flags = REP_ENTRY_MUSTRELEASE;
-               if ( opc->sreference ) {
+               if ( opc->sreference && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
                        rs.sr_ref = get_entry_referrals( op, rs.sr_entry );
                        rs.sr_err = send_search_reference( op, &rs );
                        ber_bvarray_free( rs.sr_ref );
@@ -823,7 +823,7 @@ syncprov_sendresp( Operation *op, opcookie *opc, syncops *so,
                e_uuid.e_name = opc->sdn;
                e_uuid.e_nname = opc->sndn;
                rs.sr_entry = &e_uuid;
-               if ( opc->sreference ) {
+               if ( opc->sreference && so->s_op->o_managedsait <= SLAP_CONTROL_IGNORED ) {
                        struct berval bv = BER_BVNULL;
                        rs.sr_ref = &bv;
                        rs.sr_err = send_search_reference( op, &rs );
@@ -1949,6 +1949,7 @@ syncprov_detach_op( Operation *op, syncops *so, slap_overinst *on )
        op2->o_time = op->o_time;
        op2->o_bd = on->on_info->oi_origdb;
        op2->o_request = op->o_request;
+       op2->o_managedsait = op->o_managedsait;
        LDAP_SLIST_FIRST(&op2->o_extra)->oe_key = on;
        LDAP_SLIST_NEXT(LDAP_SLIST_FIRST(&op2->o_extra), oe_next) = NULL;
 
@@ -2122,17 +2123,16 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                                op->o_tmpfree( cookie.bv_val, op->o_tmpmemctx );
 
                        /* 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 );
 
                        /* 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;
 
                        } else {
+                               ldap_pvt_thread_mutex_lock( &ss->ss_so->s_mutex );
                                /* Turn off the refreshing flag */
                                ss->ss_so->s_flags ^= PS_IS_REFRESHING;
 
@@ -2143,8 +2143,8 @@ syncprov_search_response( Operation *op, SlapReply *rs )
                                /* 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 );
                        }
-                       ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
 
                        return LDAP_SUCCESS;
                }
@@ -2175,7 +2175,6 @@ syncprov_op_search( Operation *op, SlapReply *rs )
        }
 
        srs = op->o_controls[slap_cids.sc_LDAPsync];
-       op->o_managedsait = SLAP_CONTROL_NONCRITICAL;
 
        /* If this is a persistent search, set it up right away */
        if ( op->o_sync_mode & SLAP_SYNC_PERSIST ) {