svn commit: samba r7640 - in branches/SAMBA_3_0/source/tdb: .

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


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

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

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

Modified:
   branches/SAMBA_3_0/source/tdb/tdb.c


Changeset:
Modified: branches/SAMBA_3_0/source/tdb/tdb.c
===================================================================
--- branches/SAMBA_3_0/source/tdb/tdb.c	2005-06-16 16:39:47 UTC (rev 7639)
+++ branches/SAMBA_3_0/source/tdb/tdb.c	2005-06-16 16:39:49 UTC (rev 7640)
@@ -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