1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r7640: Fix based on work from "Shlomi Yaakobovich" <Shlomi@exanet.com> to catch

loops in corrupted tdb files.
Jeremy.
This commit is contained in:
Jeremy Allison 2005-06-16 16:39:49 +00:00 committed by Gerald (Jerry) Carter
parent a11bb4476c
commit b438cb0a85

View File

@ -1270,12 +1270,6 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock,
tdb_off current;
if (rec_read(tdb, tlock->off, rec) == -1)
goto fail;
if (!TDB_DEAD(rec)) {
/* Woohoo: we found one! */
if (lock_record(tdb, tlock->off) != 0)
goto fail;
return tlock->off;
}
/* Detect infinite loops. From "Shlomi Yaakobovich" <Shlomi@exanet.com>. */
if (tlock->off == rec->next) {
@ -1283,6 +1277,13 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock,
goto fail;
}
if (!TDB_DEAD(rec)) {
/* Woohoo: we found one! */
if (lock_record(tdb, tlock->off) != 0)
goto fail;
return tlock->off;
}
/* Try to clean dead ones from old traverses */
current = tlock->off;
tlock->off = rec->next;