maildir-mail.c revision 900bb5e316d030cdebff7ee128ce65881dfb27f7
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen/* Copyright (c) 2003-2012 Dovecot authors, see the included COPYING file */
f0a2d04321ba456e5c5ba821c0d1ed9e8e0e2e08Timo Sirainendo_open(struct maildir_mailbox *mbox, const char *path,
98922c5675bbbfadc84d58768bef867fe82256c2Timo Sirainen mail_storage_set_critical(&mbox->storage->storage, "%s",
98922c5675bbbfadc84d58768bef867fe82256c2Timo Sirainen mail_storage_set_critical(&mbox->storage->storage,
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainendo_stat(struct maildir_mailbox *mbox, const char *path, struct stat *st)
98922c5675bbbfadc84d58768bef867fe82256c2Timo Sirainen mail_storage_set_critical(&mbox->storage->storage, "%s",
98922c5675bbbfadc84d58768bef867fe82256c2Timo Sirainen mail_storage_set_critical(&mbox->storage->storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstatic struct istream *
b6a7e0a7899e7f5d60c23cdaa50e025e4c67d05fTimo Sirainenmaildir_open_mail(struct maildir_mailbox *mbox, struct mail *mail,
f0a2d04321ba456e5c5ba821c0d1ed9e8e0e2e08Timo Sirainen if (maildir_file_do(mbox, mail->uid, do_open, &ctx) < 0)
b6a7e0a7899e7f5d60c23cdaa50e025e4c67d05fTimo Sirainen path = maildir_save_file_get_path(mail->transaction, mail->seq);
f6f021c133f680cf3d559187524fd9abcbaae9b9Timo Sirainen if (maildir_lose_unexpected_dir(&mbox->storage->storage,
35283613d4c04ce18836e9fc431582c87b3710a0Timo Sirainenstatic int maildir_mail_stat(struct mail *mail, struct stat *st)
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
b0a901f1dbe9e05ac1c92a0974af6bce0274f31aTimo Sirainen struct index_mail *imail = (struct index_mail *)mail;
35283613d4c04ce18836e9fc431582c87b3710a0Timo Sirainen if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE)
bc6ef0b01b99c43ee46aa796420516e89a744c30Timo Sirainen /* we're going to open the mail anyway */
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen (void)mail_get_stream(mail, NULL, NULL, &input);
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainen mail->transaction->stats.fstat_lookup_count++;
b0a901f1dbe9e05ac1c92a0974af6bce0274f31aTimo Sirainen stp = i_stream_stat(imail->data.stream, FALSE);
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen ret = maildir_file_do(mbox, mail->uid, do_stat, st);
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen path = maildir_save_file_get_path(mail->transaction, mail->seq);
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainenstatic int maildir_mail_get_received_date(struct mail *_mail, time_t *date_r)
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainen if (index_mail_get_received_date(_mail, date_r) == 0)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstatic int maildir_mail_get_save_date(struct mail *_mail, time_t *date_r)
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
90adcaa0a00eba29b7fbd50ca66be11c8d086d6aTimo Sirainen if (index_mail_get_save_date(_mail, date_r) == 0)
7ede6554e451ec039a67beec7d6ee4aff61d386eTimo Sirainenmaildir_mail_get_fname(struct maildir_mailbox *mbox, struct mail *mail,
3ec2c1f31631bb5ff86f5fc93a563c33e5cae90dTimo Sirainen const char **fname_r)
3ec2c1f31631bb5ff86f5fc93a563c33e5cae90dTimo Sirainen ret = maildir_sync_lookup(mbox, mail->uid, &flags, fname_r);
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen /* file exists in index file, but not in dovecot-uidlist anymore. */
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen /* one reason this could happen is if we delayed opening
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen dovecot-uidlist and we're trying to open a mail that got recently
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen expunged. Let's test this theory first: */
d22301419109ed4a38351715e6760011421dadecTimo Sirainen exists = mail_index_lookup_seq(view, mail->uid, &seq);
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen /* the message still exists in index. this means there's some
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen kind of a desync, which doesn't get fixed if cur/ mtime is
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen the same as in index. fix this by forcing a resync. */
9334fbad0aabb2fed88f40b2205d0d6f80bdffa2Timo Sirainen (void)maildir_storage_sync_force(mbox, mail->uid);
3ec2c1f31631bb5ff86f5fc93a563c33e5cae90dTimo Sirainenstatic int maildir_get_pop3_state(struct index_mail *mail)
d22301419109ed4a38351715e6760011421dadecTimo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* if this mail itself has non-pop3 fields we know we're not
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen allowed_pop3_fields = MAIL_FETCH_FLAGS | MAIL_FETCH_STREAM_HEADER |
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen MAIL_FETCH_STREAM_BODY | MAIL_FETCH_UIDL_FILE_NAME |
ecd69c4e8371853667e01b0c16d436ef7f7393e2Timo Sirainen (mail->data.wanted_fields & ~allowed_pop3_fields) != 0)
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* get vsize decisions */
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen psize_idx = ibox->cache_fields[MAIL_CACHE_PHYSICAL_FULL_SIZE].idx;
d22301419109ed4a38351715e6760011421dadecTimo Sirainen vsize_idx = ibox->cache_fields[MAIL_CACHE_VIRTUAL_FULL_SIZE].idx;
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen vsize_dec = mail_cache_field_get_decision(box->cache,
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* also check if there are any non-[pv]size cached fields */
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen fields = mail_cache_register_get_list(box->cache,
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen for (i = 0; i < count; i++) {
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen dec = fields[i].decision & ~MAIL_CACHE_DECISION_FORCED;
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* either nothing is cached, or only vsize is cached. */
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen } else if (vsize_dec != MAIL_CACHE_DECISION_YES &&
236bedf76e31651ea9fca63fbdc25be673819526Timo Sirainen (box->flags & MAILBOX_FLAG_POP3_SESSION) == 0) {
d22301419109ed4a38351715e6760011421dadecTimo Sirainen /* if virtual size isn't cached permanently,
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen POP3 isn't being used */
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* possibly a mixed pop3/imap */
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainenstatic int maildir_quick_size_lookup(struct index_mail *mail, bool vsize,
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
3eb63515855f386449c22233d1f1baf1ddfe8a2dTimo Sirainen if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
b6a7e0a7899e7f5d60c23cdaa50e025e4c67d05fTimo Sirainen path = maildir_save_file_get_path(_mail->transaction,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* size can be included in filename */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if (vsize || !mbox->storage->set->maildir_broken_filename_sizes) {
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* size can be included in uidlist entry */
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen value = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen if (value != NULL && str_to_uoff(value, size_r) == 0)
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainenmaildir_handle_size_caching(struct index_mail *mail, bool quick_check,
d22301419109ed4a38351715e6760011421dadecTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)box;
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen field = vsize ? MAIL_FETCH_VIRTUAL_SIZE : MAIL_FETCH_PHYSICAL_SIZE;
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen if ((mail->data.dont_cache_fetch_fields & field) != 0)
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen if (quick_check && maildir_quick_size_lookup(mail, vsize, &size) > 0) {
55b6e3105184ad6a2f987346380966f556300055Timo Sirainen /* already in filename / uidlist. don't add it anywhere,
7aeaf23f760d86aad525d831efcac9f860a55a39Timo Sirainen including to the uidlist if it's already in filename.
cf49fc07f541c0f74578ac6c3b334ddade143aa1Timo Sirainen do some extra checks here to catch potential cache bugs. */
cf49fc07f541c0f74578ac6c3b334ddade143aa1Timo Sirainen if (vsize && mail->data.virtual_size != size) {
d22301419109ed4a38351715e6760011421dadecTimo Sirainen "Corrupted virtual size for uid=%u: "
2ff23d6fb7e2ff85aa23b7f4769aeac1d0316a1bTimo Sirainen } else if (!vsize && mail->data.physical_size != size) {
d22301419109ed4a38351715e6760011421dadecTimo Sirainen "Corrupted physical size for uid=%u: "
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen /* 1 = pop3-only, 0 = mixed, -1 = no pop3 */
c36ec256c1bd1abe1c12e792cf64f0b7e3b3135aTimo Sirainen if (pop3_state >= 0 && mail->mail.mail.uid != 0) {
18065635d4e79dd96eb3b3215718abd12f6a6808Timo Sirainen /* if size is wanted permanently, store it to uidlist
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen so that in case cache file gets lost we can get it quickly */
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen maildir_uidlist_set_ext(mbox->uidlist, mail->mail.mail.uid,
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainenstatic int maildir_mail_get_virtual_size(struct mail *_mail, uoff_t *size_r)
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen (_mail->box->flags & MAILBOX_FLAG_POP3_SESSION) != 0) {
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen /* try to get the size from uidlist. this is especially useful
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen with pop3 to avoid unnecessarily opening the cache file. */
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen if (index_mail_get_cached_virtual_size(mail, size_r)) {
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen i_assert(mail->data.virtual_size != (uoff_t)-1);
a0aedab7cd06125e4d73638b1bd0c01c7caa2626Timo Sirainen maildir_handle_size_caching(mail, TRUE, TRUE);
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen data->dont_cache_fetch_fields |= MAIL_FETCH_VIRTUAL_SIZE;
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen /* fallback to reading the file */
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen old_offset = data->stream == NULL ? 0 : data->stream->v_offset;
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen if (mail_get_stream(_mail, &hdr_size, &body_size, &input) < 0)
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen maildir_handle_size_caching(mail, FALSE, TRUE);
d67fde1a8ebc1d85704c5986d8f93aae97eccef3Timo Sirainenstatic int maildir_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
6d50c4d875bb05f9076e9e0ecbacb8beb2e9ae42Timo Sirainen (_mail->box->flags & MAILBOX_FLAG_POP3_SESSION) != 0) {
6d50c4d875bb05f9076e9e0ecbacb8beb2e9ae42Timo Sirainen /* try to get the size from uidlist (see virtual size above) */
6d50c4d875bb05f9076e9e0ecbacb8beb2e9ae42Timo Sirainen if (index_mail_get_physical_size(_mail, size_r) == 0) {
6d50c4d875bb05f9076e9e0ecbacb8beb2e9ae42Timo Sirainen i_assert(mail->data.physical_size != (uoff_t)-1);
6d50c4d875bb05f9076e9e0ecbacb8beb2e9ae42Timo Sirainen maildir_handle_size_caching(mail, TRUE, FALSE);
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen data->dont_cache_fetch_fields |= MAIL_FETCH_PHYSICAL_SIZE;
3eb63515855f386449c22233d1f1baf1ddfe8a2dTimo Sirainen ret = maildir_file_do(mbox, _mail->uid, do_stat, &st);
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen /* saved mail which hasn't been committed yet */
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen path = maildir_save_file_get_path(_mail->transaction,
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen mail_storage_set_critical(_mail->box->storage,
97eb53ade9057e6966dbb77289ad0204c7e1657bTimo Sirainen maildir_handle_size_caching(mail, FALSE, FALSE);
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainenmaildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field,
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen const char **value_r)
366d6311c9d5bac6613e3cd64619eb878adce9ecTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
366d6311c9d5bac6613e3cd64619eb878adce9ecTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
d22301419109ed4a38351715e6760011421dadecTimo Sirainen const char *path, *fname = NULL, *end, *guid, *uidl, *order;
b19a1420da0618a10edf67c2cfd13c8c8633057aTimo Sirainen /* use GUID from uidlist if it exists */
24cd47a2c8f7507e555459b7e841de771ba3c318Timo Sirainen /* first make sure that we have a refreshed uidlist */
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen guid = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
e4e7475f646d66a257d682738fbff1f206ce4924Timo Sirainen mail_storage_set_critical(_mail->box->storage,
ed34a210eff7707787ee154e5581528b8f4b2daaTimo Sirainen "Maildir %s: Corrupted dovecot-uidlist: "
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen "UID %u had empty GUID, clearing it",
ed34a210eff7707787ee154e5581528b8f4b2daaTimo Sirainen maildir_uidlist_set_ext(mbox->uidlist, _mail->uid,
ed34a210eff7707787ee154e5581528b8f4b2daaTimo Sirainen /* default to base filename: */
e4e7475f646d66a257d682738fbff1f206ce4924Timo Sirainen /* we came here from MAIL_FETCH_GUID,
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen avoid a second lookup */
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
e4e7475f646d66a257d682738fbff1f206ce4924Timo Sirainen path = maildir_save_file_get_path(_mail->transaction,
b142deb9a831c89b1bb9129ada655f3e56b9d4ccTimo Sirainen uidl = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
b142deb9a831c89b1bb9129ada655f3e56b9d4ccTimo Sirainen /* use the default */
46c903eac3abcc7d32780da76ee6a79c26d185b6Timo Sirainen /* special optimization case: use the base file name */
89fb98e9eb7e95255a579c8e9d865383c2334a74Timo Sirainen order = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
89fb98e9eb7e95255a579c8e9d865383c2334a74Timo Sirainen return index_mail_get_special(_mail, field, value_r);
e1eeb3be29afde2830c2b7ed594c6f1fef2f69dcTimo Sirainenmaildir_mail_get_stream(struct mail *_mail, bool get_body ATTR_UNUSED,
e1eeb3be29afde2830c2b7ed594c6f1fef2f69dcTimo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
b19a1420da0618a10edf67c2cfd13c8c8633057aTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
6df0ab0c1ab91f06b6418cb30eff44405a1b8f02Timo Sirainen data->stream = maildir_open_mail(mbox, _mail, &deleted);
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainen return index_mail_init_stream(mail, hdr_size, body_size, stream_r);
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainenstatic void maildir_update_pop3_uidl(struct mail *_mail, const char *uidl)
6564208826b0f46a00f010d1b5711d85944c3c88Timo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)_mail->box;
6564208826b0f46a00f010d1b5711d85944c3c88Timo Sirainen if (maildir_mail_get_special(_mail, MAIL_FETCH_UIDL_FILE_NAME,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen /* special case optimization: empty UIDL means the same
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen as base filename */
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen _mail->transaction->nontransactional_changes = TRUE;
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen maildir_uidlist_set_ext(mbox->uidlist, _mail->uid,
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainenstatic void maildir_mail_remove_sizes_from_uidlist(struct mail *mail)
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen if (maildir_uidlist_lookup_ext(mbox->uidlist, mail->uid,
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen maildir_uidlist_set_ext(mbox->uidlist, mail->uid,
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen if (maildir_uidlist_lookup_ext(mbox->uidlist, mail->uid,
225e82df5dd1e765f4e52b80c954558f00e5a7dfTimo Sirainen maildir_uidlist_set_ext(mbox->uidlist, mail->uid,
de4e3a2e1e8f82b2d3226c090b71b518b43bf9cfTimo Sirainendo_fix_size(struct maildir_mailbox *mbox, const char *path,
de4e3a2e1e8f82b2d3226c090b71b518b43bf9cfTimo Sirainen const char *fname, *newpath, *extra, *info, *dir;
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainen mail_storage_set_critical(&mbox->storage->storage,
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainen newpath = t_strdup_printf("%s/%s,S=%"PRIuUOFF_T"%s", dir,
3ec3632e12638396944e854a8f7a2bc6c67b981dTimo Sirainen "Maildir filename has wrong %c value, "
3ec3632e12638396944e854a8f7a2bc6c67b981dTimo Sirainen "renamed the file from %s to %s",
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainen mail_storage_set_critical(&mbox->storage->storage,
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainenmaildir_mail_remove_sizes_from_filename(struct mail *mail,
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainen struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->box;
b12b6da6f084212d42421a28ae329eae79751c42Timo Sirainen if (maildir_sync_lookup(mbox, mail->uid, &flags, &fname) <= 0)
8c9e48cd6de80da0fa32b9c0dee003472c9a7c0dTimo Sirainen maildir_filename_get_size(fname, MAILDIR_EXTRA_VIRTUAL_SIZE,
45799f8340fdcddfb077c1d44ad1d2014d7db31cTimo Sirainen } else if (field == MAIL_FETCH_PHYSICAL_SIZE &&
8c9e48cd6de80da0fa32b9c0dee003472c9a7c0dTimo Sirainen maildir_filename_get_size(fname, MAILDIR_EXTRA_FILE_SIZE,
de4e3a2e1e8f82b2d3226c090b71b518b43bf9cfTimo Sirainen /* the broken size isn't in filename */
45799f8340fdcddfb077c1d44ad1d2014d7db31cTimo Sirainen (void)maildir_file_do(mbox, mail->uid, do_fix_size, &wrong_key);
45799f8340fdcddfb077c1d44ad1d2014d7db31cTimo Sirainenstatic void maildir_mail_set_cache_corrupted(struct mail *_mail,
45799f8340fdcddfb077c1d44ad1d2014d7db31cTimo Sirainen maildir_mail_remove_sizes_from_uidlist(_mail);