diff options
-rw-r--r-- | source3/lib/dbwrap/dbwrap.c | 14 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap.h | 3 | ||||
-rw-r--r-- | source3/utils/net_idmap_check.c | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c index f0d61a9a2f..614251c06f 100644 --- a/source3/lib/dbwrap/dbwrap.c +++ b/source3/lib/dbwrap/dbwrap.c @@ -111,8 +111,18 @@ NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key) NTSTATUS dbwrap_traverse(struct db_context *db, int (*f)(struct db_record*, void*), - void *private_data) + void *private_data, + int *count) { int ret = db->traverse(db, f, private_data); - return (ret < 0) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK; + + if (ret < 0) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + + if (count != NULL) { + *count = ret; + } + + return NT_STATUS_OK; } diff --git a/source3/lib/dbwrap/dbwrap.h b/source3/lib/dbwrap/dbwrap.h index bceba6c2d4..7dda1bae52 100644 --- a/source3/lib/dbwrap/dbwrap.h +++ b/source3/lib/dbwrap/dbwrap.h @@ -65,7 +65,8 @@ TDB_DATA dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key); NTSTATUS dbwrap_traverse(struct db_context *db, int (*f)(struct db_record*, void*), - void *private_data); + void *private_data, + int *count); /* The following definitions come from lib/dbwrap_util.c */ diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c index 14f2f8d10f..17389a53bb 100644 --- a/source3/utils/net_idmap_check.c +++ b/source3/utils/net_idmap_check.c @@ -892,7 +892,7 @@ static bool check_do_checks(struct check_ctx* ctx) return false; } - status = dbwrap_traverse(ctx->db, traverse_check, ctx); + status = dbwrap_traverse(ctx->db, traverse_check, ctx, NULL); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("failed to traverse %s\n", ctx->name)); @@ -929,7 +929,7 @@ static bool check_transaction_cancel(struct check_ctx* ctx) { static void check_diff_list(struct check_ctx* ctx) { - NTSTATUS status = dbwrap_traverse(ctx->diff, traverse_print_diff, ctx); + NTSTATUS status = dbwrap_traverse(ctx->diff, traverse_print_diff, ctx, NULL); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("failed to traverse diff\n")); @@ -965,7 +965,7 @@ static bool check_commit(struct check_ctx* ctx) return false; } - status = dbwrap_traverse(ctx->diff, traverse_commit, ctx); + status = dbwrap_traverse(ctx->diff, traverse_commit, ctx, NULL); if (!NT_STATUS_IS_OK(status)) { check_transaction_cancel(ctx); |