]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#4401 teardown persistent clients when unconfiguring
authorHoward Chu <hyc@openldap.org>
Wed, 15 Feb 2006 07:38:17 +0000 (07:38 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 15 Feb 2006 07:38:17 +0000 (07:38 +0000)
servers/slapd/syncrepl.c

index 100daa327d4a32e1f782b7e37383576905b5e8d2..ac1042abd18ead5b9b81c4801875252bc221de56 100644 (file)
@@ -2600,6 +2600,16 @@ avl_ber_bvfree( void *v_bv )
 void
 syncinfo_free( syncinfo_t *sie )
 {
+       if ( sie->si_ld ) {
+               if ( sie->si_conn_setup ) {
+                       ber_socket_t s;
+                       ldap_get_option( sie->si_ld, LDAP_OPT_DESC, &s );
+                       connection_client_stop( s );
+                       sie->si_conn_setup = 0;
+               }
+               ldap_unbind_ext( sie->si_ld, NULL, NULL );
+       }
+
        /* re-fetch it, in case it was already removed */
        sie->si_re = ldap_pvt_runqueue_find( &slapd_rq, do_syncrepl, sie );
        if ( sie->si_re ) {
@@ -2663,9 +2673,6 @@ syncinfo_free( syncinfo_t *sie )
        if ( sie->si_presentlist ) {
            avl_free( sie->si_presentlist, avl_ber_bvfree );
        }
-       if ( sie->si_ld ) {
-               ldap_unbind_ext( sie->si_ld, NULL, NULL );
-       }
        while ( !LDAP_LIST_EMPTY( &sie->si_nonpresentlist )) {
                struct nonpresent_entry* npe;
                npe = LDAP_LIST_FIRST( &sie->si_nonpresentlist );