svn commit: samba r7641 - in branches/SAMBA_4_0/source/lib/tdb/common: .

jra at samba.org jra at samba.org
Thu Jun 16 16:43:24 GMT 2005


Author: jra
Date: 2005-06-16 16:43:23 +0000 (Thu, 16 Jun 2005)
New Revision: 7641

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7641

Log:
Fix based on work from  "Shlomi Yaakobovich" <Shlomi at exanet.com> to catch
loops in corrupted tdb files.
Jeremy.

Modified:
   branches/SAMBA_4_0/source/lib/tdb/common/tdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/tdb/common/tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/tdb/common/tdb.c	2005-06-16 16:39:49 UTC (rev 7640)
+++ branches/SAMBA_4_0/source/lib/tdb/common/tdb.c	2005-06-16 16:43:23 UTC (rev 7641)
@@ -1295,6 +1295,13 @@
 			tdb_off current;
 			if (rec_read(tdb, tlock->off, rec) == -1)
 				goto fail;
+
+			/* Detect infinite loops. From "Shlomi Yaakobovich" <Shlomi at exanet.com>. */
+			if (tlock->off == rec->next) {
+				TDB_LOG((tdb, 0, "tdb_next_lock: loop detected.\n"));
+				goto fail;
+			}
+
 			if (!TDB_DEAD(rec)) {
 				/* Woohoo: we found one! */
 				if (lock_record(tdb, tlock->off) != 0)
@@ -1302,12 +1309,6 @@
 				return tlock->off;
 			}
 
-			/* Detect infinite loops. From "Shlomi Yaakobovich" <Shlomi at exanet.com>. */
-			if (tlock->off == rec->next) {
-				TDB_LOG((tdb, 0, "tdb_next_lock: loop detected.\n"));
-				goto fail;
-			}
-
 			/* Try to clean dead ones from old traverses */
 			current = tlock->off;
 			tlock->off = rec->next;



More information about the samba-cvs mailing list