mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3/loadparm: ensure default service options are not changed
Rename sDefault to _sDefault and make it const. sDefault is make a copy of _sDefault in in the initialisation function lp_load_ex(). As we may end up in setup_lp_context() without going through lp_load_ex(), sDefault may still be uninitialized at that point, so I'm initializing lp_ctx->sDefault from _sDefault. 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>
This commit is contained in:
parent
1fc1035470
commit
ea4e6f95ae
@ -111,7 +111,7 @@ static bool defaults_saved = false;
|
||||
static struct loadparm_global Globals;
|
||||
|
||||
/* This is a default service used to prime a services structure */
|
||||
static struct loadparm_service sDefault =
|
||||
static const struct loadparm_service _sDefault =
|
||||
{
|
||||
.valid = true,
|
||||
.autoloaded = false,
|
||||
@ -249,6 +249,12 @@ static struct loadparm_service sDefault =
|
||||
.dummy = ""
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a copy of the default service structure. Service options in the
|
||||
* global section would otherwise overwrite the initial default values.
|
||||
*/
|
||||
static struct loadparm_service sDefault;
|
||||
|
||||
/* local variables */
|
||||
static struct loadparm_service **ServicePtrs = NULL;
|
||||
static int iNumServices = 0;
|
||||
@ -975,7 +981,7 @@ static struct loadparm_context *setup_lp_context(TALLOC_CTX *mem_ctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*lp_ctx->sDefault = sDefault;
|
||||
*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;
|
||||
@ -3865,6 +3871,7 @@ static bool lp_load_ex(const char *pszFname,
|
||||
bInGlobalSection = true;
|
||||
bGlobalOnly = global_only;
|
||||
bAllowIncludeRegistry = allow_include_registry;
|
||||
sDefault = _sDefault;
|
||||
|
||||
lp_ctx = setup_lp_context(talloc_tos());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user