lib: Add a "mem_ctx" arg to gencache_get (unused so far)
authorVolker Lendecke <vl@samba.org>
Wed, 4 Sep 2013 06:56:23 +0000 (08:56 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 5 Sep 2013 16:16:23 +0000 (09:16 -0700)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
14 files changed:
source3/auth/user_util.c
source3/include/proto.h
source3/lib/gencache.c
source3/lib/idmap_cache.c
source3/lib/wins_srv.c
source3/libads/sitename_cache.c
source3/libsmb/conncache.c
source3/libsmb/namecache.c
source3/libsmb/namequery.c
source3/libsmb/trustdom_cache.c
source3/passdb/account_pol.c
source3/rpc_server/spoolss/srv_spoolss_nt.c
source3/torture/torture.c
source3/winbindd/winbindd_cm.c

index 082c885f7aa98df3722292ed115221ec8865b630..b52f1dd5bcbde0ee8e7555b1c6a0ae961d472c5f 100644 (file)
@@ -96,7 +96,7 @@ static bool fetch_map_from_gencache(TALLOC_CTX *ctx,
        if (key == NULL) {
                return false;
        }
-       found = gencache_get(key, &value, NULL);
+       found = gencache_get(key, NULL, &value, NULL);
        TALLOC_FREE(key);
        if (!found) {
                return false;
index 5985d23b65fab299ef76c0ef034704ad5d9db738..811fe4fd91c3449141c308d72ff5a3d914ab4e56 100644 (file)
@@ -107,7 +107,8 @@ struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_S
 
 bool gencache_set(const char *keystr, const char *value, time_t timeout);
 bool gencache_del(const char *keystr);
-bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+bool gencache_get(const char *keystr, TALLOC_CTX *mem_ctx, char **value,
+                 time_t *ptimeout);
 bool gencache_parse(const char *keystr,
                    void (*parser)(time_t timeout, DATA_BLOB blob,
                                   void *private_data),
index 0d5d9e8815f68f1db849caf6f2bc77889d595dc9..1ecaad5be53c887c0f15e2524ae70de34131a9b7 100644 (file)
@@ -705,7 +705,8 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
  * @retval False for failure
  **/
 
-bool gencache_get(const char *keystr, char **value, time_t *ptimeout)
+bool gencache_get(const char *keystr, TALLOC_CTX *mem_ctx, char **value,
+                 time_t *ptimeout)
 {
        DATA_BLOB blob;
        bool ret = False;
index edf37a84962c5d4476e561a1ac73035e41329388..627ced30b3504d7ff862073686a3d078738709a2 100644 (file)
@@ -48,7 +48,7 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
        if (key == NULL) {
                return false;
        }
-       ret = gencache_get(key, &value, &timeout);
+       ret = gencache_get(key, NULL, &value, &timeout);
        if (!ret) {
                goto done;
        }
@@ -209,7 +209,7 @@ bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired)
        if (key == NULL) {
                return false;
        }
-       ret = gencache_get(key, &value, &timeout);
+       ret = gencache_get(key, NULL, &value, &timeout);
        TALLOC_FREE(key);
        if (!ret) {
                return false;
@@ -246,7 +246,7 @@ bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired)
        if (key == NULL) {
                return false;
        }
-       ret = gencache_get(key, &value, &timeout);
+       ret = gencache_get(key, NULL, &value, &timeout);
        TALLOC_FREE(key);
        if (!ret) {
                return false;
@@ -431,7 +431,7 @@ static bool idmap_cache_del_xid(char t, int xid)
        time_t timeout;
        bool ret = true;
 
-       if (!gencache_get(key, &sid_str, &timeout)) {
+       if (!gencache_get(key, NULL, &sid_str, &timeout)) {
                DEBUG(3, ("no entry: %s\n", key));
                ret = false;
                goto done;
index fb5587f9ba8c4835435455fe21d12fd33ba621cd..6f7d5b3b0c62855e3c13fe777353504a23adeb5a 100644 (file)
@@ -101,7 +101,7 @@ bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip)
 
        /* If the key exists then the WINS server has been marked as dead */
 
-       result = gencache_get(keystr, NULL, NULL);
+       result = gencache_get(keystr, NULL, NULL, NULL);
        SAFE_FREE(keystr);
 
        DEBUG(4, ("wins_srv_is_dead: %s is %s\n", inet_ntoa(wins_ip),
index cb1bae5239db2771f55d3b5bd355cedab964568e..b0c4423106e0af4992b0918f3f6b2ee8981c0a40 100644 (file)
@@ -95,7 +95,7 @@ char *sitename_fetch(const char *realm)
 
        key = sitename_key(query_realm);
 
-       ret = gencache_get( key, &sitename, &timeout );
+       ret = gencache_get( key, NULL, &sitename, &timeout );
        SAFE_FREE(key);
        if ( !ret ) {
                DEBUG(5,("sitename_fetch: No stored sitename for %s\n",
index 66353188d2b3fa8f36b8727cfbcd3d38cc841527..dfc2f471acb34354df148ca349d09d5101828206 100644 (file)
@@ -143,7 +143,7 @@ NTSTATUS check_negative_conn_cache( const char *domain, const char *server)
        if (key == NULL)
                goto done;
 
-       if (gencache_get(key, &value, NULL))
+       if (gencache_get(key, NULL, &value, NULL))
                result = negative_conn_cache_valuedecode(value);
  done:
        DEBUG(9,("check_negative_conn_cache returning result %d for domain %s "
index 8571dfaca5289649bfeb0b8c3174da89d64280ec..ebd51fd919a50a5482519a4399303f4c39fc1e43 100644 (file)
@@ -156,7 +156,7 @@ bool namecache_fetch(const char *name,
                return False;
        }
 
-       if (!gencache_get(key, &value, &timeout)) {
+       if (!gencache_get(key, NULL, &value, &timeout)) {
                DEBUG(5, ("no entry for %s#%02X found.\n", name, name_type));
                SAFE_FREE(key);
                return False;
@@ -294,7 +294,7 @@ bool namecache_status_fetch(const char *keyname,
        if (!key)
                return False;
 
-       if (!gencache_get(key, &value, &timeout)) {
+       if (!gencache_get(key, NULL, &value, &timeout)) {
                DEBUG(5, ("namecache_status_fetch: no entry for %s found.\n",
                                        key));
                SAFE_FREE(key);
index d86c0ed909fe9948a69980b5d6c287a63bae90f3..15c7cacae56d6b7ab490f2fbec45df9046f222d1 100644 (file)
@@ -183,7 +183,7 @@ char *saf_fetch( const char *domain )
                return NULL;
        }
 
-       ret = gencache_get( key, &server, &timeout );
+       ret = gencache_get( key, NULL, &server, &timeout );
 
        TALLOC_FREE( key );
 
@@ -199,7 +199,7 @@ char *saf_fetch( const char *domain )
                return NULL;
        }
 
-       ret = gencache_get( key, &server, &timeout );
+       ret = gencache_get( key, NULL, &server, &timeout );
 
        TALLOC_FREE( key );
 
index dadc7518fde4cc07090d2bb254bb75aae1fafe29..81b366a4ccea56ce9c38ef0d9f50be94cf27c56a 100644 (file)
@@ -160,7 +160,7 @@ bool trustdom_cache_fetch(const char* name, struct dom_sid* sid)
        if (!key)
                return False;
 
-       if (!gencache_get(key, &value, &timeout)) {
+       if (!gencache_get(key, NULL, &value, &timeout)) {
                DEBUG(5, ("no entry for trusted domain %s found.\n", name));
                SAFE_FREE(key);
                return False;
@@ -191,7 +191,7 @@ uint32 trustdom_cache_fetch_timestamp( void )
        time_t timeout;
        uint32 timestamp;
 
-       if (!gencache_get(TDOMTSKEY, &value, &timeout)) {
+       if (!gencache_get(TDOMTSKEY, NULL, &value, &timeout)) {
                DEBUG(5, ("no timestamp for trusted domain cache located.\n"));
                SAFE_FREE(value);
                return 0;
index c94df2961a5dc57f9b4b0e56903eb021f67e69ef..14ff946b5103ed6ba46122705c7d5eeb683dad34 100644 (file)
@@ -446,7 +446,7 @@ bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value)
                goto done;
        }
 
-       if (gencache_get(cache_key, &cache_value, NULL)) {
+       if (gencache_get(cache_key, NULL, &cache_value, NULL)) {
                uint32 tmp = strtoul(cache_value, NULL, 10);
                *value = tmp;
                ret = True;
index a094b4945a497588dfbb397e7cf59f4fc6738642..37f11c78ee10bab99fe75f80217fa2acfef4f62a 100644 (file)
@@ -630,7 +630,8 @@ static WERROR set_printer_hnd_name(TALLOC_CTX *mem_ctx,
 
        cache_key = talloc_asprintf(talloc_tos(), "PRINTERNAME/%s",
                                    aprinter);
-       if ((cache_key != NULL) && gencache_get(cache_key, &tmp, NULL)) {
+       if ((cache_key != NULL) &&
+           gencache_get(cache_key, NULL, &tmp, NULL)) {
 
                found = (strcmp(tmp, printer_not_found) != 0);
                if (!found) {
index b18dd99f5cfa615f6ebdc6421bb1d4c6cd337ff6..f2446d1e34f9b85b86cda41ba50fdea1edd103af 100644 (file)
@@ -8130,12 +8130,12 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (!gencache_get("foo", NULL, NULL)) {
+       if (!gencache_get("foo", NULL, NULL, NULL)) {
                d_printf("%s: gencache_get() failed\n", __location__);
                return False;
        }
 
-       if (!gencache_get("foo", &val, &tm)) {
+       if (!gencache_get("foo", NULL, &val, &tm)) {
                d_printf("%s: gencache_get() failed\n", __location__);
                return False;
        }
@@ -8159,7 +8159,7 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
-       if (gencache_get("foo", &val, &tm)) {
+       if (gencache_get("foo", NULL, &val, &tm)) {
                d_printf("%s: gencache_get() on deleted entry "
                         "succeeded\n", __location__);
                return False;
@@ -8212,7 +8212,7 @@ static bool run_local_gencache(int dummy)
                         __location__);
                return false;
        }
-       if (gencache_get("blob", &val, &tm)) {
+       if (gencache_get("blob", NULL, &val, &tm)) {
                d_printf("%s: gencache_get succeeded\n", __location__);
                return false;
        }
index 4de91663631ec0373d42841f90a19bc8f2df6f33..0b8308a5e3104dbeef986016f9826cc4cd559394 100644 (file)
@@ -1512,7 +1512,7 @@ bool fetch_current_dc_from_gencache(TALLOC_CTX *mem_ctx,
        if (key == NULL) {
                goto done;
        }
-       if (!gencache_get(key, &value, NULL)) {
+       if (!gencache_get(key, NULL, &value, NULL)) {
                goto done;
        }
        p = strchr(value, ' ');