tdb: Make robust against shrinking tdbs
commitfb7e362a6bfa5b4d83735ef62f97a4fdd4b04ca7
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 8 Oct 2012 18:56:47 +0000 (8 11:56 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Oct 2012 09:05:43 +0000 (29 10:05 +0100)
tree7cc338a2f6a19ae7ec5f7446d3dd8e314794745b
parent5e1962d7ca9f232345e6e7e64d358547958630ed
tdb: Make robust against shrinking tdbs

When probing for a size change (eg. just before tdb_expand, tdb_check,
tdb_rescue) we call tdb_oob(tdb, tdb->map_size, 1, 1).  Unfortunately
this does nothing if the tdb has actually shrunk, which as Volker
demonstrated, can actually happen if a "longlived" parent crashes.

So move the map/update size/remap before the limit check.
(cherry picked from commit e7e86fcb929e7b8e7d879349d5f7f9422126a3a2)
lib/tdb/common/io.c