summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/tools/ldbadd.c10
-rw-r--r--source4/lib/ldb/tools/ldbedit.c10
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c10
3 files changed, 30 insertions, 0 deletions
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index 15376e7342..3749aec629 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -92,6 +92,11 @@ int main(int argc, const char **argv)
options = ldb_cmdline_process(ldb, argc, argv, usage);
+ if (ldb_transaction_start(ldb) != 0) {
+ printf("Failed to start transaction\n");
+ exit(1);
+ }
+
if (options->argc == 0) {
ret = process_file(ldb, stdin, &count);
} else {
@@ -108,6 +113,11 @@ int main(int argc, const char **argv)
}
}
+ if (count != 0 && ldb_transaction_commit(ldb) != 0) {
+ printf("Failed to commit transaction\n");
+ exit(1);
+ }
+
talloc_free(ldb);
printf("Added %d records with %d failures\n", count, failures);
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index b2a040cd09..b18aea1b10 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -112,6 +112,11 @@ static int merge_edits(struct ldb_context *ldb,
int ret = 0;
int adds=0, modifies=0, deletes=0;
+ if (ldb_transaction_start(ldb) != 0) {
+ fprintf(stderr, "Failed to start transaction\n");
+ return -1;
+ }
+
/* do the adds and modifies */
for (i=0;i<count2;i++) {
msg = msg_find(ldb, msgs1, count1, msgs2[i]->dn);
@@ -150,6 +155,11 @@ static int merge_edits(struct ldb_context *ldb,
}
}
+ if (ldb_transaction_commit(ldb) != 0) {
+ fprintf(stderr, "Failed to commit transaction\n");
+ return -1;
+ }
+
printf("# %d adds %d modifies %d deletes\n", adds, modifies, deletes);
return ret;
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index 6e355a10cf..8b6309e016 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -91,6 +91,11 @@ int main(int argc, const char **argv)
ldb = ldb_init(NULL, NULL);
+ if (ldb_transaction_start(ldb) != 0) {
+ printf("Failed to start transaction\n");
+ exit(1);
+ }
+
options = ldb_cmdline_process(ldb, argc, argv, usage);
if (options->argc == 0) {
@@ -108,6 +113,11 @@ int main(int argc, const char **argv)
}
}
+ if (count != 0 && ldb_transaction_commit(ldb) != 0) {
+ printf("Failed to commit transaction\n");
+ exit(1);
+ }
+
talloc_free(ldb);
printf("Modified %d records with %d failures\n", count, failures);