summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-06 09:55:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:46 -0500
commit68293565de0b799dcc51e001dabf53adf88ee7ad (patch)
treecc8710f307f2f4ed31bd5d4fdd1e17433fc692a5 /source4/rpc_server
parent404c319a5013132edf402e18da0144d7566d2623 (diff)
downloadsamba-68293565de0b799dcc51e001dabf53adf88ee7ad.tar.gz
samba-68293565de0b799dcc51e001dabf53adf88ee7ad.tar.bz2
samba-68293565de0b799dcc51e001dabf53adf88ee7ad.zip
r513: added a generic ldb debug system to allow the Samba debug functions to
be cleanly interfaced to ldb (This used to be commit 74b89d5f960d6b936751e3f057b4540eb80b79cd)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/samr/samdb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index c4909caeb0..c0e0d12a7b 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -33,6 +33,21 @@
static struct ldb_context *sam_db;
/*
+ this is used to catch debug messages from ldb
+*/
+void samdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
+{
+ char *s = NULL;
+ if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
+ return;
+ }
+ vasprintf(&s, fmt, ap);
+ if (!s) return;
+ DEBUG(level, ("samdb: %s\n", s));
+ free(s);
+}
+
+/*
connect to the SAM database
return 0 on success, -1 on failure
*/
@@ -47,6 +62,8 @@ int samdb_connect(void)
return -1;
}
+ ldb_set_debug(sam_db, samdb_debug, NULL);
+
return 0;
}