diff options
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd.c | 14 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 32 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cred_cache.c | 16 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_dual.c | 16 |
4 files changed, 48 insertions, 30 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 049bc47aba..1a3e761adc 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -34,6 +34,16 @@ static BOOL interactive = False; extern BOOL override_logfile; +struct event_context *winbind_event_context(void) +{ + static struct event_context *ctx; + + if (!ctx && !(ctx = event_context_init(NULL))) { + smb_panic("Could not init smbd event context\n"); + } + return ctx; +} + /* Reload configuration */ static BOOL reload_services_file(void) @@ -716,7 +726,7 @@ static void process_loop(void) message_dispatch(); - run_events(); + run_events(winbind_event_context(), 0, NULL, NULL); /* refresh the trusted domain cache */ @@ -748,7 +758,7 @@ static void process_loop(void) timeout.tv_usec = 0; /* Check for any event timeouts. */ - if (get_timed_events_timeout(&ev_timeout)) { + if (get_timed_events_timeout(winbind_event_context(), &ev_timeout)) { timeout = timeval_min(&timeout, &ev_timeout); } 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"); + } } /**************************************************************** diff --git a/source3/nsswitch/winbindd_cred_cache.c b/source3/nsswitch/winbindd_cred_cache.c index 6f629ad15c..50d39dd670 100644 --- a/source3/nsswitch/winbindd_cred_cache.c +++ b/source3/nsswitch/winbindd_cred_cache.c @@ -66,7 +66,8 @@ static int ccache_entry_count(void) Do the work of refreshing the ticket. ****************************************************************/ -static void krb5_ticket_refresh_handler(struct timed_event *te, +static void krb5_ticket_refresh_handler(struct event_context *event_ctx, + struct timed_event *te, const struct timeval *now, void *private_data) { @@ -145,7 +146,7 @@ static void krb5_ticket_refresh_handler(struct timed_event *te, done: - entry->event = add_timed_event(entry, + entry->event = event_add_timed(winbind_event_context(), entry, timeval_set(new_start, 0), "krb5_ticket_refresh_handler", krb5_ticket_refresh_handler, @@ -158,7 +159,8 @@ done: Do the work of regaining a ticket when coming from offline auth. ****************************************************************/ -static void krb5_ticket_gain_handler(struct timed_event *te, +static void krb5_ticket_gain_handler(struct event_context *event_ctx, + struct timed_event *te, const struct timeval *now, void *private_data) { @@ -220,7 +222,7 @@ static void krb5_ticket_gain_handler(struct timed_event *te, retry_later: - entry->event = add_timed_event(entry, + entry->event = event_add_timed(winbind_event_context(), entry, timeval_current_ofs(MAX(30, lp_winbind_cache_time()), 0), "krb5_ticket_gain_handler", krb5_ticket_gain_handler, @@ -236,7 +238,7 @@ static void krb5_ticket_gain_handler(struct timed_event *te, t = timeval_set(new_start, 0); #endif /* TESTING */ - entry->event = add_timed_event(entry, + entry->event = event_add_timed(winbind_event_context(), entry, t, "krb5_ticket_refresh_handler", krb5_ticket_refresh_handler, @@ -349,13 +351,13 @@ NTSTATUS add_ccache_to_list(const char *princ_name, if (lp_winbind_refresh_tickets() && renew_until > 0) { if (postponed_request) { - entry->event = add_timed_event(entry, + entry->event = event_add_timed(winbind_event_context(), entry, timeval_current_ofs(MAX(30, lp_winbind_cache_time()), 0), "krb5_ticket_gain_handler", krb5_ticket_gain_handler, entry); } else { - entry->event = add_timed_event(entry, + entry->event = event_add_timed(winbind_event_context(), entry, timeval_set((ticket_end - 1), 0), "krb5_ticket_refresh_handler", krb5_ticket_refresh_handler, diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c index b72b7238b1..62193c0b69 100644 --- a/source3/nsswitch/winbindd_dual.c +++ b/source3/nsswitch/winbindd_dual.c @@ -598,7 +598,8 @@ void winbind_msg_onlinestatus(int msg_type, struct process_id src, void *buf, si } -static void account_lockout_policy_handler(struct timed_event *te, +static void account_lockout_policy_handler(struct event_context *ctx, + struct timed_event *te, const struct timeval *now, void *private_data) { @@ -631,7 +632,7 @@ static void account_lockout_policy_handler(struct timed_event *te, nt_errstr(result))); } - child->lockout_policy_event = add_timed_event(NULL, + child->lockout_policy_event = event_add_timed(winbind_event_context(), NULL, timeval_current_ofs(3600, 0), "account_lockout_policy_handler", account_lockout_policy_handler, @@ -843,8 +844,8 @@ static BOOL fork_domain_child(struct winbindd_child *child) if (child->domain != NULL && lp_winbind_offline_logon()) { /* We might be in the idmap child...*/ - child->lockout_policy_event = add_timed_event( - NULL, timeval_zero(), + child->lockout_policy_event = event_add_timed( + winbind_event_context(), NULL, timeval_zero(), "account_lockout_policy_handler", account_lockout_policy_handler, child); @@ -874,7 +875,8 @@ static BOOL fork_domain_child(struct winbindd_child *child) /* Ensure we're not handling an event inherited from our parent. */ - cancel_named_event("krb5_ticket_refresh_handler"); + cancel_named_event(winbind_event_context(), + "krb5_ticket_refresh_handler"); while (1) { @@ -888,7 +890,7 @@ static BOOL fork_domain_child(struct winbindd_child *child) lp_TALLOC_FREE(); main_loop_TALLOC_FREE(); - run_events(); + run_events(winbind_event_context(), 0, NULL, NULL); GetTimeOfDay(&now); @@ -900,7 +902,7 @@ static BOOL fork_domain_child(struct winbindd_child *child) child->domain->startup = False; } - tp = get_timed_events_timeout(&t); + tp = get_timed_events_timeout(winbind_event_context(), &t); if (tp) { DEBUG(11,("select will use timeout of %u.%u seconds\n", (unsigned int)tp->tv_sec, (unsigned int)tp->tv_usec )); |