diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-21 12:55:59 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-21 12:55:59 +0930 |
commit | 36b455d95227f8ef2f08e3134e289b2862b319f9 (patch) | |
tree | d08bc2518bb12e9e38dac8d81dd74430c0441cd6 /lib/tdb_compat/tdb_compat.c | |
parent | ad3ac7e3c0bdf9b93c6b831f29452fd63fe0818b (diff) | |
download | samba-36b455d95227f8ef2f08e3134e289b2862b319f9.tar.gz samba-36b455d95227f8ef2f08e3134e289b2862b319f9.tar.bz2 samba-36b455d95227f8ef2f08e3134e289b2862b319f9.zip |
tdb_compat: handle TDB_INCOMPATIBLE_HASH flag.
This is only meaningful when using the TDB_VERSION1 flag: it is done
by using a magic hash value (which will fall back to the default hash
if that works instead).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb_compat/tdb_compat.c')
-rw-r--r-- | lib/tdb_compat/tdb_compat.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/tdb_compat/tdb_compat.c b/lib/tdb_compat/tdb_compat.c index fd3a68717a..9ed6604c4d 100644 --- a/lib/tdb_compat/tdb_compat.c +++ b/lib/tdb_compat/tdb_compat.c @@ -94,7 +94,7 @@ tdb_open_compat_(const char *name, int hash_size_unused, void *data), void *log_data) { - union tdb_attribute cif, log, *attr = NULL; + union tdb_attribute cif, log, hash, *attr = NULL; if (log_fn) { log.log.base.attr = TDB_ATTRIBUTE_LOG; @@ -112,6 +112,16 @@ tdb_open_compat_(const char *name, int hash_size_unused, tdb_flags &= ~TDB_CLEAR_IF_FIRST; } + if (tdb_flags & TDB_INCOMPATIBLE_HASH) { + if (tdb_flags & TDB_VERSION1) { + hash.hash.base.attr = TDB_ATTRIBUTE_HASH; + hash.hash.base.next = attr; + hash.hash.fn = tdb1_incompatible_hash; + attr = &hash; + } + tdb_flags &= ~TDB_INCOMPATIBLE_HASH; + } + /* Testsuite uses this to speed things up. */ if (getenv("TDB_NO_FSYNC")) { tdb_flags |= TDB_NOSYNC; |