summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-26 12:59:01 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-26 14:06:07 +0200
commit8c466c14114f6f9fc1b731184067cbd134445ae5 (patch)
treee18c28dfbcbc3fae1039acf8d3e6f30fba21c9ca
parente0e3d215b1902ecbeb3d469af9a196856711921e (diff)
downloadsamba-8c466c14114f6f9fc1b731184067cbd134445ae5.tar.gz
samba-8c466c14114f6f9fc1b731184067cbd134445ae5.tar.bz2
samba-8c466c14114f6f9fc1b731184067cbd134445ae5.zip
s3-param: Allocate talloc stackframe before calling s3 param routines
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/param/loadparm_ctx.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c
index 5cf8ce67cd..3d3ff179fc 100644
--- a/source3/param/loadparm_ctx.c
+++ b/source3/param/loadparm_ctx.c
@@ -20,6 +20,30 @@
#include "includes.h"
#include "../source4/param/s3_param.h"
+static struct loadparm_service *lp_service_for_s4_ctx(const char *servicename)
+{
+ TALLOC_CTX *mem_ctx;
+ struct loadparm_service *service;
+
+ mem_ctx = talloc_stackframe();
+ service = lp_service(servicename);
+ talloc_free(mem_ctx);
+
+ return service;
+}
+
+static struct loadparm_service *lp_servicebynum_for_s4_ctx(int servicenum)
+{
+ TALLOC_CTX *mem_ctx;
+ struct loadparm_service *service;
+
+ mem_ctx = talloc_stackframe();
+ service = lp_servicebynum(servicenum);
+ talloc_free(mem_ctx);
+
+ return service;
+}
+
static bool lp_load_for_s4_ctx(const char *filename)
{
TALLOC_CTX *mem_ctx;
@@ -41,8 +65,8 @@ static const struct loadparm_s3_context s3_fns =
.get_parametric = lp_parm_const_string_service,
.get_parm_struct = lp_get_parameter,
.get_parm_ptr = lp_parm_ptr,
- .get_service = lp_service,
- .get_servicebynum = lp_servicebynum,
+ .get_service = lp_service_for_s4_ctx,
+ .get_servicebynum = lp_servicebynum_for_s4_ctx,
.get_default_loadparm_service = lp_default_loadparm_service,
.get_numservices = lp_numservices,
.load = lp_load_for_s4_ctx,