summaryrefslogtreecommitdiff
path: root/source3/tdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-02-04 23:40:43 +0000
committerJeremy Allison <jra@samba.org>2003-02-04 23:40:43 +0000
commit2e45eda38611c8a4ca43525296a8f40074338f6d (patch)
tree96d1ee6c1d9cf433d0499fa513716eac5b228fe5 /source3/tdb
parentae26a74e796a29a6a1df82d69d263d49f802b551 (diff)
downloadsamba-2e45eda38611c8a4ca43525296a8f40074338f6d.tar.gz
samba-2e45eda38611c8a4ca43525296a8f40074338f6d.tar.bz2
samba-2e45eda38611c8a4ca43525296a8f40074338f6d.zip
Ensure we overwrite a tdb if the hash size changes.
Jeremy. (This used to be commit b300696cb5c65ab239caa257987628f8e18c8761)
Diffstat (limited to 'source3/tdb')
-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) {