summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-08 12:09:24 +0200
committerMichael Adam <obnox@samba.org>2008-04-10 01:28:58 +0200
commitdde53e5d6817e21da33277f5c85655a839e85102 (patch)
tree033e967a93cbc1a7c36ad52ae1b346c07a8d3556
parent893ed44762cd64aa1dc3daf6936aa48de938bc92 (diff)
downloadsamba-dde53e5d6817e21da33277f5c85655a839e85102.tar.gz
samba-dde53e5d6817e21da33277f5c85655a839e85102.tar.bz2
samba-dde53e5d6817e21da33277f5c85655a839e85102.zip
libsmbconf: fill get_includes() in text backed to retrieve includes from cache.
Michael (This used to be commit 5e253e10b7f80af1f5a855c8e0f00846853cced1)
-rw-r--r--source3/lib/smbconf/smbconf_txt_simple.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/source3/lib/smbconf/smbconf_txt_simple.c b/source3/lib/smbconf/smbconf_txt_simple.c
index faf7ebb253..2183ac3bec 100644
--- a/source3/lib/smbconf/smbconf_txt_simple.c
+++ b/source3/lib/smbconf/smbconf_txt_simple.c
@@ -500,7 +500,59 @@ static WERROR smbconf_txt_get_includes(struct smbconf_ctx *ctx,
uint32_t *num_includes,
char ***includes)
{
- return WERR_NOT_SUPPORTED;
+ WERROR werr;
+ bool found;
+ uint32_t sidx, count;
+ TALLOC_CTX *tmp_ctx = NULL;
+ uint32_t tmp_num_includes = 0;
+ char **tmp_includes = NULL;
+
+ werr = smbconf_txt_load_file(ctx);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
+ found = smbconf_find_in_array(service,
+ pd(ctx)->cache->share_names,
+ pd(ctx)->cache->num_shares,
+ &sidx);
+ if (!found) {
+ return WERR_NO_SUCH_SERVICE;
+ }
+
+ tmp_ctx = talloc_stackframe();
+
+ for (count = 0; count < pd(ctx)->cache->num_params[sidx]; count++) {
+ if (strequal(pd(ctx)->cache->param_names[sidx][count],
+ "include"))
+ {
+ werr = smbconf_add_string_to_array(tmp_ctx,
+ &tmp_includes,
+ tmp_num_includes,
+ pd(ctx)->cache->param_values[sidx][count]);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+ tmp_num_includes++;
+ }
+ }
+
+ *num_includes = tmp_num_includes;
+ if (*num_includes > 0) {
+ *includes = talloc_move(mem_ctx, &tmp_includes);
+ if (*includes == NULL) {
+ werr = WERR_NOMEM;
+ goto done;
+ }
+ } else {
+ *includes = NULL;
+ }
+
+ werr = WERR_OK;
+
+done:
+ TALLOC_FREE(tmp_ctx);
+ return werr;
}
static WERROR smbconf_txt_set_includes(struct smbconf_ctx *ctx,