From 61867eaa8458431c452352df021169c100fa9188 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 18:40:32 +0930 Subject: [PATCH] tdb_validate: TDB2 support for tdb_validate_child and tdb_backup. We don't expose freelist or hash size for TDB2. Signed-off-by: Rusty Russell --- source3/lib/tdb_validate.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c index 210d91eeb042..617160ee86b0 100644 --- a/source3/lib/tdb_validate.c +++ b/source3/lib/tdb_validate.c @@ -57,6 +57,7 @@ static int tdb_validate_child(struct tdb_context *tdb, goto out; } +#ifndef BUILD_TDB2 /* Check if the tdb's freelist is good. */ if (tdb_validate_freelist(tdb, &num_entries) == -1) { v_status.bad_freelist = True; @@ -66,6 +67,7 @@ static int tdb_validate_child(struct tdb_context *tdb, DEBUG(10,("tdb_validate_child: tdb %s freelist has %d entries\n", tdb_name(tdb), num_entries)); +#endif /* Now traverse the tdb to validate it. */ num_entries = tdb_traverse(tdb, validate_fn, (void *)&v_status); @@ -289,8 +291,14 @@ static int tdb_backup(TALLOC_CTX *ctx, const char *src_path, } unlink(tmp_path); - dst_tdb = tdb_open_log(tmp_path, - hash_size ? hash_size : tdb_hash_size(src_tdb), + +#ifndef BUILD_TDB2 + if (!hash_size) { + hash_size = tdb_hash_size(src_tdb); + } +#endif + + dst_tdb = tdb_open_log(tmp_path, hash_size, TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL, st.st_mode & 0777); if (dst_tdb == NULL) { -- 2.34.1