diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-10-29 14:19:32 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-11-02 04:36:04 +0000 |
commit | 9da4ace1d9789d300ab298bc34694c44b2062f30 (patch) | |
tree | 0c4ce1fa4f3a97934c9504263fdfc86a28e39705 /source3/utils | |
parent | 4ae27891f8ac0a56d68b0544e78d6c17ade0c1c9 (diff) | |
download | samba-9da4ace1d9789d300ab298bc34694c44b2062f30.tar.gz samba-9da4ace1d9789d300ab298bc34694c44b2062f30.tar.bz2 samba-9da4ace1d9789d300ab298bc34694c44b2062f30.zip |
s3-debug Impove setup_logging() to specify logging to stderr
This change improves the setup_logging() API so that callers which
wish to set up logging to stderr can simply ask for it, rather than
directly modify the dbf global variable.
Andrew Bartlett
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/dbwrap_tool.c | 2 | ||||
-rw-r--r-- | source3/utils/dbwrap_torture.c | 2 | ||||
-rw-r--r-- | source3/utils/net.c | 3 | ||||
-rw-r--r-- | source3/utils/nmblookup.c | 2 | ||||
-rw-r--r-- | source3/utils/ntlm_auth.c | 2 | ||||
-rw-r--r-- | source3/utils/pdbedit.c | 2 | ||||
-rw-r--r-- | source3/utils/profiles.c | 4 | ||||
-rw-r--r-- | source3/utils/sharesec.c | 4 | ||||
-rw-r--r-- | source3/utils/smbcacls.c | 4 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 2 | ||||
-rw-r--r-- | source3/utils/smbcquotas.c | 4 | ||||
-rw-r--r-- | source3/utils/smbfilter.c | 2 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 2 | ||||
-rw-r--r-- | source3/utils/smbtree.c | 4 | ||||
-rw-r--r-- | source3/utils/split_tokens.c | 3 | ||||
-rw-r--r-- | source3/utils/status.c | 4 | ||||
-rw-r--r-- | source3/utils/testparm.c | 3 |
17 files changed, 18 insertions, 31 deletions
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c index da96bd706f..ef61ea9dbb 100644 --- a/source3/utils/dbwrap_tool.c +++ b/source3/utils/dbwrap_tool.c @@ -215,7 +215,7 @@ int main(int argc, const char **argv) load_case_tables(); DEBUGLEVEL_CLASS[DBGC_ALL] = 0; - dbf = x_stderr; + setup_logging(argv[0], DEBUG_STDERR); AllowDebugChange = false; lp_load(get_dyn_CONFIGFILE(), true, false, false, true); diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c index 2d9761bac4..35d0073489 100644 --- a/source3/utils/dbwrap_torture.c +++ b/source3/utils/dbwrap_torture.c @@ -258,6 +258,7 @@ int main(int argc, const char *argv[]) setlinebuf(stdout); } + setup_logging(argv[0], DEBUG_STDERR); DEBUGLEVEL_CLASS[DBGC_ALL] = 0; pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); @@ -279,7 +280,6 @@ int main(int argc, const char *argv[]) } load_case_tables(); - dbf = x_stderr; AllowDebugChange = false; lp_load(get_dyn_CONFIGFILE(), true, false, false, true); diff --git a/source3/utils/net.c b/source3/utils/net.c index 9585398a56..6993f9e52c 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -822,6 +822,8 @@ static struct functable net_func[] = { zero_sockaddr(&c->opt_dest_ip); + setup_logging(argv[0], DEBUG_STDERR); + load_case_tables(); setlocale(LC_ALL, ""); @@ -834,7 +836,6 @@ static struct functable net_func[] = { /* set default debug level to 0 regardless of what smb.conf sets */ DEBUGLEVEL_CLASS[DBGC_ALL] = 0; - dbf = x_stderr; c->private_data = net_func; pc = poptGetContext(NULL, argc, (const char **) argv, long_options, diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index 1187c96d73..d7e0cb23ce 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -259,7 +259,7 @@ int main(int argc,char *argv[]) load_case_tables(); - setup_logging(argv[0],True); + setup_logging(argv[0], DEBUG_STDOUT); pc = poptGetContext("nmblookup", argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index f8145b4a6d..9f0c839186 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -2557,7 +2557,7 @@ enum { /* Samba client initialisation */ load_case_tables(); - dbf = x_stderr; + setup_logging("ntlm_auth", DEBUG_STDERR); /* Parse options */ diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 5482b1099e..400805375e 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -1058,7 +1058,7 @@ int main (int argc, char **argv) load_case_tables(); - setup_logging("pdbedit", True); + setup_logging("pdbedit", DEBUG_STDOUT); pc = poptGetContext(NULL, argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index 50c9d534e9..53862f441f 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -215,9 +215,7 @@ int main( int argc, char *argv[] ) /* setup logging options */ - setup_logging( "profiles", True ); - dbf = x_stderr; - x_setbuf( x_stderr, NULL ); + setup_logging( "profiles", DEBUG_STDERR); pc = poptGetContext("profiles", argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c index a945fe58f6..ae959bafb5 100644 --- a/source3/utils/sharesec.c +++ b/source3/utils/sharesec.c @@ -543,10 +543,8 @@ int main(int argc, const char *argv[]) } /* set default debug level to 1 regardless of what smb.conf sets */ - setup_logging( "sharesec", True ); + setup_logging( "sharesec", DEBUG_STDERR); DEBUGLEVEL_CLASS[DBGC_ALL] = 1; - dbf = x_stderr; - x_setbuf( x_stderr, NULL ); pc = poptGetContext("sharesec", argc, argv, long_options, 0); diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index d9a4304463..5ccdae6d08 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -1203,10 +1203,8 @@ static struct cli_state *connect_one(struct user_auth_info *auth_info, /* set default debug level to 1 regardless of what smb.conf sets */ - setup_logging( "smbcacls", True ); + setup_logging( "smbcacls", DEBUG_STDERR); DEBUGLEVEL_CLASS[DBGC_ALL] = 1; - dbf = x_stderr; - x_setbuf( x_stderr, NULL ); AllowDebugChange = false; setlinebuf(stdout); diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 998971dfa2..f4daf83088 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -1379,7 +1379,7 @@ int main(int argc, const char **argv) load_case_tables(); - setup_logging(argv[0],True); + setup_logging(argv[0], DEBUG_STDOUT); /* Parse command line arguments using popt */ diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index 8ee573eafc..9721bc0b47 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -464,10 +464,8 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, ZERO_STRUCT(qt); /* set default debug level to 1 regardless of what smb.conf sets */ - setup_logging( "smbcquotas", True ); + setup_logging( "smbcquotas", DEBUG_STDERR); DEBUGLEVEL_CLASS[DBGC_ALL] = 1; - dbf = x_stderr; - x_setbuf( x_stderr, NULL ); setlinebuf(stdout); diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index 9d3e46825f..2f78140897 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -295,7 +295,7 @@ int main(int argc, char *argv[]) load_case_tables(); - setup_logging(argv[0],True); + setup_logging(argv[0], DEBUG_STDOUT); configfile = get_dyn_CONFIGFILE(); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 2ae7e4dcdf..0fc002ad8a 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -584,7 +584,7 @@ int main(int argc, char **argv) local_flags = process_options(argc, argv, local_flags); - setup_logging("smbpasswd", True); + setup_logging("smbpasswd", DEBUG_STDERR); /* * Set the machine NETBIOS name if not already diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index f27011cdea..c6d4be0e44 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -291,9 +291,7 @@ static bool print_tree(struct user_auth_info *user_info) setlinebuf(stdout); - dbf = x_stderr; - - setup_logging(argv[0],True); + setup_logging(argv[0], DEBUG_STDERR); auth_info = user_auth_info_init(frame); if (auth_info == NULL) { diff --git a/source3/utils/split_tokens.c b/source3/utils/split_tokens.c index 6c49b8b6e7..e07d03aded 100644 --- a/source3/utils/split_tokens.c +++ b/source3/utils/split_tokens.c @@ -50,7 +50,7 @@ int main(int argc, const char *argv[]) while(poptGetNextOpt(pc) != -1); - setup_logging(poptGetArg(pc), true); + setup_logging(poptGetArg(pc), DEBUG_STDERR); sequence = poptGetArg(pc); @@ -59,7 +59,6 @@ int main(int argc, const char *argv[]) return 1; } - dbf = x_stderr; DEBUGLEVEL = 0; AllowDebugChange = false; diff --git a/source3/utils/status.c b/source3/utils/status.c index ecfbf06137..1ad2e9b109 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -309,9 +309,7 @@ static int traverse_sessionid(const char *key, struct sessionid *session, sec_init(); load_case_tables(); - setup_logging(argv[0],True); - - dbf = x_stderr; + setup_logging(argv[0], DEBUG_STDERR); if (getuid() != geteuid()) { d_printf("smbstatus should not be run setuid\n"); diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 6d606bba41..8b8a31ea40 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -365,7 +365,7 @@ rameter is ignored when using CUPS libraries.\n", exit(0); } - setup_logging(poptGetArg(pc), True); + setup_logging(poptGetArg(pc), DEBUG_STDERR); if (poptPeekArg(pc)) config_file = poptGetArg(pc); @@ -381,7 +381,6 @@ rameter is ignored when using CUPS libraries.\n", goto done; } - dbf = x_stderr; /* Don't let the debuglevel be changed by smb.conf. */ AllowDebugChange = False; |