summaryrefslogtreecommitdiffstats
path: root/source3/lib/dbwrap/dbwrap.c
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2011-08-16 14:39:19 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:55 +0200
commitdc4a5f532392bb7e047b11017fa7916a68d67192 (patch)
treec0bb7fc304a4de24e342cb682d86624b20ee1434 /source3/lib/dbwrap/dbwrap.c
parent63c5c0eccf3df89135c4e18f5660e6f94978e3d3 (diff)
downloadsamba-dc4a5f532392bb7e047b11017fa7916a68d67192.tar.gz
samba-dc4a5f532392bb7e047b11017fa7916a68d67192.tar.xz
samba-dc4a5f532392bb7e047b11017fa7916a68d67192.zip
s3:dbwrap: add function dbwrap_wipe()
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib/dbwrap/dbwrap.c')
-rw-r--r--source3/lib/dbwrap/dbwrap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c
index af8e28cb7e..ad3f914e41 100644
--- a/source3/lib/dbwrap/dbwrap.c
+++ b/source3/lib/dbwrap/dbwrap.c
@@ -77,6 +77,23 @@ int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
}
+static int delete_record(struct db_record *rec, void *data)
+{
+ NTSTATUS status = rec->delete_rec(rec);
+ return NT_STATUS_IS_OK(status) ? 0 : -1;
+}
+
+/*
+ * Fallback wipe ipmlementation using traverse and delete if no genuine
+ * wipe operation is provided
+ */
+int dbwrap_fallback_wipe(struct db_context *db)
+{
+ NTSTATUS status = dbwrap_trans_traverse(db, &delete_record, NULL);
+ return NT_STATUS_IS_OK(status) ? 0 : -1;
+}
+
+
TDB_DATA dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
TDB_DATA key)
{
@@ -186,3 +203,8 @@ int dbwrap_parse_record(struct db_context *db, TDB_DATA key,
return dbwrap_fallback_parse_record(db, key, parser, private_data);
}
}
+
+int dbwrap_wipe(struct db_context *db)
+{
+ return db->wipe(db);
+}