diff options
author | Jeremy Allison <jra@samba.org> | 2006-12-19 00:48:39 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2006-12-19 00:48:39 +0000 |
commit | 22e87196bcbd66ebf20877ad33b2e67e822cb1c0 (patch) | |
tree | ff64c6373c830089bb7e2655feb9227d3d5604e4 | |
parent | 3e376e3555e7a4258e76175562005eafb7c79f2e (diff) | |
download | samba-22e87196bcbd66ebf20877ad33b2e67e822cb1c0.tar.gz samba-22e87196bcbd66ebf20877ad33b2e67e822cb1c0.tar.xz samba-22e87196bcbd66ebf20877ad33b2e67e822cb1c0.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.
-rw-r--r-- | source/nsswitch/winbindd_cm.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/source/nsswitch/winbindd_cm.c b/source/nsswitch/winbindd_cm.c index 0a0dc63bca4..2e6d6e644a3 100644 --- a/source/nsswitch/winbindd_cm.c +++ b/source/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); } /**************************************************************** |