From 6dce5c47c62d6ad3d74489bde3824fbfb02d8616 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 1 Jun 2001 12:04:44 +0000 Subject: If a debug class was explicitly set to zero the debug system would not recognise it as there was no distinction made between zeroing a debug class and just not setting it to anything. I've added a debuglevel_isset array in parallel with the debuglevel_class array to fix this. Added a couple of new debug classes which I might start filling out to get smb, rpc header and rpc marshall/unmarshalling debugs tidied up. Fixed a bunch of cut&paste bugs in include/debug.h Modified smbcontrol and the messaging system debug handler to like the debuglevel_isset stuff. (This used to be commit 391e7caf76cbc22021629ef0ec5e0c32806edfd7) --- source3/lib/debug.c | 50 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 14 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 934110a4d7..bd8babf827 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -84,6 +84,7 @@ pstring debugf = ""; BOOL append_log = False; int DEBUGLEVEL_CLASS[DBGC_LAST]; +BOOL DEBUGLEVEL_CLASS_ISSET[DBGC_LAST]; int DEBUGLEVEL = DEBUGLEVEL_CLASS; @@ -129,13 +130,14 @@ static BOOL log_overflow = False; * must be in the table in the order of DBGC_.. */ char *classname_table[] = { - "all", /* DBGC_ALL; index references traditional DEBUGLEVEL */ - "tdb", /* DBGC_TDB */ + "all", /* DBGC_ALL; index refs traditional DEBUGLEVEL */ + "tdb", /* DBGC_TDB */ "printdrivers", /* DBGC_PRINTDRIVERS */ - "lanman", /* DBGC_LANMAN */ - "smb", /* DBGC_SMB */ - "rpc", /* DBGC_RPC */ - "rpc_hdr", /* DBGC_RPC_HDR */ + "lanman", /* DBGC_LANMAN */ + "smb", /* DBGC_SMB */ + "rpc", /* DBGC_RPC */ + "rpc_hdr", /* DBGC_RPC_HDR */ + "bdc", /* DBGC_BDC */ }; @@ -171,7 +173,8 @@ int debug_lookup_classname(char* classname) parse the debug levels from smbcontrol. Example debug level parameter: printdrivers:7 ****************************************************************************/ -BOOL debug_parse_params(char **params, int *debuglevel_class) +BOOL debug_parse_params(char **params, int *debuglevel_class, + BOOL *debuglevel_class_isset) { int i, ndx; char *class_name; @@ -185,10 +188,11 @@ BOOL debug_parse_params(char **params, int *debuglevel_class) */ if (isdigit((int)params[0][0])) { debuglevel_class[DBGC_ALL] = atoi(params[0]); + debuglevel_class_isset[DBGC_ALL] = True; i = 1; /* start processing at the next params */ } else - i = 0; /* DBGC_ALL not specified OR calss name was included */ + i = 0; /* DBGC_ALL not specified OR class name was included */ /* Fill in new debug class levels */ for (; i < DBGC_LAST && params[i]; i++) { @@ -196,6 +200,7 @@ BOOL debug_parse_params(char **params, int *debuglevel_class) (class_level=strtok(NULL, "\0")) && ((ndx = debug_lookup_classname(class_name)) != -1)) { debuglevel_class[ndx] = atoi(class_level); + debuglevel_class_isset[ndx] = True; } else { DEBUG(0,("debug_parse_params: unrecognized debug class name or format [%s]\n", params[i])); return False; @@ -215,9 +220,11 @@ BOOL debug_parse_levels(char *params_str) int i; char *params[DBGC_LAST]; int debuglevel_class[DBGC_LAST]; + BOOL debuglevel_class_isset[DBGC_LAST]; ZERO_ARRAY(params); ZERO_ARRAY(debuglevel_class); + ZERO_ARRAY(debuglevel_class_isset); if ((params[0]=strtok(params_str," ,"))) { for (i=1; idebuglevel_class, sizeof(dm->debuglevel_class)); + memcpy(DEBUGLEVEL_CLASS_ISSET, dm->debuglevel_class_isset, sizeof(dm->debuglevel_class_isset)); + DEBUG(1,("INFO: Debug class %s level = %d (pid %u from pid %u)\n", classname_table[DBGC_ALL], DEBUGLEVEL_CLASS[DBGC_ALL], (unsigned int)getpid(), (unsigned int)src)); -- cgit