-/*
+/*
Unix SMB/CIFS implementation.
Trusted domain names cache on top of gencache.
* @return true upon successful value storing or
* false if store attempt failed
**/
-
+
bool trustdom_cache_store(const char *name, const char *alt_name,
const struct dom_sid *sid, time_t timeout)
{
/*******************************************************************
- fetch the timestamp from the last update
+ fetch the timestamp from the last update
*******************************************************************/
uint32_t trustdom_cache_fetch_timestamp( void )
DEBUG(5, ("no timestamp for trusted domain cache located.\n"));
SAFE_FREE(value);
return 0;
- }
+ }
timestamp = atoi(value);
}
/*******************************************************************
- store the timestamp from the last update
+ store the timestamp from the last update
*******************************************************************/
bool trustdom_cache_store_timestamp( uint32_t t, time_t timeout )
if (!gencache_set(TDOMTSKEY, value, timeout)) {
DEBUG(5, ("failed to set timestamp for trustdom_cache\n"));
return False;
- }
+ }
return True;
}
void trustdom_cache_flush(void)
{
- /*
+ /*
* iterate through each TDOM cache's entry and flush it
* by flush_trustdom_name function
*/
}
/********************************************************************
- update the trustdom_cache if needed
+ update the trustdom_cache if needed
********************************************************************/
#define TRUSTDOM_UPDATE_INTERVAL 600
time_t now = time(NULL);
int i;
- /* get the timestamp. We have to initialise it if the last timestamp == 0 */
- if ( (last_check = trustdom_cache_fetch_timestamp()) == 0 )
+ /* get the timestamp. We have to initialise it if the last timestamp == 0 */
+ if ( (last_check = trustdom_cache_fetch_timestamp()) == 0 )
trustdom_cache_store_timestamp(0, now+TRUSTDOM_UPDATE_INTERVAL);
time_diff = (int) (now - last_check);
/* get the domains and store them */
- if ( enumerate_domain_trusts(mem_ctx, lp_workgroup(), &domain_names,
+ if ( enumerate_domain_trusts(mem_ctx, lp_workgroup(), &domain_names,
&num_domains, &dom_sids)) {
for ( i=0; i<num_domains; i++ ) {
- trustdom_cache_store( domain_names[i], NULL, &dom_sids[i],
+ trustdom_cache_store( domain_names[i], NULL, &dom_sids[i],
now+TRUSTDOM_UPDATE_INTERVAL);
- }
+ }
} else {
/* we failed to fetch the list of trusted domains - restore the old
timestamp */
- trustdom_cache_store_timestamp(last_check,
+ trustdom_cache_store_timestamp(last_check,
last_check+TRUSTDOM_UPDATE_INTERVAL);
}
-done:
+done:
talloc_destroy( mem_ctx );
return;