summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-10-29 15:06:36 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-11-02 04:36:04 +0000
commitcf4de8ec2c8df2ceabbe3d836d296b058e7b19fb (patch)
tree9afa59acaf2a8665e9bc9dfc8bdc177db4a7ca36 /source3
parent9da4ace1d9789d300ab298bc34694c44b2062f30 (diff)
downloadsamba-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')
-rw-r--r--source3/client/client.c8
-rw-r--r--source3/lib/debug.c4
-rw-r--r--source3/lib/netapi/netapi.c13
-rw-r--r--source3/lib/popt_common.c4
-rw-r--r--source3/param/test_lp_load.c7
-rw-r--r--source3/torture/masktest.c4
-rw-r--r--source3/utils/dbwrap_tool.c5
-rw-r--r--source3/utils/dbwrap_torture.c5
-rw-r--r--source3/utils/net.c9
-rw-r--r--source3/utils/nmblookup.c2
-rw-r--r--source3/utils/sharesec.c2
-rw-r--r--source3/utils/smbcacls.c5
-rw-r--r--source3/utils/smbcquotas.c2
-rw-r--r--source3/utils/smbpasswd.c4
-rw-r--r--source3/utils/split_tokens.c7
-rw-r--r--source3/utils/testparm.c7
16 files changed, 15 insertions, 73 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index a7c09cf6c5..2c02e318a5 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -5047,7 +5047,7 @@ 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 );
- DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
+ lp_set_cmdline("log level", "1");
load_case_tables();
@@ -5190,12 +5190,6 @@ static int do_message_op(struct user_auth_info *a_info)
poptGetArg(pc));
}
- /*
- * Don't load debug level from smb.conf. It should be
- * set by cmdline arg or remain default (0)
- */
- AllowDebugChange = false;
-
/* save the workgroup...
FIXME!! do we need to do this for other options as well
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;
diff --git a/source3/param/test_lp_load.c b/source3/param/test_lp_load.c
index 94715b5a59..d5673587a0 100644
--- a/source3/param/test_lp_load.c
+++ b/source3/param/test_lp_load.c
@@ -20,8 +20,6 @@
#include "includes.h"
#include "popt_common.h"
-extern bool AllowDebugChange;
-
int main(int argc, const char **argv)
{
const char *config_file = get_dyn_CONFIGFILE();
@@ -41,7 +39,7 @@ int main(int argc, const char **argv)
TALLOC_CTX *frame = talloc_stackframe();
load_case_tables();
- DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+ lp_set_cmdline("log level", "0");
pc = poptGetContext(NULL, argc, argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
@@ -61,9 +59,6 @@ int main(int argc, const char **argv)
count = atoi(count_str);
}
- /* Don't let the debuglevel be changed by smb.conf. */
- AllowDebugChange = False;
-
for (i=0; i < count; i++) {
printf("call lp_load() #%d: ", i+1);
if (!lp_load_with_registry_shares(config_file,
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index b8bcb4ade0..335bc4ca22 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -34,7 +34,6 @@ static int ignore_dot_errors = 0;
extern char *optarg;
extern int optind;
-extern bool AllowDebugChange;
/* a test fn for LANMAN mask support */
static int ms_fnmatch_lanman_core(const char *pattern, const char *string)
@@ -484,8 +483,7 @@ static void usage(void)
setlinebuf(stdout);
- DEBUGLEVEL = 0;
- AllowDebugChange = False;
+ lp_set_cmdline("log level", "0");
if (argc < 2 || argv[1][0] == '-') {
usage();
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index ef61ea9dbb..796bea938d 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -22,8 +22,6 @@
#include "includes.h"
#include "dbwrap.h"
-extern bool AllowDebugChange;
-
typedef enum { OP_FETCH, OP_STORE, OP_DELETE, OP_ERASE, OP_LISTKEYS } dbwrap_op;
typedef enum { TYPE_INT32, TYPE_UINT32 } dbwrap_type;
@@ -214,9 +212,8 @@ int main(int argc, const char **argv)
int ret = 1;
load_case_tables();
- DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+ lp_set_cmdline("log level", "0");
setup_logging(argv[0], DEBUG_STDERR);
- AllowDebugChange = false;
lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
if ((argc < 3) || (argc > 6)) {
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 35d0073489..abb17e8e2a 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -33,8 +33,6 @@
#include <time.h>
#endif
-extern bool AllowDebugChange;
-
#define DEFAULT_DB_NAME "transaction.tdb"
static int timelimit = 10;
@@ -259,7 +257,7 @@ int main(int argc, const char *argv[])
}
setup_logging(argv[0], DEBUG_STDERR);
- DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+ lp_set_cmdline("log level", "0");
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
@@ -280,7 +278,6 @@ int main(int argc, const char *argv[])
}
load_case_tables();
- AllowDebugChange = false;
lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
ev_ctx = tevent_context_init(mem_ctx);
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 6993f9e52c..44119dc2c6 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -47,8 +47,6 @@
#include "lib/netapi/netapi.h"
#include "../libcli/security/security.h"
-extern bool AllowDebugChange;
-
#ifdef WITH_FAKE_KASERVER
#include "utils/net_afs.h"
#endif
@@ -835,7 +833,7 @@ static struct functable net_func[] = {
#endif
/* set default debug level to 0 regardless of what smb.conf sets */
- DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+ lp_set_cmdline("log level", "0");
c->private_data = net_func;
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
@@ -874,11 +872,6 @@ static struct functable net_func[] = {
}
}
- /*
- * Don't load debug level from smb.conf. It should be
- * set by cmdline arg or remain default (0)
- */
- AllowDebugChange = false;
lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
argv_new = (const char **)poptGetArgs(pc);
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index d7e0cb23ce..b63b0a38e5 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -22,8 +22,6 @@
#include "includes.h"
#include "popt_common.h"
-extern bool AllowDebugChange;
-
static bool give_flags = false;
static bool use_bcast = true;
static bool got_bcast = false;
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index ae959bafb5..7ed238cdd4 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -544,7 +544,7 @@ int main(int argc, const char *argv[])
/* set default debug level to 1 regardless of what smb.conf sets */
setup_logging( "sharesec", DEBUG_STDERR);
- DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
+ lp_set_cmdline("log level", "1");
pc = poptGetContext("sharesec", argc, argv, long_options, 0);
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 5ccdae6d08..4de24dc767 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -27,8 +27,6 @@
#include "rpc_client/cli_lsarpc.h"
#include "../libcli/security/security.h"
-extern bool AllowDebugChange;
-
static int test_args;
#define CREATE_ACCESS_READ READ_CONTROL_ACCESS
@@ -1204,8 +1202,7 @@ 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", DEBUG_STDERR);
- DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
- AllowDebugChange = false;
+ lp_set_cmdline("log level", "1");
setlinebuf(stdout);
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 9721bc0b47..980ba2b5c1 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -465,7 +465,7 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
/* set default debug level to 1 regardless of what smb.conf sets */
setup_logging( "smbcquotas", DEBUG_STDERR);
- DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
+ lp_set_cmdline("log level", "1");
setlinebuf(stdout);
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 0fc002ad8a..c530c78f41 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -20,8 +20,6 @@
#include "secrets.h"
#include "../librpc/gen_ndr/samr.h"
-extern bool AllowDebugChange;
-
/*
* Next two lines needed for SunOS and don't
* hurt anything else...
@@ -570,8 +568,6 @@ int main(int argc, char **argv)
int local_flags = 0;
int ret;
- AllowDebugChange = False;
-
#if defined(HAVE_SET_AUTH_PARAMETERS)
set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */
diff --git a/source3/utils/split_tokens.c b/source3/utils/split_tokens.c
index e07d03aded..5d4b5a9260 100644
--- a/source3/utils/split_tokens.c
+++ b/source3/utils/split_tokens.c
@@ -26,8 +26,6 @@
#include "includes.h"
#include "popt_common.h"
-extern bool AllowDebugChange;
-
int main(int argc, const char *argv[])
{
const char *config_file = get_dyn_CONFIGFILE();
@@ -58,9 +56,8 @@ int main(int argc, const char *argv[])
fprintf(stderr, "ERROR: missing sequence string\n");
return 1;
}
-
- DEBUGLEVEL = 0;
- AllowDebugChange = false;
+
+ lp_set_cmdline("log level", "0");
if (!lp_load(config_file,false,true,false,true)) {
fprintf(stderr,"Error loading services.\n");
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 8b8a31ea40..b17d61b914 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -34,8 +34,6 @@
#include "includes.h"
#include "popt_common.h"
-extern bool AllowDebugChange;
-
/*******************************************************************
Check if a directory exists.
********************************************************************/
@@ -352,7 +350,7 @@ rameter is ignored when using CUPS libraries.\n",
* Allow it to be overridden by the command line,
* not by smb.conf.
*/
- DEBUGLEVEL_CLASS[DBGC_ALL] = 2;
+ lp_set_cmdline("log level", "2");
pc = poptGetContext(NULL, argc, argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
@@ -381,9 +379,6 @@ rameter is ignored when using CUPS libraries.\n",
goto done;
}
- /* Don't let the debuglevel be changed by smb.conf. */
- AllowDebugChange = False;
-
fprintf(stderr,"Load smb config files from %s\n",config_file);
if (!lp_load_with_registry_shares(config_file,False,True,False,True)) {