1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2011-06-20 18:40:32 +09:30
parent 4823262439
commit 61867eaa84

View 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) {