From: Ralph Boehme Date: Wed, 22 Nov 2017 10:49:57 +0000 (+0100) Subject: s3/loadparm: allocate a fresh sDefault object per lp_ctx X-Git-Tag: talloc-2.1.11~354 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fc103547023aa1c880713e5b65ec164acb58b54;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- 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;