]> 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)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 5 Nov 2013 22:20:03 +0000 (14:20 -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 dd8229fcba520ea1c97537361279429e16c25ef5..1c84cf2fac4f38dd2deeb02f3d1a443a8396f5dc 100644 (file)
@@ -3172,6 +3172,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;
@@ -3180,6 +3181,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 */