summaryrefslogtreecommitdiff
path: root/ldb/ldb_tdb/ldb_tdb.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-12-22 15:54:56 -0500
committerSimo Sorce <idra@samba.org>2008-12-22 18:52:48 -0500
commit41718e315ea78998fab0893fd5f148a49d8faab8 (patch)
treeecbc13fb3abce56481ba04e13d9aa1b69b19783b /ldb/ldb_tdb/ldb_tdb.c
parenta93a69380dc6718c49879af628ed69f8e2b70797 (diff)
downloadsssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.gz
sssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.bz2
sssd-41718e315ea78998fab0893fd5f148a49d8faab8.zip
Rebase ldb code with all changes in samba master
Diffstat (limited to 'ldb/ldb_tdb/ldb_tdb.c')
-rw-r--r--ldb/ldb_tdb/ldb_tdb.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/ldb/ldb_tdb/ldb_tdb.c b/ldb/ldb_tdb/ldb_tdb.c
index 2282f61d..ea460def 100644
--- a/ldb/ldb_tdb/ldb_tdb.c
+++ b/ldb/ldb_tdb/ldb_tdb.c
@@ -161,7 +161,7 @@ failed:
check special dn's have valid attributes
currently only @ATTRIBUTES is checked
*/
-int ltdb_check_special_dn(struct ldb_module *module,
+static int ltdb_check_special_dn(struct ldb_module *module,
const struct ldb_message *msg)
{
int i, j;
@@ -850,6 +850,8 @@ static int ltdb_start_trans(struct ldb_module *module)
ltdb->in_transaction++;
+ ltdb_index_transaction_start(module);
+
return LDB_SUCCESS;
}
@@ -860,6 +862,10 @@ static int ltdb_end_trans(struct ldb_module *module)
ltdb->in_transaction--;
+ if (ltdb_index_transaction_commit(module) != 0) {
+ return ltdb_err_map(tdb_error(ltdb->tdb));
+ }
+
if (tdb_transaction_commit(ltdb->tdb) != 0) {
return ltdb_err_map(tdb_error(ltdb->tdb));
}
@@ -874,6 +880,10 @@ static int ltdb_del_trans(struct ldb_module *module)
ltdb->in_transaction--;
+ if (ltdb_index_transaction_cancel(module) != 0) {
+ return ltdb_err_map(tdb_error(ltdb->tdb));
+ }
+
if (tdb_transaction_cancel(ltdb->tdb) != 0) {
return ltdb_err_map(tdb_error(ltdb->tdb));
}
@@ -968,7 +978,7 @@ done:
return ret;
}
-void ltdb_request_done(struct ldb_request *req, int error)
+static void ltdb_request_done(struct ldb_request *req, int error)
{
struct ldb_reply *ares;
@@ -1076,12 +1086,14 @@ static void ltdb_callback(struct event_context *ev,
}
if (!ctx->callback_failed) {
+ /* Once we are done, we do not need timeout events */
+ talloc_free(ctx->timeout_event);
ltdb_request_done(ctx->req, ret);
}
}
static int ltdb_handle_request(struct ldb_module *module,
- struct ldb_request *req)
+ struct ldb_request *req)
{
struct event_context *ev;
struct ltdb_context *ac;
@@ -1115,10 +1127,9 @@ static int ltdb_handle_request(struct ldb_module *module,
return LDB_ERR_OPERATIONS_ERROR;
}
-
tv.tv_sec = req->starttime + req->timeout;
- te = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
- if (NULL == te) {
+ ac->timeout_event = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
+ if (NULL == ac->timeout_event) {
return LDB_ERR_OPERATIONS_ERROR;
}