summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2011-08-16 14:55:30 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:56 +0200
commitebcb92118241a5bd4be92374b1c257236ba3b1db (patch)
tree27f4238b5b2ac51956d7af8a43d4a31ca06094da /source3/lib/dbwrap
parent97fef0c2fd7dc622bb11cfc374e88f82b77086cf (diff)
downloadsamba-ebcb92118241a5bd4be92374b1c257236ba3b1db.tar.gz
samba-ebcb92118241a5bd4be92374b1c257236ba3b1db.tar.bz2
samba-ebcb92118241a5bd4be92374b1c257236ba3b1db.zip
s3:dbwrap: add specific dbwrap_wipe() implementation to dbwrap_rbt
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r--source3/lib/dbwrap/dbwrap_rbt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_rbt.c b/source3/lib/dbwrap/dbwrap_rbt.c
index 3b5574a257..450e4588b9 100644
--- a/source3/lib/dbwrap/dbwrap_rbt.c
+++ b/source3/lib/dbwrap/dbwrap_rbt.c
@@ -316,6 +316,19 @@ static int db_rbt_exists(struct db_context *db, TDB_DATA key)
return db_rbt_search_internal(db, key, NULL);
}
+static int db_rbt_wipe(struct db_context *db)
+{
+ struct db_rbt_ctx *old_ctx = talloc_get_type_abort(
+ db->private_data, struct db_rbt_ctx);
+ struct db_rbt_ctx *new_ctx = TALLOC_ZERO_P(db, struct db_rbt_ctx);
+ if (new_ctx == NULL) {
+ return -1;
+ }
+ db->private_data = new_ctx;
+ talloc_free(old_ctx);
+ return 0;
+}
+
static int db_rbt_parse_record(struct db_context *db, TDB_DATA key,
int (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
@@ -433,6 +446,7 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx)
result->transaction_commit = db_rbt_trans_dummy;
result->transaction_cancel = db_rbt_trans_dummy;
result->exists = db_rbt_exists;
+ result->wipe = db_rbt_wipe;
result->parse_record = db_rbt_parse_record;
return result;