summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-12-30 09:34:20 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-05 15:07:32 +0100
commitf81f21c09b7792915b68cca410e6ec3eb7ee2e0a (patch)
treecd67dcbdfd352972b4892d08acde962df2303c4f
parenta1c9e61643eaec5441cf5d79d399b78874eeb703 (diff)
downloadsamba-f81f21c09b7792915b68cca410e6ec3eb7ee2e0a.tar.gz
samba-f81f21c09b7792915b68cca410e6ec3eb7ee2e0a.tar.bz2
samba-f81f21c09b7792915b68cca410e6ec3eb7ee2e0a.zip
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
-rw-r--r--source3/winbindd/winbindd_cm.c39
1 files changed, 20 insertions, 19 deletions
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");
+ }
}
/****************************************************************