[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-parse.c,
1.43, 1.44 mbox-sync-private.h, 1.53, 1.54 mbox-sync-update.c,
1.37, 1.38 mbox-sync.c, 1.167, 1.168
cras at dovecot.org
cras at dovecot.org
Sun Aug 7 14:28:15 EEST 2005
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv26608/lib-storage/index/mbox
Modified Files:
mbox-sync-parse.c mbox-sync-private.h mbox-sync-update.c
mbox-sync.c
Log Message:
Don't crash in some situations with broken X-UID headers.
Index: mbox-sync-parse.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-parse.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- mbox-sync-parse.c 12 Jul 2005 14:43:11 -0000 1.43
+++ mbox-sync-parse.c 7 Aug 2005 11:28:13 -0000 1.44
@@ -359,13 +359,13 @@
/* UID is larger than expected. Don't allow it because
incoming mails can contain untrusted X-UID fields,
causing possibly DoS if the UIDs get large enough. */
- ctx->uid_broken = TRUE;
+ ctx->mail.uid_broken = TRUE;
return FALSE;
}
if (value <= ctx->sync_ctx->prev_msg_uid) {
/* broken - UIDs must be growing */
- ctx->uid_broken = TRUE;
+ ctx->mail.uid_broken = TRUE;
return FALSE;
}
Index: mbox-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-private.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- mbox-sync-private.h 26 Apr 2005 14:52:02 -0000 1.53
+++ mbox-sync-private.h 7 Aug 2005 11:28:13 -0000 1.54
@@ -42,8 +42,11 @@
struct mbox_sync_mail {
uint32_t uid;
uint32_t idx_seq;
- uint8_t flags;
+
array_t ARRAY_DEFINE(keywords, unsigned int);
+ uint8_t flags;
+
+ unsigned int uid_broken:1;
uoff_t from_offset;
uoff_t body_size;
@@ -86,7 +89,6 @@
unsigned int updated:1;
unsigned int recent:1;
unsigned int dirty:1;
- unsigned int uid_broken:1;
unsigned int imapbase_rewrite:1;
unsigned int imapbase_updated:1;
};
Index: mbox-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-update.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- mbox-sync-update.c 4 Jul 2005 11:32:28 -0000 1.37
+++ mbox-sync-update.c 7 Aug 2005 11:28:13 -0000 1.38
@@ -435,7 +435,11 @@
mbox_sync_update_xkeywords(ctx);
}
- i_assert(ctx->mail.uid == 0 || ctx->mail.uid == mail->uid);
+ /* we might not have done the UID validity checks in same way this
+ time, so just overwrite conflicting UIDs if uid_broken was set in
+ first parse time */
+ i_assert(ctx->mail.uid == 0 || ctx->mail.uid_broken ||
+ ctx->mail.uid == mail->uid);
ctx->mail.uid = mail->uid;
mbox_sync_update_x_imap_base(ctx);
Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- mbox-sync.c 23 Jul 2005 09:20:51 -0000 1.167
+++ mbox-sync.c 7 Aug 2005 11:28:13 -0000 1.168
@@ -1018,7 +1018,7 @@
return -1;
}
- if (mail_ctx->uid_broken && partial) {
+ if (mail_ctx->mail.uid_broken && partial) {
/* UID ordering problems, resync everything to make
sure we get everything right */
if (sync_ctx->mbox->mbox_sync_dirty)
More information about the dovecot-cvs
mailing list