From f81f21c09b7792915b68cca410e6ec3eb7ee2e0a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 30 Dec 2008 09:34:20 +0100 Subject: s3:winbindd: recreate the per domain check_online_event without relying on global state set_event_dispatch_time() is stupid by design and just picks the first event with the given name. metze --- source3/winbindd/winbindd_cm.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index cecfdb3848..8aaa850201 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -500,6 +500,15 @@ void set_domain_online_request(struct winbindd_domain *domain) because network manager seems to lie. Wait at least 5 seconds. Heuristics suck... */ + + GetTimeOfDay(&tev); + + /* Go into "startup" mode again. */ + domain->startup_time = tev.tv_sec; + domain->startup = True; + + tev.tv_sec += 5; + if (!domain->check_online_event) { /* If we've come from being globally offline we don't have a check online event handler set. @@ -508,29 +517,21 @@ void set_domain_online_request(struct winbindd_domain *domain) DEBUG(10,("set_domain_online_request: domain %s was globally offline.\n", domain->name )); - - domain->check_online_event = event_add_timed(winbind_event_context(), - NULL, - timeval_current_ofs(5, 0), - "check_domain_online_handler", - check_domain_online_handler, - domain); - - /* The above *has* to succeed for winbindd to work. */ - if (!domain->check_online_event) { - smb_panic("set_domain_online_request: failed to add online handler"); - } } - GetTimeOfDay(&tev); - - /* Go into "startup" mode again. */ - domain->startup_time = tev.tv_sec; - domain->startup = True; + TALLOC_FREE(domain->check_online_event); - tev.tv_sec += 5; + domain->check_online_event = event_add_timed(winbind_event_context(), + NULL, + tev, + "check_domain_online_handler", + check_domain_online_handler, + domain); - set_event_dispatch_time(winbind_event_context(), "check_domain_online_handler", tev); + /* The above *has* to succeed for winbindd to work. */ + if (!domain->check_online_event) { + smb_panic("set_domain_online_request: failed to add online handler"); + } } /**************************************************************** -- cgit