]> git.sur5r.net Git - openldap/commitdiff
ITS#8717 call connection delete callbacks
authorHoward Chu <hyc@openldap.org>
Wed, 6 Sep 2017 20:46:09 +0000 (21:46 +0100)
committerHoward Chu <hyc@openldap.org>
Wed, 6 Sep 2017 20:46:09 +0000 (21:46 +0100)
When TLS fails to start

libraries/libldap/open.c

index 11564f9c27b2854d05ad88fc783e65a7ec302290..cd81d9c536bd4070a3bfbeb1ae45ad1af434bcc3 100644 (file)
@@ -450,6 +450,31 @@ ldap_int_open_connection(
                --conn->lconn_refcnt;
 
                if (rc != LDAP_SUCCESS) {
+                       /* process connection callbacks */
+                       {
+                               struct ldapoptions *lo;
+                               ldaplist *ll;
+                               ldap_conncb *cb;
+
+                               lo = &ld->ld_options;
+                               LDAP_MUTEX_LOCK( &lo->ldo_mutex );
+                               if ( lo->ldo_conn_cbs ) {
+                                       for ( ll=lo->ldo_conn_cbs; ll; ll=ll->ll_next ) {
+                                               cb = ll->ll_data;
+                                               cb->lc_del( ld, conn->lconn_sb, cb );
+                                       }
+                               }
+                               LDAP_MUTEX_UNLOCK( &lo->ldo_mutex );
+                               lo = LDAP_INT_GLOBAL_OPT();
+                               LDAP_MUTEX_LOCK( &lo->ldo_mutex );
+                               if ( lo->ldo_conn_cbs ) {
+                                       for ( ll=lo->ldo_conn_cbs; ll; ll=ll->ll_next ) {
+                                               cb = ll->ll_data;
+                                               cb->lc_del( ld, conn->lconn_sb, cb );
+                                       }
+                               }
+                               LDAP_MUTEX_UNLOCK( &lo->ldo_mutex );
+                       }
                        return -1;
                }
        }