void winbindd_check_cache_size(time_t t) { static time_t last_check_time; struct stat st; if (last_check_time == (time_t)0) last_check_time = t; if (t - last_check_time < 60 && t - last_check_time > 0) return; if (wcache == NULL || wcache->tdb == NULL) { DEBUG(0, ("Unable to check size of tdb cache - cache not open !\n")); return; } if (fstat(wcache->tdb->fd, &st) == -1) { DEBUG(0, ("Unable to check size of tdb cache %s!\n", strerror(errno) )); return; } if (st.st_size > WINBINDD_MAX_CACHE_SIZE) { DEBUG(10,("flushing cache due to size (%lu) > (%lu)\n", (unsigned long)st.st_size, (unsigned long)WINBINDD_MAX_CACHE_SIZE)); wcache_flush_cache(); } }
static void flush_caches(void) { #if 0 /* Clear cached user and group enumation info */ if (!opt_dual_daemon) /* Until we have coherent cache flush. */ wcache_flush_cache(); #endif /* We need to invalidate cached user list entries on a SIGHUP otherwise cached access denied errors due to restrict anonymous hang around until the sequence number changes. */ wcache_invalidate_cache(); }
/* get the winbind_cache structure */ static struct winbind_cache *get_cache(struct winbindd_domain *domain) { struct winbind_cache *ret = wcache; if (!domain->backend) { extern struct winbindd_methods msrpc_methods; switch (lp_security()) { #ifdef HAVE_ADS case SEC_ADS: { extern struct winbindd_methods ads_methods; /* always obey the lp_security parameter for our domain */ if (domain->primary) { domain->backend = &ads_methods; break; } /* only use ADS for native modes at the momment. The problem is the correct detection of mixed mode domains from NT4 BDC's --jerry */ if ( domain->native_mode ) { DEBUG(5,("get_cache: Setting ADS methods for domain %s\n", domain->name)); domain->backend = &ads_methods; break; } /* fall through */ } #endif default: DEBUG(5,("get_cache: Setting MS-RPC methods for domain %s\n", domain->name)); domain->backend = &msrpc_methods; } } if (ret) return ret; ret = smb_xmalloc(sizeof(*ret)); ZERO_STRUCTP(ret); wcache = ret; wcache_flush_cache(); return ret; }