From b5bf4400659a59b6508ede2e9d1b7fbd253c0b07 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Sep 2009 11:14:33 +1000 Subject: added ldb_ldif_message_string() This function provides a easy function for displaying a ldb_message structure in a human readable format. It is especially useful for calling in gdb. --- source4/lib/ldb/common/ldb_ldif.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c index 30370e6999..83f08b609b 100644 --- a/source4/lib/ldb/common/ldb_ldif.c +++ b/source4/lib/ldb/common/ldb_ldif.c @@ -799,3 +799,19 @@ char *ldb_ldif_write_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, } return state.string; } + +/* + convenient function to turn a ldb_message into a string. Useful for + debugging + */ +char *ldb_ldif_message_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, + enum ldb_changetype changetype, + const struct ldb_message *msg) +{ + struct ldb_ldif ldif; + + ldif.changetype = changetype; + ldif.msg = msg; + + return ldb_ldif_write_string(ldb, mem_ctx, &ldif); +} -- cgit