From 87f51bfa99889c4700697556466cc694e2e6644d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 17 Aug 2011 09:59:25 +0200 Subject: s3:dbwrap: add a wrapper dbwrap_traverse_read() --- source3/lib/dbwrap/dbwrap.c | 18 ++++++++++++++++++ source3/lib/dbwrap/dbwrap.h | 4 ++++ 2 files changed, 22 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c index 614251c06f..c2d28b3a0e 100644 --- a/source3/lib/dbwrap/dbwrap.c +++ b/source3/lib/dbwrap/dbwrap.c @@ -126,3 +126,21 @@ NTSTATUS dbwrap_traverse(struct db_context *db, return NT_STATUS_OK; } + +NTSTATUS dbwrap_traverse_read(struct db_context *db, + int (*f)(struct db_record*, void*), + void *private_data, + int *count) +{ + int ret = db->traverse_read(db, f, private_data); + + 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 7dda1bae52..2ba96b2482 100644 --- a/source3/lib/dbwrap/dbwrap.h +++ b/source3/lib/dbwrap/dbwrap.h @@ -67,6 +67,10 @@ NTSTATUS dbwrap_traverse(struct db_context *db, int (*f)(struct db_record*, void*), void *private_data, int *count); +NTSTATUS dbwrap_traverse_read(struct db_context *db, + int (*f)(struct db_record*, void*), + void *private_data, + int *count); /* The following definitions come from lib/dbwrap_util.c */ -- cgit