The branch, master has been updated via 6e92505080fd6764461563e4fdf1172be1ba2963 (commit) via 0e95b807b9ff7dee9d53d7294011c6e8cd82fe0e (commit) from 15013090df1af6a4e8330f6708d5fc30174140a2 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6e92505080fd6764461563e4fdf1172be1ba2963 Author: Andrew Bartlett <abart...@samba.org> Date: Mon Jun 29 20:12:23 2009 +1000 Fix ndrdump to use a common setup_logging() API By adding a new common setup_logging_stdout() API, we no longer need to abuse the ABI compatability between the different setup_logging() calls in Samba3 and Samba4's DEBUG() subsystems. The revert of 49a6d757b4d944cd22c91b2838beb83f04fbe1e9 works with this to fix bug 6211. Andrew Bartlett commit 0e95b807b9ff7dee9d53d7294011c6e8cd82fe0e Author: Andrew Bartlett <abart...@samba.org> Date: Mon Jun 29 19:57:57 2009 +1000 Revert "s4:debug: make setup_logging() a bit more compatible with samba3" The problem is that the enum was previously a 'rachet', that is, it would only reset to a level higher than it was previouly set to. Changing the order broke file-based logging for our production sites. This reverts commit 49a6d757b4d944cd22c91b2838beb83f04fbe1e9. ----------------------------------------------------------------------- Summary of changes: lib/util/debug.c | 8 ++++++++ lib/util/debug.h | 13 +++++++++++-- librpc/tools/ndrdump.c | 2 +- source3/include/proto.h | 1 + source3/lib/debug.c | 9 +++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/debug.c b/lib/util/debug.c index 76178e2..996efdf 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -198,6 +198,14 @@ _PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtyp } /** + Just run logging to stdout for this program +*/ +_PUBLIC_ void setup_logging_stdout(void) +{ + setup_logging(NULL, DEBUG_STDOUT); +} + +/** return a string constant containing n tabs no more than 10 tabs are returned */ diff --git a/lib/util/debug.h b/lib/util/debug.h index 85e64fb..f0d1695 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -74,8 +74,12 @@ extern int DEBUGLEVEL; */ #define DEBUGTAB(n) do_debug_tab(n) -/** Possible destinations for the debug log */ -enum debug_logtype {DEBUG_FILE = 0, DEBUG_STDOUT = 1, DEBUG_STDERR = 2}; +/** Possible destinations for the debug log (in order of precedence - + * once set to DEBUG_FILE, it is not possible to reset to DEBUG_STDOUT + * for example. This makes it easy to override for debug to stderr on + * the command line, as the smb.conf cannot reset it back to + * file-based logging */ +enum debug_logtype {DEBUG_STDOUT = 0, DEBUG_FILE = 1, DEBUG_STDERR = 2}; /** the backend for debug messages. Note that the DEBUG() macro has already @@ -102,6 +106,11 @@ _PUBLIC_ void debug_schedule_reopen_logs(void); _PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype); /** + Just run logging to stdout for this program +*/ +_PUBLIC_ void setup_logging_stdout(void); + +/** return a string constant containing n tabs no more than 10 tabs are returned */ diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c index 69b304d..7126d26 100644 --- a/librpc/tools/ndrdump.c +++ b/librpc/tools/ndrdump.c @@ -179,7 +179,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force) dbf = x_stderr; - setup_logging(argv[0], true); + setup_logging_stdout(); pc = poptGetContext("ndrdump", argc, argv, long_options, 0); diff --git a/source3/include/proto.h b/source3/include/proto.h index 1a8a9a9..49afd8c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -466,6 +466,7 @@ void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32 void debug_init(void); void debug_register_msgs(struct messaging_context *msg_ctx); void setup_logging(const char *pname, bool interactive); +void setup_logging_stdout( void ); void debug_set_logfile(const char *name); bool reopen_logs( void ); void force_check_log_size( void ); diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 419af61..e7dcfb4 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -605,6 +605,15 @@ void setup_logging(const char *pname, bool interactive) #endif } +/** + Just run logging to stdout for this program +*/ +_PUBLIC_ void setup_logging_stdout(void) +{ + setup_logging(NULL, True); +} + + /*************************************************************************** Set the logfile name. **************************************************************************/ -- Samba Shared Repository