]> git.sur5r.net Git - openldap/commitdiff
Fix CONFIG_DELETE crash
authorHoward Chu <hyc@openldap.org>
Tue, 5 Nov 2013 20:59:56 +0000 (12:59 -0800)
committerHoward Chu <hyc@openldap.org>
Tue, 5 Nov 2013 20:59:56 +0000 (12:59 -0800)
Closing a connection can abandon its ops without going thru the threadpool,
so make sure to lock the si_ops_mutex before walking the list.

servers/slapd/overlays/syncprov.c

index c18e16483db9faa64126b403084d6d762b3a6a22..8a16cd47e301d16ba858d649dedb37490c8656f7 100644 (file)
@@ -3170,6 +3170,7 @@ syncprov_db_close(
 
 #ifdef SLAP_CONFIG_DELETE
        if ( !slapd_shutdown ) {
+               ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
                for ( so=si->si_ops, sonext=so;  so; so=sonext  ) {
                        SlapReply rs = {REP_RESULT};
                        rs.sr_err = LDAP_UNAVAILABLE;
@@ -3178,6 +3179,7 @@ syncprov_db_close(
                        syncprov_drop_psearch( so, 0);
                }
                si->si_ops=NULL;
+               ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
        }
        overlay_unregister_control( be, LDAP_CONTROL_SYNC );
 #endif /* SLAP_CONFIG_DELETE */