From 5d763eb6ea1cde7066d7e7c34ca1fae7bdb4d674 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 24 Jan 2017 21:35:16 +0100 Subject: [PATCH] libsmb: Simplify trustdom_cache_store The additional arguments were never used Signed-off-by: Volker Lendecke Reviewed-by: Andreas Schneider --- source3/include/proto.h | 3 +-- source3/libsmb/trustdom_cache.c | 27 ++++++--------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index d0951262071..bb4005618c4 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -847,8 +847,7 @@ WERROR map_werror_from_unix(int error); /* The following definitions come from libsmb/trustdom_cache.c */ -bool trustdom_cache_store(const char *name, const char *alt_name, - const struct dom_sid *sid, time_t timeout); +bool trustdom_cache_store(const char *name, const struct dom_sid *sid); bool trustdom_cache_fetch(const char* name, struct dom_sid* sid); void trustdom_cache_flush(void); void update_trustdom_cache( void ); diff --git a/source3/libsmb/trustdom_cache.c b/source3/libsmb/trustdom_cache.c index 82f0add076a..4dcb1166741 100644 --- a/source3/libsmb/trustdom_cache.c +++ b/source3/libsmb/trustdom_cache.c @@ -31,6 +31,7 @@ #define TDOMKEY_FMT "TDOM/%s" #define TDOMTSKEY "TDOMCACHE/TIMESTAMP" +#define TRUSTDOM_UPDATE_INTERVAL 600 /** @@ -72,10 +73,9 @@ static char* trustdom_cache_key(const char* name) * false if store attempt failed **/ -bool trustdom_cache_store(const char *name, const char *alt_name, - const struct dom_sid *sid, time_t timeout) +bool trustdom_cache_store(const char *name, const struct dom_sid *sid) { - char *key, *alt_key; + char *key; fstring sid_string; bool ret; @@ -83,25 +83,12 @@ bool trustdom_cache_store(const char *name, const char *alt_name, sid_string_dbg(sid), name)); key = trustdom_cache_key(name); - alt_key = alt_name ? trustdom_cache_key(alt_name) : NULL; /* Generate string representation domain SID */ sid_to_fstring(sid_string, sid); - /* - * try to put the names in the cache - */ - if (alt_key) { - ret = gencache_set(alt_key, sid_string, timeout); - if ( ret ) { - ret = gencache_set(key, sid_string, timeout); - } - SAFE_FREE(alt_key); - SAFE_FREE(key); - return ret; - } - - ret = gencache_set(key, sid_string, timeout); + ret = gencache_set(key, sid_string, + time(NULL) + TRUSTDOM_UPDATE_INTERVAL); SAFE_FREE(key); return ret; } @@ -323,7 +310,6 @@ done: /******************************************************************** update the trustdom_cache if needed ********************************************************************/ -#define TRUSTDOM_UPDATE_INTERVAL 600 void update_trustdom_cache( void ) { @@ -362,8 +348,7 @@ void update_trustdom_cache( void ) if ( enumerate_domain_trusts(mem_ctx, lp_workgroup(), &domain_names, &num_domains, &dom_sids)) { for ( i=0; i