s3:smbldap: use smbldap_state as memory context for idle event
authorGregor Beck <gbeck@sernet.de>
Tue, 21 Jun 2011 05:51:41 +0000 (07:51 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jul 2011 09:22:56 +0000 (11:22 +0200)
ensure the event is canceled if the smbldap_state gets freed
this fixes a panic of winbindd if verify_idpool fails

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/lib/smbldap.c

index 38c7b207f5609a6a082f87f14321c137326142d0..3d159d73d950fd21745beb3a72a33d703624689e 100644 (file)
@@ -1307,7 +1307,7 @@ static int smbldap_open(struct smbldap_state *ldap_state)
 
        if (ldap_state->event_context != NULL) {
                ldap_state->idle_event = event_add_timed(
-                       ldap_state->event_context, NULL,
+                       ldap_state->event_context, ldap_state,
                        timeval_current_ofs(SMBLDAP_IDLE_TIME, 0),
                        smbldap_idle_fn, ldap_state);
        }
@@ -1820,7 +1820,7 @@ static void smbldap_idle_fn(struct event_context *event_ctx,
 
                /* this needs to be made monotonic clock aware inside tevent: */
                state->idle_event = event_add_timed(
-                       event_ctx, NULL,
+                       event_ctx, state,
                        timeval_add(&now_abs, SMBLDAP_IDLE_TIME, 0),
                        smbldap_idle_fn,
                        private_data);