1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-23 20:59:10 +03:00

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
This commit is contained in:
Andrew Bartlett
2010-10-29 15:06:36 +11:00
parent 9da4ace1d9
commit cf4de8ec2c
17 changed files with 16 additions and 75 deletions

View File

@ -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;