summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2017-11-22 11:49:57 +0100
committerJeremy Allison <jra@samba.org>2017-11-27 22:08:17 +0100
commit1fc103547023aa1c880713e5b65ec164acb58b54 (patch)
treeea7a25006686b9a6d1a19a606f6f94e549b3feb2 /source3/param
parent81e9ae1368c34bf59d0a100c9f03ea67d64f2979 (diff)
downloadsamba-1fc103547023aa1c880713e5b65ec164acb58b54.tar.gz
s3/loadparm: allocate a fresh sDefault object per lp_ctx
This is in preperation of preventing direct access to sDefault in all places that currently modify it. As currently s3/loadparm is afaict not accessing lp_ctx->sDefault, but changes sDefault indirectly through lp_parm_ptr() this change is just a safety measure to prevent future breakage. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13051 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d3463246704..433727b3f79 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -968,7 +968,14 @@ static struct loadparm_context *setup_lp_context(TALLOC_CTX *mem_ctx)
return NULL;
}
- lp_ctx->sDefault = &sDefault;
+ lp_ctx->sDefault = talloc_zero(lp_ctx, struct loadparm_service);
+ if (lp_ctx->sDefault == NULL) {
+ DBG_ERR("talloc_zero failed\n");
+ TALLOC_FREE(lp_ctx);
+ return NULL;
+ }
+
+ *lp_ctx->sDefault = sDefault;
lp_ctx->services = NULL; /* We do not want to access this directly */
lp_ctx->bInGlobalSection = bInGlobalSection;
lp_ctx->flags = flags_list;