summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-08 20:57:31 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-08 21:56:31 +1000
commit29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f (patch)
tree9ece67758a9ee31c50e1ec70fa7f4de6f5fac3a5 /source4/lib/ldb/common
parent5b2b5abf4f630c28dc5f018ecced3894ae66f491 (diff)
downloadsamba-29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f.tar.gz
samba-29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f.tar.bz2
samba-29ba7765d90eda0b3d0f45f7a970272f0ef2ab2f.zip
s4/ldb: added --show-binary command line option
This add --show-binary to ldbsearch. When this flag is set, binary blobs will be shown as-is, instead of base64 encoded. This is useful for some XML encoded attributes, and will also be used as part of some NDR print formatting for attributes like repsTo.
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 83f08b609b..b73fee1843 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -185,11 +185,15 @@ char *ldb_base64_encode(void *mem_ctx, const char *buf, int len)
/*
see if a buffer should be base64 encoded
*/
-int ldb_should_b64_encode(const struct ldb_val *val)
+int ldb_should_b64_encode(struct ldb_context *ldb, const struct ldb_val *val)
{
unsigned int i;
uint8_t *p = val->data;
+ if (ldb->flags & LDB_FLG_SHOW_BINARY) {
+ return 0;
+ }
+
if (val->length == 0) {
return 0;
}
@@ -333,7 +337,7 @@ int ldb_ldif_write(struct ldb_context *ldb,
if (ret != LDB_SUCCESS) {
v = msg->elements[i].values[j];
}
- if (ret != LDB_SUCCESS || ldb_should_b64_encode(&v)) {
+ if (ret != LDB_SUCCESS || ldb_should_b64_encode(ldb, &v)) {
ret = fprintf_fn(private_data, "%s:: ",
msg->elements[i].name);
CHECK_RET;