Author: idra
Date: 2006-05-30 01:46:14 +0000 (Tue, 30 May 2006)
New Revision: 15945

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15945

Log:

Check ltdb_modified results


Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2006-05-30 00:33:52 UTC 
(rev 15944)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2006-05-30 01:46:14 UTC 
(rev 15945)
@@ -256,7 +256,7 @@
 }
 
 
-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,13 +270,15 @@
        }
 
        ret = ltdb_store(module, msg, TDB_INSERT);
+       if (ret != LDB_SUCCESS) {
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
 
+       ret = ltdb_modified(module, msg->dn);
        if (ret != LDB_SUCCESS) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       ltdb_modified(module, msg->dn);
-
        return LDB_SUCCESS;
 }
 
@@ -342,7 +344,7 @@
        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,8 +375,12 @@
                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,7 +724,15 @@
 
        /* 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);
        return ret;
@@ -765,14 +779,11 @@
        }
 
        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);
 

Reply via email to