svn commit: samba r7639 - in trunk/source/tdb: .

jra at samba.org jra at samba.org
Thu Jun 16 16:39:48 GMT 2005


Author: jra
Date: 2005-06-16 16:39:47 +0000 (Thu, 16 Jun 2005)
New Revision: 7639

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

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

Modified:
   trunk/source/tdb/tdb.c


Changeset:
Modified: trunk/source/tdb/tdb.c
===================================================================
--- trunk/source/tdb/tdb.c	2005-06-16 12:45:35 UTC (rev 7638)
+++ trunk/source/tdb/tdb.c	2005-06-16 16:39:47 UTC (rev 7639)
@@ -1270,6 +1270,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)
@@ -1277,12 +1284,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