dovecot-2.0: mbox: Make sure we have valid mailbox GUID when ret...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 15 07:09:16 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/1afcc09c2c6c
changeset: 10733:1afcc09c2c6c
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 15 07:08:40 2010 +0200
description:
mbox: Make sure we have valid mailbox GUID when returning it.
diffstat:
src/lib-storage/index/mbox/mbox-storage.c | 4 ++++
src/lib-storage/mail-storage.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diffs (30 lines):
diff -r 8f251e0bc02d -r 1afcc09c2c6c src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c Mon Feb 15 06:12:59 2010 +0200
+++ b/src/lib-storage/index/mbox/mbox-storage.c Mon Feb 15 07:08:40 2010 +0200
@@ -573,6 +573,10 @@
"Mailbox GUIDs are not permanent without index files");
return -1;
}
+ if (mail_guid_128_is_empty(mbox->mbox_hdr.mailbox_guid)) {
+ if (mailbox_sync(&mbox->box, 0) < 0)
+ return -1;
+ }
memcpy(guid, mbox->mbox_hdr.mailbox_guid, MAIL_GUID_128_SIZE);
return 0;
}
diff -r 8f251e0bc02d -r 1afcc09c2c6c src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Mon Feb 15 06:12:59 2010 +0200
+++ b/src/lib-storage/mail-storage.c Mon Feb 15 07:08:40 2010 +0200
@@ -824,7 +824,11 @@
if (mailbox_open(box) < 0)
return -1;
}
- return box->v.get_guid(box, guid);
+ if (box->v.get_guid(box, guid) < 0)
+ return -1;
+
+ i_assert(!mail_guid_128_is_empty(guid));
+ return 0;
}
struct mailbox_sync_context *
More information about the dovecot-cvs
mailing list