summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-04 23:40:17 +0000
committerJeremy Allison <jra@samba.org>2003-02-04 23:40:17 +0000
commit0716caac8bde5e3d7d19e80c7345096f94edad89 (patch)
tree6435684f767fd86704f873d01e33374ec0c71452 /source3
parent22e23401551e8c35fea8d7601420e746cb4a2527 (diff)
downloadsamba-0716caac8bde5e3d7d19e80c7345096f94edad89.tar.gz
samba-0716caac8bde5e3d7d19e80c7345096f94edad89.tar.bz2
samba-0716caac8bde5e3d7d19e80c7345096f94edad89.zip
Ensure we overwrite a tdb if the hash size changes.
Jeremy. (This used to be commit 3497330ff53a264e433090066b7318c31d833411)
Diffstat (limited to 'source3')
-rw-r--r--source3/tdb/tdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index f309bdd315..c685d72b37 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -1709,7 +1709,8 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header)
|| strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0
- || (tdb->header.version != TDB_VERSION
+ || tdb->header.version != TDB_VERSION
+ || (tdb->header.hash_size != hash_size
&& !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) {
/* its not a valid database - possibly initialise it */
if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {