summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-19 01:32:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:29 -0500
commitaa6b2dcb9bdff582ac7628f0c2511de12da57242 (patch)
treef3691110fe04c207d37a09d5c0686d543a8a3123 /source4
parent56cc32800036472ebc29362d65e422c0b410e3fc (diff)
downloadsamba-aa6b2dcb9bdff582ac7628f0c2511de12da57242.tar.gz
samba-aa6b2dcb9bdff582ac7628f0c2511de12da57242.tar.bz2
samba-aa6b2dcb9bdff582ac7628f0c2511de12da57242.zip
r7741: fixed the verbose option in ldbedit
(This used to be commit a440133140a6adb5ea62d37690b9c4ae74dc6be0)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/tools/ldbedit.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 73fb77dfd1..e8497ba18f 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -41,7 +41,7 @@
#include "system/filesys.h"
#endif
-static int verbose;
+static struct ldb_cmdline *options;
/*
debug routine
@@ -77,16 +77,16 @@ static int modify_record(struct ldb_context *ldb,
return 0;
}
+ if (options->verbose > 0) {
+ ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_MODIFY, mod);
+ }
+
if (ldb_modify(ldb, mod) != 0) {
fprintf(stderr, "failed to modify %s - %s\n",
msg1->dn, ldb_errstring(ldb));
return -1;
}
- if (verbose > 0) {
- ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_MODIFY, mod);
- }
-
return mod->num_elements;
}
@@ -121,14 +121,14 @@ static int merge_edits(struct ldb_context *ldb,
for (i=0;i<count2;i++) {
msg = msg_find(msgs1, count1, msgs2[i]->dn);
if (!msg) {
+ if (options->verbose > 0) {
+ ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_ADD, msgs2[i]);
+ }
if (ldb_add(ldb, msgs2[i]) != 0) {
fprintf(stderr, "failed to add %s - %s\n",
msgs2[i]->dn, ldb_errstring(ldb));
return -1;
}
- if (verbose > 0) {
- ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_ADD, msgs2[i]);
- }
adds++;
} else {
if (modify_record(ldb, msg, msgs2[i]) > 0) {
@@ -141,14 +141,14 @@ static int merge_edits(struct ldb_context *ldb,
for (i=0;i<count1;i++) {
msg = msg_find(msgs2, count2, msgs1[i]->dn);
if (!msg) {
+ if (options->verbose > 0) {
+ ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_DELETE, msgs1[i]);
+ }
if (ldb_delete(ldb, msgs1[i]->dn) != 0) {
fprintf(stderr, "failed to delete %s - %s\n",
msgs1[i]->dn, ldb_errstring(ldb));
return -1;
}
- if (verbose > 0) {
- ldif_write_msg(ldb, stdout, LDB_CHANGETYPE_DELETE, msgs1[i]);
- }
deletes++;
}
}
@@ -280,7 +280,6 @@ static void usage(void)
int ret;
const char *expression = NULL;
const char * const * attrs = NULL;
- struct ldb_cmdline *options;
ldb = ldb_init(NULL);