From 6e090f1d7d4bc94cd0bc20e3502741621b6e2106 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 25 Aug 2003 21:45:57 +0000 Subject: make sure we keep the trusted domain cache up to date (This used to be commit 3324adcaceb9191b5d4d671ac9b51c85c6714598) --- source3/nsswitch/winbindd.c | 10 ++-------- source3/nsswitch/winbindd_util.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index e6a1c8290b..6a0056f917 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -570,15 +570,9 @@ static void process_loop(void) message_dispatch(); -#if 0 - /* not needed any more since we use a single RPC to - get transitive trusts --jerry - - rescan the trusted domains list. This must be done - regularly to cope with transitive trusts */ + /* refresh the trusted domain cache */ - rescan_trusted_domains(False); -#endif + rescan_trusted_domains(); /* Free up temporary memory */ diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 95dff84769..e5cb87ee75 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -144,10 +144,39 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const return domain; } +/******************************************************************** + Periodcially we need to refresh the trusted domain cache for smbd +********************************************************************/ -/* +void rescan_trusted_domains( void ) +{ + static time_t last_scan; + time_t now = time(NULL); + struct winbindd_domain *mydomain = NULL; + + /* see if the time has come... */ + + if ( (now > last_scan) && ((now-last_scan) < WINBINDD_RESCAN_FREQ) ) + return; + + /* get the handle for our domain */ + + if ( (mydomain = find_domain_from_name(lp_workgroup())) == NULL ) { + DEBUG(0,("rescan_trusted_domains: Can't find my own domain!\n")); + return; + } + + /* this will only add new domains we didn't already know about */ + + add_trusted_domains( mydomain ); + + return; +} + +/******************************************************************** rescan our domains looking for new trusted domains - */ +********************************************************************/ + void add_trusted_domains( struct winbindd_domain *domain ) { TALLOC_CTX *mem_ctx; -- cgit