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

When opening an existing DB, don't require the hash_size specified to

the open call to be the same as that of the existing tdb.  The
specified hash_size is only used if the tdb needs to be (re)created.

With this patch in place, tdbtool can open the printing tdbs, which
are created with a hash_size of 5000.  Before it would fail with EIO.
This commit is contained in:
Martin Pool -
parent c5c1a79793
commit e412dd6d7e

View File

@ -1728,8 +1728,7 @@ 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) if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header)
|| strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0 || 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))))) { && !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) {
/* its not a valid database - possibly initialise it */ /* its not a valid database - possibly initialise it */
if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) { if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {