1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

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 commit is contained in:
Michael Adam 2008-03-10 17:16:01 +01:00
parent ab70e781b2
commit f12259d9c4

View File

@ -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");
init_printer_values(&sDefault);
done_init = True;
{
string_free((char **)parm_table[i].ptr);
}
}
}
memset((void *)&Globals, '\0', sizeof(Globals));
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"));