summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-12-29 16:26:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:59 -0500
commite13d0cb3ec89d83db8893341ca7ae24c07aad1fb (patch)
treed99483ec3e0f3cf2514b184eed2f7199fd05f1af /source3
parent7919fd0ec80e680d848dd6157b6a5d14fc42e9b6 (diff)
downloadsamba-e13d0cb3ec89d83db8893341ca7ae24c07aad1fb.tar.gz
samba-e13d0cb3ec89d83db8893341ca7ae24c07aad1fb.tar.bz2
samba-e13d0cb3ec89d83db8893341ca7ae24c07aad1fb.zip
r12576: r12115@cabra: derrell | 2005-12-29 11:16:03 -0500
bug (enhancement) #2651: add option to log debug messages to stderr instead of stdout (This used to be commit 4182eb99af5b343291a661a87d08edd91fd09a7a)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/libsmb_internal.h18
-rw-r--r--source3/libsmb/libsmbclient.c30
2 files changed, 41 insertions, 7 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 081bb415e5..0426430328 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -47,11 +47,12 @@ struct _SMBCFILE {
struct smbc_internal_data {
- /** INTERNAL: is this handle initialized ?
+ /*
+ * Is this handle initialized ?
*/
- int _initialized;
+ BOOL _initialized;
- /** INTERNAL: dirent pointer location
+ /* dirent pointer location
*
* Leave room for any urlencoded filename and the comment field.
*
@@ -64,13 +65,20 @@ struct smbc_internal_data {
*/
char _dirent[1024];
- /** INTERNAL: server connection list
+ /*
+ * server connection list
*/
SMBCSRV * _servers;
- /** INTERNAL: open file/dir list
+ /*
+ * open file/dir list
*/
SMBCFILE * _files;
+
+ /*
+ * Log to standard error instead of the more typical standard output
+ */
+ BOOL _debug_stderr;
};
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 8cfef769e5..6eca3946d8 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -5938,6 +5938,27 @@ smbc_free_context(SMBCCTX *context,
/*
+ * Each time the context structure is changed, we have binary backward
+ * compatibility issues. Instead of modifying the public portions of the
+ * context structure to add new options, instead, we put them in the internal
+ * portion of the context structure and provide a set function for these new
+ * options.
+ */
+void
+smbc_option_set(SMBCCTX *context,
+ char *option_name,
+ void *option_value)
+{
+ if (strcmp(option_name, "debug_stderr") == 0) {
+ /*
+ * Log to standard error instead of standard output.
+ */
+ context->internal->_debug_stderr = True;
+ }
+}
+
+
+/*
* Initialise the library etc
*
* We accept a struct containing handle information.
@@ -5982,7 +6003,12 @@ smbc_init_context(SMBCCTX *context)
DEBUGLEVEL = context->debug;
load_case_tables();
- setup_logging( "libsmbclient", True);
+
+ setup_logging("libsmbclient", True);
+ if (context->internal->_debug_stderr) {
+ dbf = x_stderr;
+ x_setbuf(x_stderr, NULL);
+ }
/* Here we would open the smb.conf file if needed ... */
@@ -6099,7 +6125,7 @@ smbc_init_context(SMBCCTX *context)
* FIXME: Should we check the function pointers here?
*/
- context->internal->_initialized = 1;
+ context->internal->_initialized = True;
return context;
}