summaryrefslogtreecommitdiff
path: root/source4/torture/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2016-08-23 11:38:26 +1200
committerDouglas Bagnall <dbagnall@samba.org>2016-08-31 10:53:09 +0200
commit09580103fe30896c61e173c836aa4ca525cc6243 (patch)
treedbcf518e2594f53f5d03298a2191eb7c8d1d7a60 /source4/torture/ldb
parent198471f9edfb9da2ee5b54e60a46d208f58ca2e4 (diff)
downloadsamba-09580103fe30896c61e173c836aa4ca525cc6243.tar.gz
ldb: Avoid multiple tiny allocations during full DB scan
LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC allows us to consolidate some of these allocations Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Wed Aug 31 10:53:09 CEST 2016 on sn-devel-144
Diffstat (limited to 'source4/torture/ldb')
-rw-r--r--source4/torture/ldb/ldb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/torture/ldb/ldb.c b/source4/torture/ldb/ldb.c
index f7f04db0242..dcbe919d5bf 100644
--- a/source4/torture/ldb/ldb.c
+++ b/source4/torture/ldb/ldb.c
@@ -1138,6 +1138,24 @@ static bool torture_ldb_unpack_flags(struct torture_context *torture)
ldb_unpack_data_only_attr_list_flags(ldb, &data,
msg,
NULL, 0,
+ LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC|
+ LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC,
+ &nb_elements_in_db),
+ 0,
+ "ldb_unpack_data failed");
+
+ ldif.changetype = LDB_CHANGETYPE_NONE;
+ ldif.msg = msg;
+ ldif_text = ldb_ldif_write_string(ldb, mem_ctx, &ldif);
+
+ torture_assert_int_equal(torture,
+ strcmp(ldif_text, dda1d01d_ldif), 0,
+ "ldif form differs from binary form");
+
+ torture_assert_int_equal(torture,
+ ldb_unpack_data_only_attr_list_flags(ldb, &data,
+ msg,
+ NULL, 0,
LDB_UNPACK_DATA_FLAG_NO_DN,
&nb_elements_in_db),
0,