[PATCH] minor tdb fixes

Stefan Metzmacher metze at samba.org
Mon Jul 3 08:06:28 UTC 2017


Hi Ralph,

> Attached is a small patchset that fixes the BUCKET() macro in tdb and the offset
> calculations.
> 
> I stumpled upon this when looking at the `tdbtool DB list` output: the freelist
> was showing the entries from another chain.
> 
> Turns out that the BUCKET(-1) macro returns wrong results because of sign
> conversion, eg -1 is sign converted to an unsigned int 4294967295 and 4294967295
> % 10 = 5. The expected result is -1, not 5.
> 
> This doesn't cause more severe issues because we consistenly lock the wrong
> chain when trying to lock the freelist. It doesn't deadlock because in tdb_store
> we lock the freelist before the hashchain. And finally in freelist.c we use the
> FREELIST_TOP define directly, not the TDB_HASH_TOP macro that uses BUCKET.
> 
> Thoughts?

Sadly it's now a feature as existing tdb versions use this logic.
So we can't just fix this as it's an incompatible change.

metze


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170703/e9ea208d/signature.sig>


More information about the samba-technical mailing list