summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-30 01:46:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:43 -0500
commit17936b09dba370928faf3794caadfe22c1862622 (patch)
tree725c3297771f73ed3b3e069740d42cc446902c6a /source4/lib/ldb/ldb_tdb
parent2d19dca9c80a5e3990296dde67163fce36ac883d (diff)
downloadsamba-17936b09dba370928faf3794caadfe22c1862622.tar.gz
samba-17936b09dba370928faf3794caadfe22c1862622.tar.bz2
samba-17936b09dba370928faf3794caadfe22c1862622.zip
r15945: Check ltdb_modified results
(This used to be commit bbda863f0766e4f4100a644f9a1ddcd8e18d29cd)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 5ea92aa1b1..629a18b9c6 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -256,7 +256,7 @@ done:
}
-static int ltdb_add_internal(struct ldb_module *module, struct ldb_message *msg)
+static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message *msg)
{
int ret;
@@ -270,12 +270,14 @@ static int ltdb_add_internal(struct ldb_module *module, struct ldb_message *msg)
}
ret = ltdb_store(module, msg, TDB_INSERT);
-
if (ret != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_modified(module, msg->dn);
+ ret = ltdb_modified(module, msg->dn);
+ if (ret != LDB_SUCCESS) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
return LDB_SUCCESS;
}
@@ -342,7 +344,7 @@ int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn)
return ret;
}
-static int ltdb_delete_internal(struct ldb_module *module, struct ldb_dn *dn)
+static int ltdb_delete_internal(struct ldb_module *module, const struct ldb_dn *dn)
{
struct ldb_message *msg;
int ret;
@@ -373,7 +375,11 @@ static int ltdb_delete_internal(struct ldb_module *module, struct ldb_dn *dn)
talloc_free(msg);
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_modified(module, dn);
+
+ ret = ltdb_modified(module, dn);
+ if (ret != LDB_SUCCESS) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
talloc_free(msg);
return LDB_SUCCESS;
@@ -718,6 +724,14 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
/* we've made all the mods - save the modified record back into the database */
ret = ltdb_store(module, msg2, TDB_MODIFY);
+ if (ret != LDB_SUCCESS) {
+ goto failed;
+ }
+
+ if (ltdb_modified(module, msg->dn) != LDB_SUCCESS) {
+ ret = LDB_ERR_OPERATIONS_ERROR;
+ goto failed;
+ }
talloc_free(tdb_key.dptr);
free(tdb_data.dptr);
@@ -765,14 +779,11 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
}
tret = ltdb_modify_internal(module, req->op.mod.message);
-
if (tret != LDB_SUCCESS) {
req->async.handle->status = tret;
goto done;
}
- ltdb_modified(module, req->op.mod.message->dn);
-
if (ltdb_ac->callback)
ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL);