tdb: Make robust against shrinking tdbs
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 8 Oct 2012 18:56:47 +0000 (11:56 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 Oct 2012 07:25:53 +0000 (09:25 +0200)
commite7e86fcb929e7b8e7d879349d5f7f9422126a3a2
treec3da1e1d52804914dc49ecd01272cbec2c731778
parentac7d9768c718f6225f2182d763ec1dbc6dc48ea8
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.
lib/tdb/common/io.c