summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-08 10:30:36 +0200
committerAndrew Bartlett <abartlet@samba.org>2011-05-08 10:56:28 +0200
commit958368efd0f0db4a0e77f6a374d3c7b5056105c6 (patch)
treee873596dc88e00449b742fb00c84ba46066fccc4
parentf946668b7ad1ecc1990fa8ee0499c63c4aac6ea6 (diff)
downloadsamba-958368efd0f0db4a0e77f6a374d3c7b5056105c6.tar.gz
samba-958368efd0f0db4a0e77f6a374d3c7b5056105c6.tar.bz2
samba-958368efd0f0db4a0e77f6a374d3c7b5056105c6.zip
s4-param Don't set variables such as the debuglevel unless global
This ensures that when a second lp_ctx is created, that it does not set global variables such as the debug level, log file etc, potentially overriding the settings created by another context. In particular this matters when loading Samba4 modules into Samba3. Andrew Bartlett
-rw-r--r--source4/param/loadparm.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 79706b4f09..ca87870c72 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -533,6 +533,8 @@ struct loadparm_context {
unsigned int flags[NUMPARAMETERS];
bool loaded;
bool refuse_free;
+ bool global; /* Is this the global context, which may set
+ * global variables such as debug level etc? */
};
@@ -1550,14 +1552,19 @@ static bool handle_debuglevel(struct loadparm_context *lp_ctx,
{
string_set(lp_ctx, ptr, pszParmValue);
- return debug_parse_levels(pszParmValue);
+ if (lp_ctx->global) {
+ return debug_parse_levels(pszParmValue);
+ }
+ return true;
}
static bool handle_logfile(struct loadparm_context *lp_ctx,
const char *pszParmValue, char **ptr)
{
debug_set_logfile(pszParmValue);
- string_set(lp_ctx, ptr, pszParmValue);
+ if (lp_ctx->global) {
+ string_set(lp_ctx, ptr, pszParmValue);
+ }
return true;
}
@@ -2561,6 +2568,7 @@ struct loadparm_context *loadparm_init_global(bool load_default)
if (global_loadparm_context == NULL) {
return NULL;
}
+ global_loadparm_context->global = true;
if (load_default && !global_loadparm_context->loaded) {
lpcfg_load_default(global_loadparm_context);
}
@@ -2594,6 +2602,10 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx)
lpcfg_do_global_parameter(lp_ctx, "wins server", "127.0.0.1");
}
+ if (!lp_ctx->global) {
+ return true;
+ }
+
panic_action = lp_ctx->globals->panic_action;
reload_charcnv(lp_ctx);
@@ -2818,6 +2830,10 @@ struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx)
_PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx)
{
struct smb_iconv_handle *old_ic = lp_ctx->iconv_handle;
+ if (!lp_ctx->global) {
+ return;
+ }
+
if (old_ic == NULL) {
old_ic = global_iconv_handle;
}