dovecot-2.0: maildir: Make sure we message's UID isn't tried to ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 18 05:54:02 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/9fdeca77d421
changeset: 10739:9fdeca77d421
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 18 05:53:08 2010 +0200
description:
maildir: Make sure we message's UID isn't tried to be changed unexpectedly.
diffstat:
src/lib-storage/index/maildir/maildir-uidlist.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r 843a9d68f2f5 -r 9fdeca77d421 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c Thu Feb 18 05:26:51 2010 +0200
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c Thu Feb 18 05:53:08 2010 +0200
@@ -1644,7 +1644,7 @@
return 1;
}
-static void
+static int
maildir_uidlist_sync_next_partial(struct maildir_uidlist_sync_ctx *ctx,
const char *filename, uint32_t uid,
enum maildir_uidlist_rec_flag flags)
@@ -1658,7 +1658,7 @@
/* doesn't exist in uidlist */
if (!ctx->locked) {
/* we can't add it, so just ignore it */
- return;
+ return 1;
}
if (ctx->first_new_pos == (unsigned int)-1)
ctx->first_new_pos = array_count(&uidlist->records);
@@ -1679,6 +1679,12 @@
uidlist->change_counter++;
}
if (uid != 0) {
+ if (rec->uid != uid && rec->uid != (uint32_t)-1) {
+ mail_storage_set_critical(uidlist->mbox->box.storage,
+ "Maildir: %s changed UID %u -> %u",
+ filename, rec->uid, uid);
+ return -1;
+ }
rec->uid = uid;
if (uidlist->next_uid <= uid)
uidlist->next_uid = uid + 1;
@@ -1689,6 +1695,7 @@
hash_table_insert(uidlist->files, rec->filename, rec);
ctx->finished = FALSE;
+ return 1;
}
static unsigned char *ext_dup(pool_t pool, const unsigned char *extensions)
@@ -1740,8 +1747,8 @@
}
if (ctx->partial) {
- maildir_uidlist_sync_next_partial(ctx, filename, uid, flags);
- return 1;
+ return maildir_uidlist_sync_next_partial(ctx, filename,
+ uid, flags);
}
rec = hash_table_lookup(ctx->files, filename);
More information about the dovecot-cvs
mailing list