tdb: Make robust against shrinking tdbs
commitcb2f7c9cc39a51ba274b69a82ca853eb44858f8f
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 6 Oct 2012 11:23:05 +0000 (6 13:23 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 Oct 2012 07:24:29 +0000 (9 09:24 +0200)
treea5b4418bb7913d52f1db37b8c2e48e717d487fba
parent566e45049851212d7e7bfe98d3ae556210b07004
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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/io.c