Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mbox/mbox-rewrite.c @ 570:2626acd3c6f4 HEAD
And more locking/syncing fixes. Now it's finally beginning to look sane
again.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Nov 2002 06:47:40 +0200 |
parents | 08d5e82b9068 |
children | b69e50478671 |
line wrap: on
line diff
--- a/src/lib-index/mbox/mbox-rewrite.c Sun Nov 03 12:11:47 2002 +0200 +++ b/src/lib-index/mbox/mbox-rewrite.c Mon Nov 04 06:47:40 2002 +0200 @@ -424,7 +424,9 @@ tmp_fd = -1; inbuf = NULL; failed = TRUE; rewrite = FALSE; do { - /* make sync() lock the file to prevent race conditions */ + if (!index->set_lock(index, MAIL_LOCK_EXCLUSIVE)) + break; + if (!index->sync_and_lock(index, MAIL_LOCK_EXCLUSIVE, NULL)) break; @@ -479,6 +481,13 @@ break; } + if (offset < inbuf->v_offset) { + index_set_corrupted(index, + "Invalid message offset"); + failed = TRUE; + break; + } + if (offset + hdr_size + body_size > inbuf->v_size) { index_set_corrupted(index, "Invalid message size");