summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/common/ldb.c54
-rw-r--r--source4/lib/ldb/common/ldb_modules.c8
-rw-r--r--source4/lib/ldb/include/ldb_private.h8
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c42
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c44
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c159
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c33
-rw-r--r--source4/lib/ldb/modules/ldb_map.c28
-rw-r--r--source4/lib/ldb/modules/rdn_name.c32
-rw-r--r--source4/lib/ldb/modules/schema.c28
-rw-r--r--source4/lib/ldb/modules/skel.c32
-rw-r--r--source4/lib/ldb/modules/timestamps.c32
-rw-r--r--source4/lib/ldb/tools/ldbtest.c7
13 files changed, 232 insertions, 275 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 25e7bee66b..ae71f08713 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -106,6 +106,22 @@ int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, co
}
/*
+ start a transaction
+*/
+static int ldb_start_trans(struct ldb_context *ldb)
+{
+ return ldb->modules->ops->start_transaction(ldb->modules);
+}
+
+/*
+ end a transaction
+*/
+static int ldb_end_trans(struct ldb_context *ldb, int status)
+{
+ return ldb->modules->ops->end_transaction(ldb->modules, status);
+}
+
+/*
search the database given a LDAP-like search expression
return the number of records found, or -1 on error
@@ -146,7 +162,11 @@ int ldb_search_bytree(struct ldb_context *ldb,
int ldb_add(struct ldb_context *ldb,
const struct ldb_message *message)
{
- return ldb->modules->ops->add_record(ldb->modules, message);
+ int status = ldb_start_trans(ldb);
+ if (status != 0) return status;
+
+ status = ldb->modules->ops->add_record(ldb->modules, message);
+ return ldb_end_trans(ldb, status);
}
/*
@@ -155,7 +175,11 @@ int ldb_add(struct ldb_context *ldb,
int ldb_modify(struct ldb_context *ldb,
const struct ldb_message *message)
{
- return ldb->modules->ops->modify_record(ldb->modules, message);
+ int status = ldb_start_trans(ldb);
+ if (status != 0) return status;
+
+ status = ldb->modules->ops->modify_record(ldb->modules, message);
+ return ldb_end_trans(ldb, status);
}
@@ -164,7 +188,11 @@ int ldb_modify(struct ldb_context *ldb,
*/
int ldb_delete(struct ldb_context *ldb, const struct ldb_dn *dn)
{
- return ldb->modules->ops->delete_record(ldb->modules, dn);
+ int status = ldb_start_trans(ldb);
+ if (status != 0) return status;
+
+ status = ldb->modules->ops->delete_record(ldb->modules, dn);
+ return ldb_end_trans(ldb, status);
}
/*
@@ -172,23 +200,11 @@ int ldb_delete(struct ldb_context *ldb, const struct ldb_dn *dn)
*/
int ldb_rename(struct ldb_context *ldb, const struct ldb_dn *olddn, const struct ldb_dn *newdn)
{
- return ldb->modules->ops->rename_record(ldb->modules, olddn, newdn);
-}
+ int status = ldb_start_trans(ldb);
+ if (status != 0) return status;
-/*
- create a named lock
-*/
-int ldb_lock(struct ldb_context *ldb, const char *lockname)
-{
- return ldb->modules->ops->named_lock(ldb->modules, lockname);
-}
-
-/*
- release a named lock
-*/
-int ldb_unlock(struct ldb_context *ldb, const char *lockname)
-{
- return ldb->modules->ops->named_unlock(ldb->modules, lockname);
+ status = ldb->modules->ops->rename_record(ldb->modules, olddn, newdn);
+ return ldb_end_trans(ldb, status);
}
/*
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 20e8ad061e..29bc8264e9 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -306,20 +306,20 @@ int ldb_next_rename_record(struct ldb_module *module, const struct ldb_dn *olddn
return module->next->ops->rename_record(module->next, olddn, newdn);
}
-int ldb_next_named_lock(struct ldb_module *module, const char *lockname)
+int ldb_next_start_trans(struct ldb_module *module)
{
if (!module->next) {
return -1;
}
- return module->next->ops->named_lock(module->next, lockname);
+ return module->next->ops->start_transaction(module->next);
}
-int ldb_next_named_unlock(struct ldb_module *module, const char *lockname)
+int ldb_next_end_trans(struct ldb_module *module, int status)
{
if (!module->next) {
return -1;
}
- return module->next->ops->named_unlock(module->next, lockname);
+ return module->next->ops->end_transaction(module->next, status);
}
const char *ldb_next_errstring(struct ldb_module *module)
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index f5b50f5fc0..e55a19c28c 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -64,8 +64,8 @@ struct ldb_module_ops {
int (*modify_record)(struct ldb_module *, const struct ldb_message *);
int (*delete_record)(struct ldb_module *, const struct ldb_dn *);
int (*rename_record)(struct ldb_module *, const struct ldb_dn *, const struct ldb_dn *);
- int (*named_lock)(struct ldb_module *, const char *);
- int (*named_unlock)(struct ldb_module *, const char *);
+ int (*start_transaction)(struct ldb_module *);
+ int (*end_transaction)(struct ldb_module *, int);
const char * (*errstring)(struct ldb_module *);
};
@@ -135,8 +135,8 @@ int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *mes
int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message);
int ldb_next_delete_record(struct ldb_module *module, const struct ldb_dn *dn);
int ldb_next_rename_record(struct ldb_module *module, const struct ldb_dn *olddn, const struct ldb_dn *newdn);
-int ldb_next_named_lock(struct ldb_module *module, const char *lockname);
-int ldb_next_named_unlock(struct ldb_module *module, const char *lockname);
+int ldb_next_start_trans(struct ldb_module *module);
+int ldb_next_end_trans(struct ldb_module *module, int status);
const char *ldb_next_errstring(struct ldb_module *module);
/* The following definitions come from lib/ldb/common/ldb_debug.c */
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 3d47863067..d4239c0f72 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -362,30 +362,18 @@ static int ildb_modify(struct ldb_module *module, const struct ldb_message *msg)
return ret;
}
-static int ildb_lock(struct ldb_module *module, const char *lockname)
+static int ildb_start_trans(struct ldb_module *module)
{
- int ret = 0;
-
- if (lockname == NULL) {
- return -1;
- }
-
/* TODO implement a local locking mechanism here */
- return ret;
+ return 0;
}
-static int ildb_unlock(struct ldb_module *module, const char *lockname)
+static int ildb_end_trans(struct ldb_module *module, int status)
{
- int ret = 0;
-
- if (lockname == NULL) {
- return -1;
- }
-
- /* TODO implement a local unlocking mechanism here */
+ /* TODO implement a local transaction mechanism here */
- return ret;
+ return status;
}
/*
@@ -403,16 +391,16 @@ static const char *ildb_errstring(struct ldb_module *module)
static const struct ldb_module_ops ildb_ops = {
- .name = "ldap",
- .search = ildb_search,
- .search_bytree = ildb_search_bytree,
- .add_record = ildb_add,
- .modify_record = ildb_modify,
- .delete_record = ildb_delete,
- .rename_record = ildb_rename,
- .named_lock = ildb_lock,
- .named_unlock = ildb_unlock,
- .errstring = ildb_errstring
+ .name = "ldap",
+ .search = ildb_search,
+ .search_bytree = ildb_search_bytree,
+ .add_record = ildb_add,
+ .modify_record = ildb_modify,
+ .delete_record = ildb_delete,
+ .rename_record = ildb_rename,
+ .start_transaction = ildb_start_trans,
+ .end_transaction = ildb_end_trans,
+ .errstring = ildb_errstring
};
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 2da4f1af8e..39f56dba0e 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -450,30 +450,18 @@ static int lldb_modify(struct ldb_module *module, const struct ldb_message *msg)
return ret;
}
-static int lldb_lock(struct ldb_module *module, const char *lockname)
+static int lldb_start_trans(struct ldb_module *module)
{
- int ret = 0;
-
- if (lockname == NULL) {
- return -1;
- }
+ /* TODO implement a local transaction mechanism here */
- /* TODO implement a local locking mechanism here */
-
- return ret;
+ return 0;
}
-static int lldb_unlock(struct ldb_module *module, const char *lockname)
+static int lldb_end_trans(struct ldb_module *module, int status)
{
- int ret = 0;
-
- if (lockname == NULL) {
- return -1;
- }
-
- /* TODO implement a local unlocking mechanism here */
+ /* TODO implement a local transaction mechanism here */
- return ret;
+ return status;
}
/*
@@ -487,16 +475,16 @@ static const char *lldb_errstring(struct ldb_module *module)
static const struct ldb_module_ops lldb_ops = {
- .name = "ldap",
- .search = lldb_search,
- .search_bytree = lldb_search_bytree,
- .add_record = lldb_add,
- .modify_record = lldb_modify,
- .delete_record = lldb_delete,
- .rename_record = lldb_rename,
- .named_lock = lldb_lock,
- .named_unlock = lldb_unlock,
- .errstring = lldb_errstring
+ .name = "ldap",
+ .search = lldb_search,
+ .search_bytree = lldb_search_bytree,
+ .add_record = lldb_add,
+ .modify_record = lldb_modify,
+ .delete_record = lldb_delete,
+ .rename_record = lldb_rename,
+ .start_transaction = lldb_start_trans,
+ .end_transaction = lldb_end_trans,
+ .errstring = lldb_errstring
};
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index f136fb7072..c0adab7bc3 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -457,57 +457,6 @@ static char *parsetree_to_sql(struct ldb_module *module,
return NULL;
}
-/* obtain a named lock */
-static int
-lsqlite3_lock(struct ldb_module * module,
- const char * lockname)
-{
- struct lsqlite3_private * lsqlite3 = module->private_data;
-
-/* FIXME
- if (lockname == NULL) {
- return -1;
- }
-
- if (strcmp(lockname, "transaction") == 0) {
- if (lsqlite3->lock_count == 0) {
- if (query_norows(lsqlite3, "BEGIN EXCLUSIVE;") != 0) {
- return -1;
- }
- }
- ++lsqlite3->lock_count;
- }
-*/
- return 0;
-}
-
-/* release a named lock */
-static int
-lsqlite3_unlock(struct ldb_module *module,
- const char *lockname)
-{
- struct lsqlite3_private * lsqlite3 = module->private_data;
-
-/* FIXME
- if (lockname == NULL) {
- return -1;
- }
-
- if (strcmp(lockname, "transaction") == 0) {
- if (lsqlite3->lock_count == 1) {
- if (query_norows(lsqlite3, "COMMIT;") != 0) {
- query_norows(lsqlite3, "ROLLBACK;");
- }
- } else if (lsqlite3->lock_count > 0) {
- --lsqlite3->lock_count;
- }
- } else if (strcmp(lockname, "rollback") == 0) {
- query_norows(lsqlite3, "ROLLBACK;");
- }
-*/
- return 0;
-}
-
/*
* query_int()
*
@@ -685,7 +634,7 @@ static int lsqlite3_safe_rollback(sqlite3 *sqlite)
ret = sqlite3_exec(sqlite, "ROLLBACK;", NULL, NULL, &errmsg);
if (ret != SQLITE_OK) {
if (errmsg) {
- printf("lsqlite3_safe_rollback: Serious Error: %s\n", errmsg);
+ printf("lsqlite3_safe_rollback: Error: %s\n", errmsg);
free(errmsg);
}
return -1;
@@ -1078,7 +1027,6 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg
char *dn, *ndn;
char *errmsg;
char *query;
- int rollback = 0;
int ret;
int i;
@@ -1115,8 +1063,6 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg
if (dn == NULL || ndn == NULL) goto failed;
query = lsqlite3_tprintf(local_ctx,
- /* Begin the transaction */
- "BEGIN EXCLUSIVE; "
/* Add new entry */
"INSERT OR ABORT INTO ldb_entry "
"('dn', 'norm_dn') "
@@ -1130,10 +1076,8 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg
printf("lsqlite3_add: exec error: %s\n", errmsg);
free(errmsg);
}
- lsqlite3_safe_rollback(lsqlite3->sqlite);
goto failed;
}
- rollback = 1;
eid = lsqlite3_get_eid_ndn(lsqlite3->sqlite, local_ctx, ndn);
if (eid == -1) goto failed;
@@ -1179,20 +1123,10 @@ static int lsqlite3_add(struct ldb_module *module, const struct ldb_message *msg
}
}
- ret = sqlite3_exec(lsqlite3->sqlite, "COMMIT;", NULL, NULL, &errmsg);
- if (ret != SQLITE_OK) {
- if (errmsg) {
- printf("lsqlite3_add: commit error: %s\n", errmsg);
- free(errmsg);
- }
- goto failed;
- }
-
talloc_free(local_ctx);
return 0;
failed:
- if (rollback) lsqlite3_safe_rollback(lsqlite3->sqlite);
talloc_free(local_ctx);
return -1;
}
@@ -1205,7 +1139,6 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message *
struct lsqlite3_private *lsqlite3 = module->private_data;
long long eid;
char *errmsg;
- int rollback = 0;
int ret;
int i;
@@ -1235,16 +1168,6 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message *
return 0;
}
- ret = sqlite3_exec(lsqlite3->sqlite, "BEGIN EXCLUSIVE;", NULL, NULL, &errmsg);
- if (ret != SQLITE_OK) {
- if (errmsg) {
- printf("lsqlite3_modify: error: %s\n", errmsg);
- free(errmsg);
- }
- goto failed;
- }
- rollback = 1;
-
eid = lsqlite3_get_eid(module, msg->dn);
if (eid == -1) {
goto failed;
@@ -1376,20 +1299,10 @@ static int lsqlite3_modify(struct ldb_module *module, const struct ldb_message *
}
}
- ret = sqlite3_exec(lsqlite3->sqlite, "COMMIT;", NULL, NULL, &errmsg);
- if (ret != SQLITE_OK) {
- if (errmsg) {
- printf("lsqlite3_modify: error: %s\n", errmsg);
- free(errmsg);
- }
- goto failed;
- }
-
talloc_free(local_ctx);
return 0;
failed:
- if (rollback) lsqlite3_safe_rollback(lsqlite3->sqlite);
talloc_free(local_ctx);
return -1;
}
@@ -1419,14 +1332,10 @@ static int lsqlite3_delete(struct ldb_module *module, const struct ldb_dn *dn)
if (eid == -1) goto failed;
query = lsqlite3_tprintf(local_ctx,
- /* Begin the transaction */
- "BEGIN EXCLUSIVE; "
/* Delete entry */
"DELETE FROM ldb_entry WHERE eid = %lld; "
/* Delete attributes */
- "DELETE FROM ldb_attribute_values WHERE eid = %lld; "
- /* Commit */
- "COMMIT;",
+ "DELETE FROM ldb_attribute_values WHERE eid = %lld; ",
eid, eid);
if (query == NULL) goto failed;
@@ -1436,7 +1345,6 @@ static int lsqlite3_delete(struct ldb_module *module, const struct ldb_dn *dn)
printf("lsqlite3_delete: error getting eid: %s\n", errmsg);
free(errmsg);
}
- lsqlite3_safe_rollback(lsqlite3->sqlite);
goto failed;
}
@@ -1500,6 +1408,49 @@ failed:
talloc_free(local_ctx);
return -1;
}
+
+static int lsqlite3_start_trans(struct ldb_module * module)
+{
+ int ret;
+ char *errmsg;
+ struct lsqlite3_private * lsqlite3 = module->private_data;
+
+ ret = sqlite3_exec(lsqlite3->sqlite, "BEGIN IMMEDIATE;", NULL, NULL, &errmsg);
+ if (ret != SQLITE_OK) {
+ if (errmsg) {
+ printf("lsqlite3_start_trans: error: %s\n", errmsg);
+ free(errmsg);
+ }
+ return -1;
+ }
+
+ return 0;
+}
+
+static int lsqlite3_end_trans(struct ldb_module *module, int status)
+{
+ int ret;
+ char *errmsg;
+ struct lsqlite3_private *lsqlite3 = module->private_data;
+
+ if (status == 0) {
+ ret = sqlite3_exec(lsqlite3->sqlite, "COMMIT;", NULL, NULL, &errmsg);
+ if (ret != SQLITE_OK) {
+ if (errmsg) {
+ printf("lsqlite3_end_trans: error: %s\n", errmsg);
+ free(errmsg);
+ }
+ return -1;
+ }
+ } else {
+ return lsqlite3_safe_rollback(lsqlite3->sqlite);
+ }
+
+ return 0;
+}
+
+
+
/* return extended error information */
static const char *
lsqlite3_errstring(struct ldb_module *module)
@@ -1799,16 +1750,16 @@ destructor(void *p)
* Table of operations for the sqlite3 backend
*/
static const struct ldb_module_ops lsqlite3_ops = {
- .name = "sqlite",
- .search = lsqlite3_search,
- .search_bytree = lsqlite3_search_bytree,
- .add_record = lsqlite3_add,
- .modify_record = lsqlite3_modify,
- .delete_record = lsqlite3_delete,
- .rename_record = lsqlite3_rename,
- .named_lock = lsqlite3_lock,
- .named_unlock = lsqlite3_unlock,
- .errstring = lsqlite3_errstring
+ .name = "sqlite",
+ .search = lsqlite3_search,
+ .search_bytree = lsqlite3_search_bytree,
+ .add_record = lsqlite3_add,
+ .modify_record = lsqlite3_modify,
+ .delete_record = lsqlite3_delete,
+ .rename_record = lsqlite3_rename,
+ .start_transaction = lsqlite3_start_trans,
+ .end_transaction = lsqlite3_end_trans,
+ .errstring = lsqlite3_errstring
};
/*
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 61d0f9b64a..c3f59a2dbe 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -825,6 +825,19 @@ failed:
return -1;
}
+static int ltdb_start_trans(struct ldb_module *module)
+{
+ /* TODO: implement transactions */
+
+ return 0;
+}
+
+static int ltdb_end_trans(struct ldb_module *module, int status)
+{
+ /* TODO: implement transactions */
+
+ return status;
+}
/*
return extended error information
@@ -840,16 +853,16 @@ static const char *ltdb_errstring(struct ldb_module *module)
static const struct ldb_module_ops ltdb_ops = {
- .name = "tdb",
- .search = ltdb_search,
- .search_bytree = ltdb_search_bytree,
- .add_record = ltdb_add,
- .modify_record = ltdb_modify,
- .delete_record = ltdb_delete,
- .rename_record = ltdb_rename,
- .named_lock = ltdb_lock,
- .named_unlock = ltdb_unlock,
- .errstring = ltdb_errstring
+ .name = "tdb",
+ .search = ltdb_search,
+ .search_bytree = ltdb_search_bytree,
+ .add_record = ltdb_add,
+ .modify_record = ltdb_modify,
+ .delete_record = ltdb_delete,
+ .rename_record = ltdb_rename,
+ .start_transaction = ltdb_start_trans,
+ .end_transaction = ltdb_end_trans,
+ .errstring = ltdb_errstring
};
diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c
index ba98a5f495..93ae13ffc2 100644
--- a/source4/lib/ldb/modules/ldb_map.c
+++ b/source4/lib/ldb/modules/ldb_map.c
@@ -1256,14 +1256,14 @@ static int map_modify(struct ldb_module *module, const struct ldb_message *msg)
return (mp_ret == -1 || fb_ret == -1)?-1:0;
}
-static int map_lock(struct ldb_module *module, const char *lockname)
+static int map_start_trans(struct ldb_module *module)
{
- return ldb_next_named_lock(module, lockname);
+ return ldb_next_start_trans(module);
}
-static int map_unlock(struct ldb_module *module, const char *lockname)
+static int map_end_trans(struct ldb_module *module, int status)
{
- return ldb_next_named_unlock(module, lockname);
+ return ldb_next_end_trans(module, status);
}
/*
@@ -1280,16 +1280,16 @@ static const char *map_errstring(struct ldb_module *module)
}
static const struct ldb_module_ops map_ops = {
- .name = "map",
- .search = map_search,
- .search_bytree = map_search_bytree,
- .add_record = map_add,
- .modify_record = map_modify,
- .delete_record = map_delete,
- .rename_record = map_rename,
- .named_lock = map_lock,
- .named_unlock = map_unlock,
- .errstring = map_errstring
+ .name = "map",
+ .search = map_search,
+ .search_bytree = map_search_bytree,
+ .add_record = map_add,
+ .modify_record = map_modify,
+ .delete_record = map_delete,
+ .rename_record = map_rename,
+ .start_transaction = map_start_trans,
+ .end_transaction = map_end_trans,
+ .errstring = map_errstring
};
static char *map_find_url(struct ldb_context *ldb, const char *name)
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index 09e9c72811..ed5400176c 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -217,16 +217,16 @@ static int rdn_name_rename_record(struct ldb_module *module, const struct ldb_dn
return ldb_next_rename_record(module, olddn, newdn);
}
-static int rdn_name_lock(struct ldb_module *module, const char *lockname)
+static int rdn_start_trans(struct ldb_module *module)
{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_lock\n");
- return ldb_next_named_lock(module, lockname);
+ ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_start_trans\n");
+ return ldb_next_start_trans(module);
}
-static int rdn_name_unlock(struct ldb_module *module, const char *lockname)
+static int rdn_end_trans(struct ldb_module *module, int status)
{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_unlock\n");
- return ldb_next_named_unlock(module, lockname);
+ ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_end_trans\n");
+ return ldb_next_end_trans(module, status);
}
/* return extended error information */
@@ -254,16 +254,16 @@ static int rdn_name_destructor(void *module_ctx)
}
static const struct ldb_module_ops rdn_name_ops = {
- .name = "rdn_name",
- .search = rdn_name_search,
- .search_bytree = rdn_name_search_bytree,
- .add_record = rdn_name_add_record,
- .modify_record = rdn_name_modify_record,
- .delete_record = rdn_name_delete_record,
- .rename_record = rdn_name_rename_record,
- .named_lock = rdn_name_lock,
- .named_unlock = rdn_name_unlock,
- .errstring = rdn_name_errstring
+ .name = "rdn_name",
+ .search = rdn_name_search,
+ .search_bytree = rdn_name_search_bytree,
+ .add_record = rdn_name_add_record,
+ .modify_record = rdn_name_modify_record,
+ .delete_record = rdn_name_delete_record,
+ .rename_record = rdn_name_rename_record,
+ .start_transaction = rdn_start_trans,
+ .end_transaction = rdn_end_trans,
+ .errstring = rdn_name_errstring
};
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index baf038de0c..9406d54ce7 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -501,12 +501,12 @@ static int schema_rename_record(struct ldb_module *module, const struct ldb_dn *
return ldb_next_rename_record(module, olddn, newdn);
}
-static int schema_named_lock(struct ldb_module *module, const char *name) {
- return ldb_next_named_lock(module, name);
+static int schema_start_trans(struct ldb_module *module) {
+ return ldb_next_start_trans(module);
}
-static int schema_named_unlock(struct ldb_module *module, const char *name) {
- return ldb_next_named_unlock(module, name);
+static int schema_end_trans(struct ldb_module *module, int status) {
+ return ldb_next_end_trans(module, status);
}
/* return extended error information */
@@ -533,16 +533,16 @@ static int schema_destructor(void *module_ctx)
}
static const struct ldb_module_ops schema_ops = {
- .name = "schema",
- .search = schema_search,
- .search_bytree = schema_search_bytree,
- .add_record = schema_add_record,
- .modify_record = schema_modify_record,
- .delete_record = schema_delete_record,
- .rename_record = schema_rename_record,
- .named_lock = schema_named_lock,
- .named_unlock = schema_named_unlock,
- .errstring = schema_errstring,
+ .name = "schema",
+ .search = schema_search,
+ .search_bytree = schema_search_bytree,
+ .add_record = schema_add_record,
+ .modify_record = schema_modify_record,
+ .delete_record = schema_delete_record,
+ .rename_record = schema_rename_record,
+ .start_transaction = schema_start_trans,
+ .end_transaction = schema_end_trans,
+ .errstring = schema_errstring,
};
#ifdef HAVE_DLOPEN_DISABLED
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index 57c89a6a65..37c0417c64 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -73,16 +73,16 @@ static int skel_rename_record(struct ldb_module *module, const struct ldb_dn *ol
return ldb_next_rename_record(module, olddn, newdn);
}
-/* named_lock */
-static int skel_named_lock(struct ldb_module *module, const char *lockname)
+/* start a transaction */
+static int skel_start_trans(struct ldb_module *module)
{
- return ldb_next_named_lock(module, lockname);
+ return ldb_next_start_trans(module);
}
-/* named_unlock */
-static int skel_named_unlock(struct ldb_module *module, const char *lockname)
+/* end a transaction */
+static int skel_end_trans(struct ldb_module *module, int status)
{
- return ldb_next_named_unlock(module, lockname);
+ return ldb_next_end_trans(module, status);
}
/* return extended error information */
@@ -101,16 +101,16 @@ static int skel_destructor(void *module_ctx)
}
static const struct ldb_module_ops skel_ops = {
- .name = "skel",
- .search = skel_search,
- .search_bytree = skel_search_bytree,
- .add_record = skel_add_record,
- .modify_record = skel_modify_record,
- .delete_record = skel_delete_record,
- .rename_record = skel_rename_record,
- .named_lock = skel_named_lock,
- .named_unlock = skel_named_unlock,
- .errstring = skel_errstring
+ .name = "skel",
+ .search = skel_search,
+ .search_bytree = skel_search_bytree,
+ .add_record = skel_add_record,
+ .modify_record = skel_modify_record,
+ .delete_record = skel_delete_record,
+ .rename_record = skel_rename_record,
+ .start_transaction = skel_start_trans,
+ .end_transaction = skel_end_trans,
+ .errstring = skel_errstring
};
#ifdef HAVE_DLOPEN_DISABLED
diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c
index f712505211..6687b1929d 100644
--- a/source4/lib/ldb/modules/timestamps.c
+++ b/source4/lib/ldb/modules/timestamps.c
@@ -215,16 +215,16 @@ static int timestamps_rename_record(struct ldb_module *module, const struct ldb_
return ldb_next_rename_record(module, olddn, newdn);
}
-static int timestamps_lock(struct ldb_module *module, const char *lockname)
+static int timestamps_start_trans(struct ldb_module *module)
{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_lock\n");
- return ldb_next_named_lock(module, lockname);
+ ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_start_trans\n");
+ return ldb_next_start_trans(module);
}
-static int timestamps_unlock(struct ldb_module *module, const char *lockname)
+static int timestamps_end_trans(struct ldb_module *module, int status)
{
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_unlock\n");
- return ldb_next_named_unlock(module, lockname);
+ ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_end_trans\n");
+ return ldb_next_end_trans(module, status);
}
/* return extended error information */
@@ -252,16 +252,16 @@ static int timestamps_destructor(void *module_ctx)
}
static const struct ldb_module_ops timestamps_ops = {
- .name = "timestamps",
- .search = timestamps_search,
- .search_bytree = timestamps_search_bytree,
- .add_record = timestamps_add_record,
- .modify_record = timestamps_modify_record,
- .delete_record = timestamps_delete_record,
- .rename_record = timestamps_rename_record,
- .named_lock = timestamps_lock,
- .named_unlock = timestamps_unlock,
- .errstring = timestamps_errstring
+ .name = "timestamps",
+ .search = timestamps_search,
+ .search_bytree = timestamps_search_bytree,
+ .add_record = timestamps_add_record,
+ .modify_record = timestamps_modify_record,
+ .delete_record = timestamps_delete_record,
+ .rename_record = timestamps_rename_record,
+ .start_transaction = timestamps_start_trans,
+ .end_transaction = timestamps_end_trans,
+ .errstring = timestamps_errstring
};
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index ef295b7411..68d3ab2484 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -64,11 +64,12 @@ static void add_records(struct ldb_context *ldb,
struct ldb_message msg;
int i;
+#if 0
if (ldb_lock(ldb, "transaction") != 0) {
printf("transaction lock failed\n");
exit(1);
}
-
+#endif
for (i=0;i<count;i++) {
struct ldb_message_element el[6];
struct ldb_val vals[6][1];
@@ -135,12 +136,12 @@ static void add_records(struct ldb_context *ldb,
talloc_free(tmp_ctx);
}
-
+#if 0
if (ldb_unlock(ldb, "transaction") != 0) {
printf("transaction unlock failed\n");
exit(1);
}
-
+#endif
printf("\n");
}