summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-02 11:14:33 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-02 18:19:54 +1000
commitb5bf4400659a59b6508ede2e9d1b7fbd253c0b07 (patch)
treeb515160eb389c6b8299ee1b4d497c4b4a9b76d8d /source4/lib
parentaec03eda93d3db8723c79f062c80db0267ac2e59 (diff)
downloadsamba-b5bf4400659a59b6508ede2e9d1b7fbd253c0b07.tar.gz
samba-b5bf4400659a59b6508ede2e9d1b7fbd253c0b07.tar.bz2
samba-b5bf4400659a59b6508ede2e9d1b7fbd253c0b07.zip
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.
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c16
-rw-r--r--source4/lib/ldb/include/ldb.h12
2 files changed, 28 insertions, 0 deletions
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);
+}
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 8972fc83e9..4e47497a5e 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -1463,6 +1463,18 @@ int ldb_ldif_write_file(struct ldb_context *ldb, FILE *f, const struct ldb_ldif
char * ldb_ldif_write_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
const struct ldb_ldif *msg);
+
+/*
+ Produce a string form of an ldb message
+
+ 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);
+
+
/**
Base64 encode a buffer