summaryrefslogtreecommitdiff
path: root/lib/param/loadparm.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2019-10-15 16:52:30 +0200
committerStefan Metzmacher <metze@samba.org>2019-11-27 10:25:32 +0000
commitef1f0e9ffe76eaee4b92241ea39d81ea553fa841 (patch)
treeec81dec9a4a95fd58a1d1bca7aba651bdfe32fa3 /lib/param/loadparm.c
parent3215d357e6af97ac05266b6ab5c8861d7f124815 (diff)
downloadsamba-ef1f0e9ffe76eaee4b92241ea39d81ea553fa841.tar.gz
param: add FN_{GLOBAL,LOCAL}_SUBSTITUTED_STRING support
Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/param/loadparm.c')
-rw-r--r--lib/param/loadparm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 759a0a8ca45..25cf4eb7785 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -167,6 +167,15 @@ static struct loadparm_context *global_loadparm_context;
return lp_ctx->globals->var_name ? talloc_strdup(ctx, lpcfg_string(lp_ctx->globals->var_name)) : talloc_strdup(ctx, ""); \
}
+#define FN_GLOBAL_SUBSTITUTED_STRING(fn_name,var_name) \
+ _PUBLIC_ char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx, \
+ const struct loadparm_substitution *lp_sub, TALLOC_CTX *mem_ctx) \
+{ \
+ if (lp_ctx == NULL) return NULL; \
+ return lpcfg_substituted_string(mem_ctx, lp_sub, \
+ lp_ctx->globals->var_name ? lp_ctx->globals->var_name : ""); \
+}
+
#define FN_GLOBAL_CONST_STRING(fn_name,var_name) \
_PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
if (lp_ctx == NULL) return NULL; \
@@ -199,6 +208,9 @@ static struct loadparm_context *global_loadparm_context;
return(talloc_strdup(ctx, lpcfg_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)))); \
}
+/* just a copy for now */
+#define FN_LOCAL_SUBSTITUTED_STRING(fn_name,val) FN_LOCAL_STRING(fn_name,val)
+
#define FN_LOCAL_CONST_STRING(fn_name,val) \
_PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
struct loadparm_service *sDefault) { \