From ed111d11ebcbaa1e709485f86ca45e582a55301f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Oct 2010 21:10:31 +1100 Subject: s3-debug Move 'load_case_tables()' before lp_set_cmdline() and popt calls The problem here is that we cannot run lp_set_cmdline() (directly or indirectly via the popt helpers) until load_case_tables() has been run. However, load_case_tables does not have auto-initialisation, so we must init it once, and once only. Andrew Bartlett --- source3/client/client.c | 4 ++-- source3/smbd/server.c | 4 ++-- source3/utils/dbwrap_torture.c | 3 ++- source3/utils/sharesec.c | 5 +++-- source3/utils/smbcacls.c | 1 - source3/web/swat.c | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 2c02e318a5..51292680ba 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5047,10 +5047,10 @@ static int do_message_op(struct user_auth_info *a_info) /* set default debug level to 1 regardless of what smb.conf sets */ setup_logging( "smbclient", DEBUG_DEFAULT_STDERR ); - lp_set_cmdline("log level", "1"); - load_case_tables(); + lp_set_cmdline("log level", "1"); + auth_info = user_auth_info_init(frame); if (auth_info == NULL) { exit(1); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index ebcc8ab6d7..dd3ae3a730 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -869,6 +869,8 @@ extern void build_options(bool screen); talloc_enable_null_tracking(); frame = talloc_stackframe(); + load_case_tables(); + /* Initialize the event context, it will panic on error */ smbd_event_context(); @@ -926,8 +928,6 @@ extern void build_options(bool screen); exit(0); } - load_case_tables(); - #ifdef HAVE_SETLUID /* needed for SecureWare on SCO */ setluid(0); diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c index abb17e8e2a..22c0a64a52 100644 --- a/source3/utils/dbwrap_torture.c +++ b/source3/utils/dbwrap_torture.c @@ -256,6 +256,8 @@ int main(int argc, const char *argv[]) setlinebuf(stdout); } + load_case_tables(); + setup_logging(argv[0], DEBUG_STDERR); lp_set_cmdline("log level", "0"); @@ -277,7 +279,6 @@ int main(int argc, const char *argv[]) while (extra_argv[extra_argc]) extra_argc++; } - load_case_tables(); lp_load(get_dyn_CONFIGFILE(), true, false, false, true); ev_ctx = tevent_context_init(mem_ctx); diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c index 7ed238cdd4..1a12ce0228 100644 --- a/source3/utils/sharesec.c +++ b/source3/utils/sharesec.c @@ -544,6 +544,9 @@ int main(int argc, const char *argv[]) /* set default debug level to 1 regardless of what smb.conf sets */ setup_logging( "sharesec", DEBUG_STDERR); + + load_case_tables(); + lp_set_cmdline("log level", "1"); pc = poptGetContext("sharesec", argc, argv, long_options, 0); @@ -592,8 +595,6 @@ int main(int argc, const char *argv[]) setlinebuf(stdout); - load_case_tables(); - lp_load( get_dyn_CONFIGFILE(), False, False, False, True ); /* check for initializing secrets.tdb first */ diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 4de24dc767..bb438bab78 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -1199,7 +1199,6 @@ static struct cli_state *connect_one(struct user_auth_info *auth_info, load_case_tables(); - /* set default debug level to 1 regardless of what smb.conf sets */ setup_logging( "smbcacls", DEBUG_STDERR); lp_set_cmdline("log level", "1"); diff --git a/source3/web/swat.c b/source3/web/swat.c index 531cf3f411..bb3f3f974c 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -1420,6 +1420,8 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid) open("/dev/null", O_WRONLY); setup_logging("swat", DEBUG_FILE); + load_case_tables(); + pc = poptGetContext("swat", argc, (const char **) argv, long_options, 0); /* Parse command line options */ @@ -1428,8 +1430,6 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid) poptFreeContext(pc); - load_case_tables(); - /* This should set a more apporiate log file */ load_config(True); reopen_logs(); -- cgit