diff options
author | Michael Adam <obnox@samba.org> | 2008-03-10 17:16:01 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-03-10 17:22:41 +0100 |
commit | 9fa02847b7c07ec3b1136261d54bbed7706dd0af (patch) | |
tree | 9ee2df677a1555c4e6bc036f245a0ee42cda1887 /source3 | |
parent | 080fedd25ee56ebd437a4b86469922d00babf619 (diff) | |
download | samba-9fa02847b7c07ec3b1136261d54bbed7706dd0af.tar.gz samba-9fa02847b7c07ec3b1136261d54bbed7706dd0af.tar.bz2 samba-9fa02847b7c07ec3b1136261d54bbed7706dd0af.zip |
loadparm: fix init_globals() to re-init all options event when called 2nd time.
Up to the globals had only been fully reset when init_globals() was called
for the first time. But a full restart is needed for use with
"config backend = registry". (And should be with "config file = ...", but
in this case the restart is outsourced to the daemons.) This left
some options (like e.g. "realm") set to values that were set in smb.conf
before the occurence of "config backend = registry".
Now this misbehaviour is fixed with this change.
Michael
(This used to be commit f12259d9c4c34b99f5b655cab4b210159cb0e188)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d17fa16cbb..aaeafac21e 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4535,6 +4535,7 @@ static void init_globals(bool first_time_only) { static bool done_init = False; char *s = NULL; + int i; /* If requested to initialize only once and we've already done it... */ if (first_time_only && done_init) { @@ -4543,30 +4544,39 @@ static void init_globals(bool first_time_only) } if (!done_init) { - int i; - /* The logfile can be set before this is invoked. Free it if so. */ if (Globals.szLogFile != NULL) { string_free(&Globals.szLogFile); Globals.szLogFile = NULL; } - - memset((void *)&Globals, '\0', sizeof(Globals)); - - for (i = 0; parm_table[i].label; i++) + done_init = True; + } else { + for (i = 0; parm_table[i].label; i++) { if ((parm_table[i].type == P_STRING || parm_table[i].type == P_USTRING) && parm_table[i].ptr) - string_set((char **)parm_table[i].ptr, ""); - - string_set(&sDefault.fstype, FSTYPE_STRING); - string_set(&sDefault.szPrintjobUsername, "%U"); + { + string_free((char **)parm_table[i].ptr); + } + } + } - init_printer_values(&sDefault); + memset((void *)&Globals, '\0', sizeof(Globals)); - done_init = True; + for (i = 0; parm_table[i].label; i++) { + if ((parm_table[i].type == P_STRING || + parm_table[i].type == P_USTRING) && + parm_table[i].ptr) + { + string_set((char **)parm_table[i].ptr, ""); + } } + string_set(&sDefault.fstype, FSTYPE_STRING); + string_set(&sDefault.szPrintjobUsername, "%U"); + + init_printer_values(&sDefault); + DEBUG(3, ("Initialising global parameters\n")); |