summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_cm.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-01-17 12:59:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:13 -0500
commitbf219447a35d86913c1a643b66d993986a651360 (patch)
treeabd6650e6694233de6d6f8e197a03b513ecaec56 /source3/nsswitch/winbindd_cm.c
parent60c1a8e5a8f905a5ae703dac05ed2f440875ad5d (diff)
downloadsamba-bf219447a35d86913c1a643b66d993986a651360.tar.gz
samba-bf219447a35d86913c1a643b66d993986a651360.tar.bz2
samba-bf219447a35d86913c1a643b66d993986a651360.zip
r20846: Before this gets out of control...
This add a struct event_context and infrastructure for fd events to smbd. This is step zero to import lib/events. Jeremy, I rely on you to watch the change in receive_message_or_smb() closely. For the normal code path this should be the only relevant change. The rest is either not yet used or is cosmetic. Volker (This used to be commit cd07f93a8aecb24c056e33b1ad3447a41959810f)
Diffstat (limited to 'source3/nsswitch/winbindd_cm.c')
-rw-r--r--source3/nsswitch/winbindd_cm.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 3f61da12dc..19b60c1c17 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -231,7 +231,8 @@ static BOOL fork_child_dc_connect(struct winbindd_domain *domain)
Handler triggered if we're offline to try and detect a DC.
****************************************************************/
-static void check_domain_online_handler(struct timed_event *te,
+static void check_domain_online_handler(struct event_context *ctx,
+ struct timed_event *te,
const struct timeval *now,
void *private_data)
{
@@ -327,7 +328,7 @@ void set_domain_offline(struct winbindd_domain *domain)
calc_new_online_timeout_check(domain);
- domain->check_online_event = add_timed_event( NULL,
+ domain->check_online_event = event_add_timed(winbind_event_context(), NULL,
timeval_current_ofs(domain->check_online_timeout,0),
"check_domain_online_handler",
check_domain_online_handler,
@@ -367,7 +368,8 @@ static void set_domain_online(struct winbindd_domain *domain)
/* If we are waiting to get a krb5 ticket, trigger immediately. */
GetTimeOfDay(&now);
- set_event_dispatch_time("krb5_ticket_gain_handler", now);
+ set_event_dispatch_time(winbind_event_context(),
+ "krb5_ticket_gain_handler", now);
/* Ok, we're out of any startup mode now... */
domain->startup = False;
@@ -432,18 +434,10 @@ 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 = add_timed_event( 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.\n");
- }
}
+ TALLOC_FREE(domain->check_online_event);
+
GetTimeOfDay(&tev);
/* Go into "startup" mode again. */
@@ -451,7 +445,17 @@ void set_domain_online_request(struct winbindd_domain *domain)
domain->startup = True;
tev.tv_sec += 5;
- set_event_dispatch_time("check_domain_online_handler", tev);
+
+ domain->check_online_event = event_add_timed(
+ winbind_event_context(), NULL, tev,
+ "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.\n");
+ }
}
/****************************************************************