1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-07 01:58:28 +03:00

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)
This commit is contained in:
Andrew Bartlett 2007-08-06 01:36:49 +00:00 committed by Gerald (Jerry) Carter
parent e87a0e5f69
commit b351641c6e

View File

@ -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);