diff --git a/libgpo/pygpo.c b/libgpo/pygpo.c index 88486424917..cd107318860 100644 --- a/libgpo/pygpo.c +++ b/libgpo/pygpo.c @@ -93,7 +93,7 @@ static PyObject *py_gpo_get_unix_path(PyObject *self, PyObject *args, } if (!cache_dir) { - cache_dir = cache_path(GPO_CACHE_DIR); + cache_dir = cache_path(talloc_tos(), GPO_CACHE_DIR); if (!cache_dir) { PyErr_SetString(PyExc_MemoryError, "Failed to determine gpo cache dir"); diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 158554bd9a8..b4d374bf837 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -64,7 +64,7 @@ static bool gencache_init(void) hash_size = lp_parm_int(-1, "gencache", "hash_size", 10000); - cache_fname = cache_path("gencache.tdb"); + cache_fname = cache_path(talloc_tos(), "gencache.tdb"); if (cache_fname == NULL) { return false; } diff --git a/source3/lib/util_path.c b/source3/lib/util_path.c index efe3e608d7d..d9fed29c2a5 100644 --- a/source3/lib/util_path.c +++ b/source3/lib/util_path.c @@ -91,9 +91,9 @@ char *state_path(TALLOC_CTX *mem_ctx, const char *name) * @retval Pointer to a talloc'ed string containing the full path. **/ -char *cache_path(const char *name) +char *cache_path(TALLOC_CTX *mem_ctx, const char *name) { - return xx_path(talloc_tos(), name, lp_cache_directory()); + return xx_path(mem_ctx, name, lp_cache_directory()); } /** diff --git a/source3/lib/util_path.h b/source3/lib/util_path.h index b189b3e33cb..3e7d04de550 100644 --- a/source3/lib/util_path.h +++ b/source3/lib/util_path.h @@ -29,7 +29,7 @@ char *lock_path(TALLOC_CTX *mem_ctx, const char *name); char *state_path(TALLOC_CTX *mem_ctx, const char *name); -char *cache_path(const char *name); +char *cache_path(TALLOC_CTX *mem_ctx, const char *name); char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path); #endif diff --git a/source3/libgpo/gpext/registry.c b/source3/libgpo/gpext/registry.c index 5d51bdff6e9..525493fcb2c 100644 --- a/source3/libgpo/gpext/registry.c +++ b/source3/libgpo/gpext/registry.c @@ -291,7 +291,7 @@ static NTSTATUS registry_process_group_policy(TALLOC_CTX *mem_ctx, size_t num_entries = 0; char *unix_path = NULL; const struct GROUP_POLICY_OBJECT *gpo; - char *gpo_cache_path = cache_path(GPO_CACHE_DIR); + char *gpo_cache_path = cache_path(talloc_tos(), GPO_CACHE_DIR); if (gpo_cache_path == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/libgpo/gpext/scripts.c b/source3/libgpo/gpext/scripts.c index de664133b87..dfa9958e326 100644 --- a/source3/libgpo/gpext/scripts.c +++ b/source3/libgpo/gpext/scripts.c @@ -364,7 +364,7 @@ static NTSTATUS scripts_process_group_policy(TALLOC_CTX *mem_ctx, GP_SCRIPTS_INI_LOGOFF }; const struct GROUP_POLICY_OBJECT *gpo; - char *gpo_cache_path = cache_path(GPO_CACHE_DIR); + char *gpo_cache_path = cache_path(talloc_tos(), GPO_CACHE_DIR); if (gpo_cache_path == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/libgpo/gpext/security.c b/source3/libgpo/gpext/security.c index b6b7ca08e62..a915eec61e4 100644 --- a/source3/libgpo/gpext/security.c +++ b/source3/libgpo/gpext/security.c @@ -154,7 +154,7 @@ static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx, char *unix_path = NULL; struct gp_inifile_context *ini_ctx = NULL; const struct GROUP_POLICY_OBJECT *gpo; - char *gpo_cache_path = cache_path(GPO_CACHE_DIR); + char *gpo_cache_path = cache_path(talloc_tos(), GPO_CACHE_DIR); if (gpo_cache_path == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index ae77610ec99..74e89d7c38b 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -51,7 +51,7 @@ bool netsamlogon_cache_init(void) return true; } - path = cache_path(NETSAMLOGON_TDB); + path = cache_path(talloc_tos(), NETSAMLOGON_TDB); if (path == NULL) { return false; } diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index 05dcb6c7482..ad251833ed5 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -300,7 +300,7 @@ void write_browse_list(time_t t, bool force_write) updatecount++; - fname = cache_path(SERVER_LIST); + fname = cache_path(talloc_tos(), SERVER_LIST); if (!fname) { return; } diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c index eebb50a8b13..6b636b3c8b7 100644 --- a/source3/passdb/login_cache.c +++ b/source3/passdb/login_cache.c @@ -38,7 +38,7 @@ bool login_cache_init(void) /* skip file open if it's already opened */ if (cache) return True; - cache_fname = cache_path(LOGIN_CACHE_FILE); + cache_fname = cache_path(talloc_tos(), LOGIN_CACHE_FILE); if (cache_fname == NULL) { DEBUG(0, ("Filename allocation failed.\n")); return False; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 0acbb7e28ce..efdd6870999 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -204,7 +204,7 @@ bool print_backend_init(struct messaging_context *msg_ctx) return false; } - print_cache_path = cache_path("printing"); + print_cache_path = cache_path(talloc_tos(), "printing"); if (print_cache_path == NULL) { return false; } @@ -214,7 +214,7 @@ bool print_backend_init(struct messaging_context *msg_ctx) return false; } - print_cache_path = cache_path("printing.tdb"); + print_cache_path = cache_path(talloc_tos(), "printing.tdb"); if (print_cache_path == NULL) { return false; } diff --git a/source3/printing/printing_db.c b/source3/printing/printing_db.c index 7465195b771..3fa85579f20 100644 --- a/source3/printing/printing_db.c +++ b/source3/printing/printing_db.c @@ -95,7 +95,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername) DLIST_ADD(print_db_head, p); } - print_cache_path = cache_path("printing/"); + print_cache_path = cache_path(talloc_tos(), "printing/"); if (print_cache_path == NULL) { DLIST_REMOVE(print_db_head, p); SAFE_FREE(p); diff --git a/source3/profile/profile.c b/source3/profile/profile.c index 833c9c4425d..5deef81b6df 100644 --- a/source3/profile/profile.c +++ b/source3/profile/profile.c @@ -129,7 +129,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) return true; } - db_name = cache_path("smbprofile.tdb"); + db_name = cache_path(talloc_tos(), "smbprofile.tdb"); if (db_name == NULL) { return false; } diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 90906a204d4..dcc7f916d6e 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -1228,7 +1228,7 @@ static int get_session_info(uint32_t servertype, char **lines; bool local_list_only; int i; - char *slist_cache_path = cache_path(SERVER_LIST); + char *slist_cache_path = cache_path(talloc_tos(), SERVER_LIST); if (slist_cache_path == NULL) { return 0; } diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c index f2f65c8790e..791e836bfd9 100644 --- a/source3/utils/net_ads_gpo.c +++ b/source3/utils/net_ads_gpo.c @@ -100,7 +100,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg d_printf(_("finished\n")); d_printf(_("* Refreshing Group Policy Data ")); - gpo_cache_path = cache_path(GPO_CACHE_DIR); + gpo_cache_path = cache_path(talloc_tos(), GPO_CACHE_DIR); if (gpo_cache_path == NULL) { d_printf(_("failed: %s\n"), nt_errstr(NT_STATUS_NO_MEMORY)); goto out;