summaryrefslogtreecommitdiff
path: root/source3/utils
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/utils
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/utils')
-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
10 files changed, 9 insertions, 39 deletions
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)) {