s3-debug Move 'load_case_tables()' before lp_set_cmdline() and popt calls
authorAndrew Bartlett <abartlet@samba.org>
Fri, 29 Oct 2010 10:10:31 +0000 (21:10 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 2 Nov 2010 04:36:04 +0000 (04:36 +0000)
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
source3/smbd/server.c
source3/utils/dbwrap_torture.c
source3/utils/sharesec.c
source3/utils/smbcacls.c
source3/web/swat.c

index 2c02e318a55f0d4ee6d59edeecd4aad096af4e8d..51292680ba879d57d50f04bd9cfba9155586f62a 100644 (file)
@@ -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);
index ebcc8ab6d7bedcd7c8bea3dc50c18820c009cdb9..dd3ae3a7306eec0c530d41ecd5129caef7487b0d 100644 (file)
@@ -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);
index abb17e8e2acd5bcccf01d91ac26fa14d5b2223ee..22c0a64a52ae77745cbd0bfa63087fbdcb67d738 100644 (file)
@@ -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);
index 7ed238cdd46173343186723bb4a33354cbd74852..1a12ce02285bbb6b63da85c828cc6cbe3d95d5e6 100644 (file)
@@ -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 */
index 4de24dc767c35613d807ca15935f5a01073ec2fb..bb438bab7844a7043fca0f511c74a3fb2b25765e 100644 (file)
@@ -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");
index 531cf3f41121497d339c10b597ca7335fb0192ea..bb3f3f974c6d3bd36915401e7e5c53660b852764 100644 (file)
@@ -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();