diff options
author | Ralph Boehme <slow@samba.org> | 2017-11-22 11:49:57 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-12-05 10:34:26 +0100 |
commit | 7dc2782ab51feb0ed55ab3ee8fe2b6748c404f3f (patch) | |
tree | 6ecd30a297aff301dbeedc25e3a7d0361f87b52c /source3/param | |
parent | e36b1cedc19c92f8d7c65beb8ece8acb2e1ce632 (diff) | |
download | samba-7dc2782ab51feb0ed55ab3ee8fe2b6748c404f3f.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>
(cherry picked from commit 1fc103547023aa1c880713e5b65ec164acb58b54)
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d5b1c56e21e..1cef3cbf69c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -959,7 +959,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; |