libsmb: Simplify trustdom_cache_store
authorVolker Lendecke <vl@samba.org>
Tue, 24 Jan 2017 20:35:16 +0000 (21:35 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 14 Mar 2017 14:22:12 +0000 (15:22 +0100)
The additional arguments were never used

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/include/proto.h
source3/libsmb/trustdom_cache.c

index d0951262071cd31f9400fede7da8cbee10771366..bb4005618c4562b40552c905da2729585886504d 100644 (file)
@@ -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 );
index 82f0add076a1da310d6b186de003211e5bcbb1d9..4dcb11667414542a11c6d6f4ace48a7e4e489b38 100644 (file)
@@ -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<num_domains; i++ ) {
-                       trustdom_cache_store( domain_names[i], NULL, &dom_sids[i],
-                               now+TRUSTDOM_UPDATE_INTERVAL);
+                       trustdom_cache_store(domain_names[i], &dom_sids[i]);
                }
        } else {
                /* we failed to fetch the list of trusted domains - restore the old