infinite loop ijn tdb/tdb.c function tdb_next_lock
jra at samba.org
Thu Feb 24 00:46:46 GMT 2005
On Wed, Feb 23, 2005 at 08:01:39AM +0200, Shlomi Yaakobovich wrote:
> I have also ran into the same scenario, for me it was the unexpected.tdb file. What I did in order to fix this was to add the simple check before assigning current and off:
> > diff -u tdb.c patch/tdb.c
> --- tdb.c 2005-02-22 17:55:45.000000000 +0200
> +++ patch/tdb.c 2005-02-23 07:57:00.000000000 +0200
> @@ -1280,6 +1280,8 @@
> return tlock->off;
> /* Try to clean dead ones from old traverses */
> + if (tlock->off == rec->next)
> + goto fail;
> current = tlock->off;
> tlock->off = rec->next;
> if (!tdb->read_only &&
> It resulted in failing the validation of course, and successfully restored the file from its backup file.
> The patch is also attached here, based on my Samba 3.0.7, if anyone wishes to use it. I am not an expert in Samba code, but it looks as if this can't be any worse than the current code, which causes the infinite loop. There may be a better solution, those who knows this code better should comment on it, I suppose.
This looks like a good additional check to have, thanks !
More information about the samba-technical