>From ba2451a3881f70eb4a2f885a13f6e2f9dee5fdec Mon Sep 17 00:00:00 2001 From: eindenbom Date: Thu, 15 Apr 2010 10:12:06 +0400 Subject: [PATCH] Amendment to fix of recursive sdap_handle disconnect sequence to make detruction code more robust with respect to sdap->connected flag. --- src/providers/ldap/sdap_async.c | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c index 4c9b6b9..037edbf 100644 --- a/src/providers/ldap/sdap_async.c +++ b/src/providers/ldap/sdap_async.c @@ -109,23 +109,22 @@ static void sdap_handle_release(struct sdap_handle *sh, bool final) sh, (int)sh->connected, shd->ops, shd->ldap)); sdap_handle_data_lock(shd); - if (sh->connected) { - /* mark as disconnected at once to prevent further activity on connection */ - sh->connected = false; - if (shd->ldap) { + /* mark as disconnected at once to prevent further activity on connection */ + sh->connected = false; + + if (shd->ldap) { #ifdef HAVE_LDAP_CONNCB - if (shd->conncb) { - /* remove callback first */ - ldap_get_option(shd->ldap, LDAP_OPT_CONNECT_CB, shd->conncb); + if (shd->conncb) { + /* remove callback first */ + ldap_get_option(shd->ldap, LDAP_OPT_CONNECT_CB, shd->conncb); - /* no free its data and remove all related fd events from the event loop */ - talloc_zfree(shd->conncb); - } + /* no free its data and remove all related fd events from the event loop */ + talloc_zfree(shd->conncb); + } #else - talloc_zfree(shd->fde); + talloc_zfree(shd->fde); #endif - } } /* and notify remaining ops on failure */ -- 1.6.6.1