diff options
author | Jeremy Allison <jra@samba.org> | 2005-06-16 16:39:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:57:18 -0500 |
commit | eb2280663f086b61b064ba0ca16aff98c5d81ba1 (patch) | |
tree | b88cea45a9ea90aa57dc7e0ae72ddb11a81b4a6f | |
parent | 6920858108426a38596eb617b94053b316760de4 (diff) | |
download | samba-eb2280663f086b61b064ba0ca16aff98c5d81ba1.tar.gz samba-eb2280663f086b61b064ba0ca16aff98c5d81ba1.tar.bz2 samba-eb2280663f086b61b064ba0ca16aff98c5d81ba1.zip |
r7640: Fix based on work from "Shlomi Yaakobovich" <Shlomi@exanet.com> to catch
loops in corrupted tdb files.
Jeremy.
(This used to be commit b438cb0a85217c978f1d7cb9f2a4fd97f38a3193)
-rw-r--r-- | source3/tdb/tdb.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index d91e6e4efc..47a2f070b6 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -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; |