summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1_open.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:41:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:41:13 +0930
commitf7e84f8ef86c3323f70e2fa30fd8a49cab1febf9 (patch)
tree580a9c1302b332602263b7f1192ea5ee61d43521 /lib/tdb2/tdb1_open.c
parentb4a5c6dcb6c60a32b92772396dadfffa6b721732 (diff)
downloadsamba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.gz
samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.bz2
samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.zip
tdb2: Make TDB1 use the same tdb_hash() wrapper as TDB2
This means converting the tdb1 inbuilt hash functions to the tdb2-style, so they return 64 bit. We truncate to 32 bit everywhere but in tdb_check() which needs to do so explicitly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 3e46dde21261966941469a6c75e1b45cd2d26324)
Diffstat (limited to 'lib/tdb2/tdb1_open.c')
-rw-r--r--lib/tdb2/tdb1_open.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/tdb2/tdb1_open.c b/lib/tdb2/tdb1_open.c
index 1fe981ac76..c01cc6e061 100644
--- a/lib/tdb2/tdb1_open.c
+++ b/lib/tdb2/tdb1_open.c
@@ -34,16 +34,10 @@ static struct tdb1_context *tdb1s = NULL;
void tdb1_header_hash(struct tdb1_context *tdb,
uint32_t *magic1_hash, uint32_t *magic2_hash)
{
- TDB_DATA hash_key;
uint32_t tdb1_magic = TDB1_MAGIC;
- hash_key.dptr = (unsigned char *)TDB_MAGIC_FOOD;
- hash_key.dsize = sizeof(TDB_MAGIC_FOOD);
- *magic1_hash = tdb->hash_fn(&hash_key);
-
- hash_key.dptr = (unsigned char *)TDB1_CONV(tdb1_magic);
- hash_key.dsize = sizeof(tdb1_magic);
- *magic2_hash = tdb->hash_fn(&hash_key);
+ *magic1_hash = tdb_hash(tdb, TDB_MAGIC_FOOD, sizeof(TDB_MAGIC_FOOD));
+ *magic2_hash = tdb_hash(tdb, TDB1_CONV(tdb1_magic), sizeof(tdb1_magic));
/* Make sure at least one hash is non-zero! */
if (*magic1_hash == 0 && *magic2_hash == 0)
@@ -223,6 +217,7 @@ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flag
errno = ENOMEM;
goto fail;
}
+ tdb->hash_seed = 0;
if (hash_fn) {
tdb->hash_fn = hash_fn;