summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-08 21:39:09 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-08 21:56:31 +1000
commit206d79ac514823f1c8f33489b740439df79189b6 (patch)
tree5b0cdadfe8f20321a79900465c6d8056ac533678
parent29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f (diff)
downloadsamba-206d79ac514823f1c8f33489b740439df79189b6.tar.gz
samba-206d79ac514823f1c8f33489b740439df79189b6.tar.bz2
samba-206d79ac514823f1c8f33489b740439df79189b6.zip
s4/ldb: don't line wrap ldif when --show-binary is used
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index b73fee1843..cde21320a2 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -350,9 +350,14 @@ int ldb_ldif_write(struct ldb_context *ldb,
} else {
ret = fprintf_fn(private_data, "%s: ", msg->elements[i].name);
CHECK_RET;
- ret = fold_string(fprintf_fn, private_data,
- (char *)v.data, v.length,
- strlen(msg->elements[i].name)+2);
+ if (ldb->flags & LDB_FLG_SHOW_BINARY) {
+ ret = fprintf_fn(private_data, "%*.*s",
+ v.length, v.length, (char *)v.data);
+ } else {
+ ret = fold_string(fprintf_fn, private_data,
+ (char *)v.data, v.length,
+ strlen(msg->elements[i].name)+2);
+ }
CHECK_RET;
ret = fprintf_fn(private_data, "\n");
CHECK_RET;
@@ -815,7 +820,7 @@ char *ldb_ldif_message_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
struct ldb_ldif ldif;
ldif.changetype = changetype;
- ldif.msg = msg;
+ ldif.msg = discard_const_p(struct ldb_message, msg);
return ldb_ldif_write_string(ldb, mem_ctx, &ldif);
}