diff options
author | Stefan Metzmacher <metze@samba.org> | 2016-02-05 13:55:31 +0100 |
---|---|---|
committer | Garming Sam <garming@samba.org> | 2016-02-17 03:43:23 +0100 |
commit | f721f27da5f9ebb41639b70986ad1acb83206ed6 (patch) | |
tree | 9885e86be6cf021a8f98648003495efc1dd0a5e7 /lib/ldb/common | |
parent | 6c8ab59d068101caa40f9b15ed70a115b5612f47 (diff) | |
download | samba-f721f27da5f9ebb41639b70986ad1acb83206ed6.tar.gz |
ldb: add LDB_ATTR_FLAG_FORCE_BASE64_LDIF support
This can be used to force ldb_write_ldif() to use base64 for
a specific attribute.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r-- | lib/ldb/common/ldb_ldif.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c index 07de5179ba7..0aeda94beac 100644 --- a/lib/ldb/common/ldb_ldif.c +++ b/lib/ldb/common/ldb_ldif.c @@ -348,13 +348,21 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb, for (j=0;j<msg->elements[i].num_values;j++) { struct ldb_val v; - bool use_b64_encode; + bool use_b64_encode = false; + ret = a->syntax->ldif_write_fn(ldb, mem_ctx, &msg->elements[i].values[j], &v); if (ret != LDB_SUCCESS) { v = msg->elements[i].values[j]; } - use_b64_encode = !(ldb->flags & LDB_FLG_SHOW_BINARY) - && ldb_should_b64_encode(ldb, &v); + + if (ldb->flags & LDB_FLG_SHOW_BINARY) { + use_b64_encode = false; + } else if (a->flags & LDB_ATTR_FLAG_FORCE_BASE64_LDIF) { + use_b64_encode = true; + } else { + use_b64_encode = ldb_should_b64_encode(ldb, &v); + } + if (ret != LDB_SUCCESS || use_b64_encode) { ret = fprintf_fn(private_data, "%s:: ", msg->elements[i].name); |