From cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 29 Oct 2010 15:06:36 +1100 Subject: 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 --- source3/lib/netapi/netapi.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'source3/lib/netapi/netapi.c') 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; -- cgit