summaryrefslogtreecommitdiff
path: root/source3/lib/smbconf
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-26 23:11:04 +0100
committerMichael Adam <obnox@samba.org>2008-03-27 00:32:09 +0100
commit1c8ad296b9e11b39da5acd1cdd9c71861fb6d67b (patch)
tree564513dd62be83fda335b02aee9fa1a8c786ac9a /source3/lib/smbconf
parentf4f0d39bfa929f8127505d318667010750c421ca (diff)
downloadsamba-1c8ad296b9e11b39da5acd1cdd9c71861fb6d67b.tar.gz
samba-1c8ad296b9e11b39da5acd1cdd9c71861fb6d67b.tar.bz2
samba-1c8ad296b9e11b39da5acd1cdd9c71861fb6d67b.zip
libsmbconf: in text backend, put flushing of the cache into a helper function.
And use it also in the close operation. Michael (This used to be commit 8cb288124993eb59459e7e9777c65e58c0554d55)
Diffstat (limited to 'source3/lib/smbconf')
-rw-r--r--source3/lib/smbconf/smbconf_txt_simple.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/lib/smbconf/smbconf_txt_simple.c b/source3/lib/smbconf/smbconf_txt_simple.c
index 4bd3eeeb2b..f149a1623c 100644
--- a/source3/lib/smbconf/smbconf_txt_simple.c
+++ b/source3/lib/smbconf/smbconf_txt_simple.c
@@ -168,6 +168,16 @@ static bool smbconf_txt_do_parameter(const char *param_name,
return W_ERROR_IS_OK(werr);
}
+static void smbconf_txt_flush_cache(struct smbconf_ctx *ctx)
+{
+ TALLOC_FREE(pd(ctx)->cache.share_names);
+ pd(ctx)->cache.current_share = 0;
+ pd(ctx)->cache.num_shares = 0;
+ TALLOC_FREE(pd(ctx)->cache.param_names);
+ TALLOC_FREE(pd(ctx)->cache.param_values);
+ TALLOC_FREE(pd(ctx)->cache.num_params);
+}
+
static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx)
{
uint64_t new_csn = (uint64_t)file_modtime(ctx->path);
@@ -176,12 +186,7 @@ static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx)
return WERR_OK;
}
- TALLOC_FREE(pd(ctx)->cache.share_names);
- pd(ctx)->cache.current_share = 0;
- pd(ctx)->cache.num_shares = 0;
- TALLOC_FREE(pd(ctx)->cache.param_names);
- TALLOC_FREE(pd(ctx)->cache.param_values);
- TALLOC_FREE(pd(ctx)->cache.num_params);
+ smbconf_txt_flush_cache(ctx);
if (!pm_process(ctx->path, smbconf_txt_do_section,
smbconf_txt_do_parameter, pd(ctx)))
@@ -231,6 +236,7 @@ static WERROR smbconf_txt_open(struct smbconf_ctx *ctx)
static int smbconf_txt_close(struct smbconf_ctx *ctx)
{
+ smbconf_txt_flush_cache(ctx);
return 0;
}