From: Gary Lockyer Date: Mon, 22 Jan 2018 22:03:16 +0000 (+1300) Subject: ldb_mod_op_test: Make sure that closing the database frees locks X-Git-Tag: talloc-2.1.12~243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f625f9b27b229f74a88dfe6d86fadd060c47160;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Mar 7 04:38:02 CET 2018 on sn-devel-144 --- diff --git a/lib/ldb/tests/ldb_mod_op_test.c b/lib/ldb/tests/ldb_mod_op_test.c index 425a984ed5d..b91130252a7 100644 --- a/lib/ldb/tests/ldb_mod_op_test.c +++ b/lib/ldb/tests/ldb_mod_op_test.c @@ -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); + } }