1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

ldb_mod_op_test: Make sure that closing the database frees locks

Without the destructor firing, this test used to pass, but now we show
that we must be able to open a new ldb handle.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar  7 04:38:02 CET 2018 on sn-devel-144
This commit is contained in:
Gary Lockyer 2018-01-23 11:03:16 +13:00 committed by Andrew Bartlett
parent 87708c3f91
commit 7f625f9b27

View File

@ -3662,6 +3662,35 @@ static void test_ldb_talloc_destructor_transaction_cleanup(void **state)
* Trigger the destructor
*/
TALLOC_FREE(test_ctx->ldb);
/*
* Now ensure that a new connection can be opened
*/
{
TALLOC_CTX *tctx = talloc_new(test_ctx);
struct ldbtest_ctx *ctx = talloc_zero(tctx, struct ldbtest_ctx);
struct ldb_dn *basedn;
struct ldb_result *result = NULL;
int ret;
ldbtest_setup((void *)&ctx);
basedn = ldb_dn_new_fmt(tctx, ctx->ldb, "dc=test");
assert_non_null(basedn);
ret = ldb_search(ctx->ldb,
tctx,
&result,
basedn,
LDB_SCOPE_BASE,
NULL,
NULL);
assert_int_equal(ret, 0);
assert_non_null(result);
assert_int_equal(result->count, 0);
ldbtest_teardown((void *)&ctx);
}
}