summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;