diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-08 21:39:09 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-08 21:56:31 +1000 |
commit | 206d79ac514823f1c8f33489b740439df79189b6 (patch) | |
tree | 5b0cdadfe8f20321a79900465c6d8056ac533678 /source4/lib/ldb/common | |
parent | 29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f (diff) | |
download | samba-206d79ac514823f1c8f33489b740439df79189b6.tar.gz samba-206d79ac514823f1c8f33489b740439df79189b6.tar.bz2 samba-206d79ac514823f1c8f33489b740439df79189b6.zip |
s4/ldb: don't line wrap ldif when --show-binary is used
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r-- | source4/lib/ldb/common/ldb_ldif.c | 13 |
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); } |