diff options
author | Gregor Beck <gbeck@sernet.de> | 2011-03-16 09:13:40 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-04-04 15:57:35 +0200 |
commit | 84019ea5288ec3ec83739aa8142ec50cef0f1b82 (patch) | |
tree | ee1c66adf4287895948bdf8b97b68e0b2ee03f88 /source3/lib | |
parent | 10cec2f0ec752cbec2055b0aa878b4814f3c1309 (diff) | |
download | samba-84019ea5288ec3ec83739aa8142ec50cef0f1b82.tar.gz samba-84019ea5288ec3ec83739aa8142ec50cef0f1b82.tar.bz2 samba-84019ea5288ec3ec83739aa8142ec50cef0f1b82.zip |
s3: add function dbwrap_trans_traverse
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap_util.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c index 0020fc675e..6e5f14af33 100644 --- a/source3/lib/dbwrap_util.c +++ b/source3/lib/dbwrap_util.c @@ -416,6 +416,36 @@ NTSTATUS dbwrap_trans_do(struct db_context *db, return NT_STATUS_INTERNAL_DB_CORRUPTION; } +struct dbwrap_trans_traverse_action_ctx { + int (*f)(struct db_record* rec, void* private_data); + void* private_data; +}; + + +static NTSTATUS dbwrap_trans_traverse_action(struct db_context* db, void* private_data) +{ + struct dbwrap_trans_traverse_action_ctx* ctx = + (struct dbwrap_trans_traverse_action_ctx*)private_data; + + int ret = db->traverse(db, ctx->f, ctx->private_data); + + return (ret == -1) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK; +} + +NTSTATUS dbwrap_trans_traverse(struct db_context *db, + int (*f)(struct db_record*, void*), + void *private_data) +{ + struct dbwrap_trans_traverse_action_ctx ctx = { + .f = f, + .private_data = private_data, + }; + return dbwrap_trans_do(db, dbwrap_trans_traverse_action, &ctx); +} + + + + NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key) { char *key_upper; |