summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_util.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-25 22:34:48 +0200
committerVolker Lendecke <vl@samba.org>2009-06-14 11:25:48 +0200
commit07fac35b3b1083e2fa596a62c8be18992c15d3ef (patch)
tree3ed076ee7125b6856da0b1f907a6711416eaffd7 /source3/winbindd/winbindd_util.c
parentc4a97b2b414477043ce373a07722da305a03a52a (diff)
downloadsamba-07fac35b3b1083e2fa596a62c8be18992c15d3ef.tar.gz
samba-07fac35b3b1083e2fa596a62c8be18992c15d3ef.tar.bz2
samba-07fac35b3b1083e2fa596a62c8be18992c15d3ef.zip
Make rescan_trusted_domains a timed event
Diffstat (limited to 'source3/winbindd/winbindd_util.c')
-rw-r--r--source3/winbindd/winbindd_util.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 7aceca39c4..8302ec752b 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -45,14 +45,6 @@ extern struct winbindd_methods sam_passdb_methods;
static struct winbindd_domain *_domain_list = NULL;
-/**
- When was the last scan of trusted domains done?
-
- 0 == not ever
-*/
-
-static time_t last_trustdom_scan;
-
struct winbindd_domain *domain_list(void)
{
/* Initialise list */
@@ -535,19 +527,10 @@ static void rescan_forest_trusts( void )
(c) ask the a DC in any Win2003 trusted forests
*********************************************************************/
-void rescan_trusted_domains( void )
+void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval now, void *private_data)
{
- time_t now = time(NULL);
-
- /* Check that we allow trusted domains at all */
- if (!lp_allow_trusted_domains())
- return;
-
- /* see if the time has come... */
-
- if ((now >= last_trustdom_scan) &&
- ((now-last_trustdom_scan) < WINBINDD_RESCAN_FREQ) )
- return;
+ TALLOC_FREE(te);
/* I use to clear the cache here and start over but that
caused problems in child processes that needed the
@@ -562,7 +545,13 @@ void rescan_trusted_domains( void )
add_trusted_domains( find_our_domain() );
- last_trustdom_scan = now;
+ te = tevent_add_timer(
+ ev, NULL, timeval_current_ofs(WINBINDD_RESCAN_FREQ, 0),
+ rescan_trusted_domains, NULL);
+ /*
+ * If te == NULL, there's not much we can do here. Don't fail, the
+ * only thing we miss is new trusted domains.
+ */
return;
}