diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-10-29 15:06:36 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-11-02 04:36:04 +0000 |
commit | cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb (patch) | |
tree | 9afa59acaf2a8665e9bc9dfc8bdc177db4a7ca36 /source3/lib | |
parent | 9da4ace1d9789d300ab298bc34694c44b2062f30 (diff) | |
download | samba-cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb.tar.gz samba-cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb.tar.bz2 samba-cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb.zip |
s3-debug Remove 'AllowDebugChange' and use lp_set_cmdline() instead
By removing this global variable, the API between the two different
debug systems is made more similar. Both s3 and s4 now have
lp_set_cmdline() which ensures that the smb.conf cannot overwrite
these the user-specified log level.
Andrew Bartlett
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/debug.c | 4 | ||||
-rw-r--r-- | source3/lib/netapi/netapi.c | 13 | ||||
-rw-r--r-- | source3/lib/popt_common.c | 4 |
3 files changed, 3 insertions, 18 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 321b08e099..ea0aad2c90 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -89,7 +89,6 @@ static struct { static char *debugf = NULL; bool debug_warn_unknown_class = True; bool debug_auto_add_unknown_class = True; -bool AllowDebugChange = True; /* used to check if the user specified a @@ -469,9 +468,6 @@ bool debug_parse_levels(const char *params_str) /* Just in case */ debug_init(); - if (AllowDebugChange == False) - return True; - params = str_list_make_v3(talloc_tos(), params_str, NULL); if (debug_parse_params(params)) { diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 3004246743..7b3ab321af 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -23,8 +23,6 @@ #include "secrets.h" #include "krb5_env.h" -extern bool AllowDebugChange; - struct libnetapi_ctx *stat_ctx = NULL; TALLOC_CTX *frame = NULL; static bool libnetapi_initialized = false; @@ -75,15 +73,11 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) return W_ERROR_V(WERR_NOMEM); } - if (!DEBUGLEVEL) { - DEBUGLEVEL = 0; - } + lp_set_cmdline("log level", "0"); /* prevent setup_logging() from closing x_stderr... */ setup_logging("libnetapi", DEBUG_STDERR); - AllowDebugChange = false; - load_case_tables(); if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { @@ -92,8 +86,6 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) return W_ERROR_V(WERR_GENERAL_FAILURE); } - AllowDebugChange = true; - init_names(); load_interfaces(); reopen_logs(); @@ -185,9 +177,8 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel) { - AllowDebugChange = true; ctx->debuglevel = talloc_strdup(ctx, debuglevel); - if (!debug_parse_levels(debuglevel)) { + if (!lp_set_cmdline("log level", debuglevel)) { return W_ERROR_V(WERR_GENERAL_FAILURE); } return NET_API_STATUS_SUCCESS; diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index a332cde566..32906432df 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -36,7 +36,6 @@ enum {OPT_OPTION=1}; -extern bool AllowDebugChange; extern bool override_logfile; static void set_logfile(poptContext con, const char * arg) @@ -107,8 +106,7 @@ static void popt_common_callback(poptContext con, case 'd': if (arg) { - debug_parse_levels(arg); - AllowDebugChange = False; + lp_set_cmdline("log level", arg); } break; |