From 894ddafc25cae075f313bbe74e5d105e5e581c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= Date: Tue, 19 Feb 2019 12:29:58 +0100 Subject: ldb/ldb_ldif: add LDB_FLAG_FORCE_NO_BASE64_LDIF flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flag is used to enforce binary encoded attribute values per attribute. Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- lib/ldb/common/ldb_ldif.c | 4 ++++ lib/ldb/include/ldb.h | 6 ++++++ lib/ldb/pyldb.c | 1 + 3 files changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c index 92520c476f3..6f7589fef68 100644 --- a/lib/ldb/common/ldb_ldif.c +++ b/lib/ldb/common/ldb_ldif.c @@ -364,6 +364,10 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb, copy_raw_bytes = true; } else if (a->flags & LDB_ATTR_FLAG_FORCE_BASE64_LDIF) { use_b64_encode = true; + } else if (msg->elements[i].flags & + LDB_FLAG_FORCE_NO_BASE64_LDIF) { + use_b64_encode = false; + copy_raw_bytes = true; } else { use_b64_encode = ldb_should_b64_encode(ldb, &v); } diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h index 75bfbe33bf6..38e76c31605 100644 --- a/lib/ldb/include/ldb.h +++ b/lib/ldb/include/ldb.h @@ -139,6 +139,12 @@ struct ldb_dn; */ #define LDB_FLAG_MOD_DELETE 3 +/** + Flag value used in ldb_ldif_write_trace() to enforce binary encoded + attribute values per attribute. +*/ +#define LDB_FLAG_FORCE_NO_BASE64_LDIF 4 + /** flag bits on an element usable only by the internal implementation */ diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 85bcd84bc14..0858dddad40 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -4353,6 +4353,7 @@ static PyObject* module_init(void) ADD_LDB_INT(FLAG_MOD_ADD); ADD_LDB_INT(FLAG_MOD_REPLACE); ADD_LDB_INT(FLAG_MOD_DELETE); + ADD_LDB_INT(FLAG_FORCE_NO_BASE64_LDIF); ADD_LDB_INT(ATTR_FLAG_HIDDEN); ADD_LDB_INT(ATTR_FLAG_UNIQUE_INDEX); -- cgit v1.2.1