tdb_validate: TDB2 support for tdb_validate_child and tdb_backup.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:10:32 +0000 (18:40 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:18:35 +0000 (11:18 +0200)
We don't expose freelist or hash size for TDB2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
source3/lib/tdb_validate.c

index 210d91eeb042abcce4b3b98eba3fe7dce1983221..617160ee86b01f95e722fb147cea59a30ba83db1 100644 (file)
@@ -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) {