diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-08-06 01:36:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:01:29 -0500 |
commit | b351641c6ebcffd89c8e5e9cdae0f92528f12e05 (patch) | |
tree | d8c4d32a43827c0b6cd6c1a59566d3f4a563fc5a /source4/lib | |
parent | e87a0e5f69a8cfa3941643b17219ab34c541e47d (diff) | |
download | samba-b351641c6ebcffd89c8e5e9cdae0f92528f12e05.tar.gz samba-b351641c6ebcffd89c8e5e9cdae0f92528f12e05.tar.bz2 samba-b351641c6ebcffd89c8e5e9cdae0f92528f12e05.zip |
r24245: Fix bug #4828 - we need to set the samba LDB debug handler early, so
we catch messages pushed out by modules during startup.
This also sets an explict mapping between ldb and Samba debug levels.
Andrew Bartlett
(This used to be commit 50913a401dda9fb29a8c05f1926c41d3473efa93)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/db_wrap.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c index 207d98f268..89ee0b16d2 100644 --- a/source4/lib/db_wrap.c +++ b/source4/lib/db_wrap.c @@ -47,13 +47,23 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level, static void ldb_wrap_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) { + int samba_level; char *s = NULL; - if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) { - return; - } - if (DEBUGLEVEL < 2 && level > LDB_DEBUG_ERROR) { - return; - } + switch (level) { + case LDB_DEBUG_FATAL: + samba_level = 0; + break; + case LDB_DEBUG_ERROR: + samba_level = 1; + break; + case LDB_DEBUG_WARNING: + samba_level = 2; + break; + case LDB_DEBUG_TRACE: + samba_level = 5; + break; + + }; vasprintf(&s, fmt, ap); if (!s) return; DEBUG(level, ("ldb: %s\n", s)); @@ -137,6 +147,10 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, return NULL; } + ldb_set_debug(ldb, ldb_wrap_debug, NULL); + + ldb_set_utf8_fns(ldb, NULL, wrap_casefold); + real_url = private_path(ldb, url); if (real_url == NULL) { talloc_free(ldb); @@ -159,10 +173,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, return NULL; } - ldb_set_debug(ldb, ldb_wrap_debug, NULL); - - ldb_set_utf8_fns(ldb, NULL, wrap_casefold); - /* setup for leak detection */ ldb_set_opaque(ldb, "wrap_url", real_url); startup_blocks = talloc(ldb, size_t); |