diff options
author | Jeremy Allison <jra@samba.org> | 2006-12-19 00:48:39 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:36 -0500 |
commit | 511593102455cb9afb7bbfb7ca2d969af3a95766 (patch) | |
tree | 66e4f2c244a98d827e33c87d79af36526f8e7212 | |
parent | fb6d54dbabefdb11c33125988b03ccf4080658e4 (diff) | |
download | samba-511593102455cb9afb7bbfb7ca2d969af3a95766.tar.gz samba-511593102455cb9afb7bbfb7ca2d969af3a95766.tar.bz2 samba-511593102455cb9afb7bbfb7ca2d969af3a95766.zip |
r20250: If we've come from being globally offline we
don't have a check online event handler set.
We need to add one once we're been asked to
go back online as this is the only way to actually
go into the online state. Doh ! :-).
Jeremy.
(This used to be commit 5d36c4e0313c2d735242dfdd57343372be59c6e1)
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index 0a0dc63bca..2e6d6e644a 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -407,6 +407,8 @@ static void set_domain_online(struct winbindd_domain *domain) void set_domain_online_request(struct winbindd_domain *domain) { + struct timeval tev; + DEBUG(10,("set_domain_online_request: called for domain %s\n", domain->name )); @@ -422,20 +424,34 @@ void set_domain_online_request(struct winbindd_domain *domain) Wait at least 5 seconds. Heuristics suck... */ if (!domain->check_online_event) { - DEBUG(5,("set_domain_online_request: no check_domain_online_handler " - "registered. Were we online (%d) ?\n", (int)domain->online )); - } else { - struct timeval tev; + /* If we've come from being globally offline we + don't have a check online event handler set. + We need to add one now we're trying to go + back online. */ - GetTimeOfDay(&tev); + DEBUG(10,("set_domain_online_request: domain %s was globally offline.\n", + domain->name )); - /* Go into "startup" mode again. */ - domain->startup_time = tev.tv_sec; - domain->startup = True; + domain->check_online_event = add_timed_event( NULL, + timeval_current_ofs(5, 0), + "check_domain_online_handler", + check_domain_online_handler, + domain); - tev.tv_sec += 5; - set_event_dispatch_time("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.\n"); + } } + + GetTimeOfDay(&tev); + + /* Go into "startup" mode again. */ + domain->startup_time = tev.tv_sec; + domain->startup = True; + + tev.tv_sec += 5; + set_event_dispatch_time("check_domain_online_handler", tev); } /**************************************************************** |