summaryrefslogtreecommitdiff
path: root/source4/param/share_classic.c
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-01-17 10:16:12 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-02-20 10:11:00 +1300
commitbce62e600085270f26053882c5a4e35f5fe4fb5e (patch)
tree36be15d3c9867498693ae247c119c18b933e835f /source4/param/share_classic.c
parent497f0327a08fbfa444308c90a418ccb6b45b96d6 (diff)
downloadsamba-bce62e600085270f26053882c5a4e35f5fe4fb5e.tar.gz
s4: pass down a memory context when performing share_string_option, to allow substitutions
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Change-Id: I24b36db3ac11834c3268b2da929e214c10268b16 Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
Diffstat (limited to 'source4/param/share_classic.c')
-rw-r--r--source4/param/share_classic.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c
index 9f00a6847ff..74a454e5e16 100644
--- a/source4/param/share_classic.c
+++ b/source4/param/share_classic.c
@@ -43,9 +43,10 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
-static const char *sclassic_string_option(struct share_config *scfg,
- const char *opt_name,
- const char *defval)
+static char *sclassic_string_option(TALLOC_CTX *mem_ctx,
+ struct share_config *scfg,
+ const char *opt_name,
+ const char *defval)
{
struct loadparm_service *s = talloc_get_type(scfg->opaque,
struct loadparm_service);
@@ -68,11 +69,11 @@ static const char *sclassic_string_option(struct share_config *scfg,
ret = defval;
}
talloc_free(parm);
- return ret;
+ return talloc_strdup(mem_ctx, ret);
}
if (strcmp(opt_name, SHARE_NAME) == 0) {
- return scfg->name;
+ return talloc_strdup(mem_ctx, scfg->name);
}
if (strcmp(opt_name, SHARE_PATH) == 0) {
@@ -84,27 +85,27 @@ static const char *sclassic_string_option(struct share_config *scfg,
}
if (strcmp(opt_name, SHARE_VOLUME) == 0) {
- return lpcfg_volume_label(s, lpcfg_default_service(lp_ctx));
+ return talloc_strdup(mem_ctx, lpcfg_volume_label(s, lpcfg_default_service(lp_ctx)));
}
if (strcmp(opt_name, SHARE_TYPE) == 0) {
if (lpcfg_printable(s, lpcfg_default_service(lp_ctx))) {
- return "PRINTER";
+ return talloc_strdup(mem_ctx, "PRINTER");
}
if (strcmp("NTFS", lpcfg_fstype(s, lpcfg_default_service(lp_ctx))) == 0) {
- return "DISK";
+ return talloc_strdup(mem_ctx, "DISK");
}
- return lpcfg_fstype(s, lpcfg_default_service(lp_ctx));
+ return talloc_strdup(mem_ctx, lpcfg_fstype(s, lpcfg_default_service(lp_ctx)));
}
if (strcmp(opt_name, SHARE_PASSWORD) == 0) {
- return defval;
+ return talloc_strdup(mem_ctx, defval);
}
DEBUG(0,("request for unknown share string option '%s'\n",
opt_name));
- return defval;
+ return talloc_strdup(mem_ctx, defval);
}
static int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval)