Blame SOURCES/openchange-2.2-samba-4.2.0-rc2.patch

17a85d
diff -up openchange-openchange-2.3-VULCAN/libmapi/cdo_mapi.c.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/libmapi/cdo_mapi.c
17a85d
--- openchange-openchange-2.3-VULCAN/libmapi/cdo_mapi.c.samba-4.2.0-rc2	2015-12-03 11:20:17.502119228 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/libmapi/cdo_mapi.c	2015-12-03 11:20:44.524118102 +0100
17a85d
@@ -337,6 +337,9 @@ _PUBLIC_ enum MAPISTATUS SetMAPIDebugLev
17a85d
 	ret = lpcfg_set_cmdline(mapi_ctx->lp_ctx, "log level", debuglevel);
17a85d
 	talloc_free(debuglevel);
17a85d
 
17a85d
+	if (ret)
17a85d
+		_oc_log_samba_level = level;
17a85d
+
17a85d
 	return (ret == true) ? MAPI_E_SUCCESS : MAPI_E_INVALID_PARAMETER;
17a85d
 }
17a85d
 
17a85d
diff -up openchange-openchange-2.3-VULCAN/libmapi/oc_log.c.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/libmapi/oc_log.c
17a85d
--- openchange-openchange-2.3-VULCAN/libmapi/oc_log.c.samba-4.2.0-rc2	2015-12-03 11:11:01.801142393 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/libmapi/oc_log.c	2015-12-03 11:27:22.921101494 +0100
17a85d
@@ -20,7 +20,9 @@
17a85d
 */
17a85d
 
17a85d
 #include "libmapi/libmapi.h"
17a85d
-#include <util/debug.h>
17a85d
+#include <stdio.h>
17a85d
+
17a85d
+int _oc_log_samba_level = 0;
17a85d
 
17a85d
 void oc_log(enum oc_log_level level, const char *fmt_string, ...)
17a85d
 {
17a85d
@@ -47,12 +49,16 @@ void oc_logv(enum oc_log_level level, co
17a85d
 		samba_level = 0;
17a85d
 	}
17a85d
 
17a85d
+	if (samba_level && !(_oc_log_samba_level & samba_level))
17a85d
+		return;
17a85d
+
17a85d
 	/* Add a trailing newline if one is not already present */
17a85d
 	if (line[strlen(line)-1] == '\n') {
17a85d
-		DEBUG(samba_level, ("%s", line));
17a85d
+		fprintf(stderr, "%s", line);
17a85d
 	} else {
17a85d
-		DEBUG(samba_level, ("%s\n", line));
17a85d
+		fprintf(stderr, "%s\n", line);
17a85d
 	}
17a85d
+	fflush(stderr);
17a85d
 }
17a85d
 
17a85d
 void oc_log_init_stdout()
17a85d
diff -up openchange-openchange-2.3-VULCAN/libmapi/oc_log.h.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/libmapi/oc_log.h
17a85d
--- openchange-openchange-2.3-VULCAN/libmapi/oc_log.h.samba-4.2.0-rc2	2015-12-03 11:18:27.407123817 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/libmapi/oc_log.h	2015-12-03 11:20:19.228119156 +0100
17a85d
@@ -77,4 +77,6 @@ void oc_log_init_user(const char *progna
17a85d
    defaulting to /var/log/openchange.log */
17a85d
 void oc_log_init_server(const char *progname, struct loadparm_context *lp_ctx);
17a85d
 
17a85d
+extern int _oc_log_samba_level; /* Private, do not change it other than by SetMAPIDebugLevel() */
17a85d
+
17a85d
 #endif /* _OC_LOG_H_ */
17a85d
diff -up openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.c.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.c
17a85d
--- openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.c.samba-4.2.0-rc2	2015-12-03 11:11:17.337141745 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.c	2015-12-03 11:27:46.505100511 +0100
17a85d
@@ -30,14 +30,14 @@
17a85d
 #include "fault_util.h"
17a85d
 #include "libmapi/libmapi.h"
17a85d
 #include "libmapi/libmapi_private.h"
17a85d
-#include <util/debug.h>
17a85d
+#include <stdio.h>
17a85d
 
17a85d
 #include <samba/version.h>
17a85d
 
17a85d
 #include <execinfo.h>
17a85d
 
17a85d
 /**
17a85d
-   \details print a backtrace using DEBUG() macro.
17a85d
+   \details print a backtrace (*not* using DEBUG() macro).
17a85d
 
17a85d
  */
17a85d
 _PUBLIC_ void debug_print_backtrace(int dbg_level)
17a85d
@@ -47,16 +47,19 @@ _PUBLIC_ void debug_print_backtrace(int
17a85d
 	size_t backtrace_size;
17a85d
 	char **backtrace_strings;
17a85d
 
17a85d
+	if (!(_oc_log_samba_level & dbg_level))
17a85d
+		return;
17a85d
+
17a85d
 	backtrace_size = backtrace(backtrace_stack, BACKTRACE_SIZE);
17a85d
 	backtrace_strings = backtrace_symbols(backtrace_stack, backtrace_size);
17a85d
 
17a85d
-	DEBUG(dbg_level, ("BACKTRACE: %lu stack frames:\n", (unsigned long)backtrace_size));
17a85d
+	fprintf(stderr, "BACKTRACE: %lu stack frames:\n", (unsigned long)backtrace_size);
17a85d
 
17a85d
 	if (backtrace_strings) {
17a85d
 		int i;
17a85d
 
17a85d
 		for (i = 0; i < backtrace_size; i++) {
17a85d
-			DEBUGADD(dbg_level, (" #%.2u %s\n", i, backtrace_strings[i]));
17a85d
+			fprintf(stderr, " #%.2u %s\n", i, backtrace_strings[i]);
17a85d
 		}
17a85d
 
17a85d
 		free(backtrace_strings);
17a85d
diff -up openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.h.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.h
17a85d
--- openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.h.samba-4.2.0-rc2	2015-12-03 11:11:37.089140922 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/fault_util.h	2015-12-03 11:26:38.633103340 +0100
17a85d
@@ -28,7 +28,7 @@
17a85d
  * It will print information about the error and if is_fatal is true abort()
17a85d
  * will be called.
17a85d
  *
17a85d
- * DEBUG macro will be used to print a report with the following format:
17a85d
+ * DEBUG macro will *not* be used to print a report with the following format:
17a85d
  * @code
17a85d
  *  ==================================
17a85d
  *  OPENCHANGE INTERNAL ERROR: pid 123
17a85d
@@ -59,9 +59,10 @@
17a85d
  * @see DEBUG()
17a85d
  */
17a85d
 #define OC_PANIC( is_fatal, body ) \
17a85d
-	DEBUGSEP(0); \
17a85d
-	DEBUG(0, ("OPENCHANGE INTERNAL ERROR: pid %d\n", (int)getpid())); \
17a85d
-	DEBUG(0, body); \
17a85d
+	fprintf(stderr,"\n"); \
17a85d
+	fprintf(stderr, "OPENCHANGE INTERNAL ERROR: pid %d\n", (int)getpid()); \
17a85d
+	fprintf(stderr, body); \
17a85d
+	fflush(stderr); \
17a85d
 	openchange_abort(is_fatal);
17a85d
 
17a85d
 #ifndef __BEGIN_DECLS
17a85d
diff -up openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/mapi_handles.c.samba-4.2.0-rc2 openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/mapi_handles.c
17a85d
--- openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/mapi_handles.c.samba-4.2.0-rc2	2015-12-03 11:12:08.457139614 +0100
17a85d
+++ openchange-openchange-2.3-VULCAN/mapiproxy/libmapiproxy/mapi_handles.c	2015-12-03 11:26:50.473102847 +0100
17a85d
@@ -429,7 +429,7 @@ static int mapi_handles_traverse_delete(
17a85d
 		OC_DEBUG(5, "handles being released must NOT have child handles attached to them (%s is a child of %s)", handle_str, container_handle_str);
17a85d
 		handle = strtol((const char *) handle_str, NULL, 16);
17a85d
 		/* abort(); */
17a85d
-		/* DEBUG(5, ("deleting child handle: %d, %s\n", handle, handle_str)); */
17a85d
+		/* OC_DEBUG(5, ("deleting child handle: %d, %s\n", handle, handle_str)); */
17a85d
 		mapi_handles_delete(handles_private->handles_ctx, handle);
17a85d
 	}
17a85d