]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Merged changes from v2.0.15.
authorTimo Sirainen <tss@iki.fi>
Fri, 16 Sep 2011 13:59:10 +0000 (16:59 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 16 Sep 2011 13:59:10 +0000 (16:59 +0300)
18 files changed:
1  2 
.hgsigs
.hgtags
NEWS
src/doveadm/doveadm-mail-altmove.c
src/doveadm/doveadm-mail-iter.c
src/dsync/dsync.c
src/lib-index/mail-cache.h
src/lib-index/mail-index-transaction-update.c
src/lib-index/mail-index-view.c
src/lib-index/mail-index.h
src/lib-storage/index/index-transaction.c
src/lib-storage/index/mbox/mbox-storage.c
src/lib-storage/index/shared/shared-storage.c
src/lib-storage/mail-storage-service.c
src/lib-storage/mail-storage.c
src/lib-storage/mailbox-list.c
src/lib/ioloop.c
src/lib/ioloop.h

diff --cc .hgsigs
index bb947614576db4a17bc78cf5e7e496dcf105aff5,3c4d64f74af7c776a5072fffc0a02ad026af9de8..07b1e0148629353f2aadc38e9ac85eb75c5f077d
+++ b/.hgsigs
@@@ -28,4 -28,4 +28,5 @@@ d0d3aca1c9587887a32a890548ec7db76c3bbbe
  606faab2b896295b7dae7941b47e9374dbf90a66 0 iEYEABECAAYFAk2kh3YACgkQyUhSUUBViskrNgCfdmuKZ1/9HDFOvBuBnTCw6lUuiaEAn207VAo55MOIb1RwAQgaP8wNC7YS
  aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 0 iEYEABECAAYFAk3KpGwACgkQyUhSUUBVismbmQCfTKfNrQnIy2cIQCYUE7zFrRl6nvgAnAu5W0iAfzKwFEAGtnGj1h+D+tY0
  aa68f38c04f080fe4d3142fb3f73425b78ef98bd 0 iEYEABECAAYFAk5bEKIACgkQyUhSUUBVislRhwCePWvqh3c+EitvNe1XlMqxpwWvDDgAoJKjDnmLwk0U62IhIQ+x90DEIgl6
 +8ae243558677b23f2077c3fe9683cc7890f5eb5d 0 iEYEABECAAYFAk5fSWYACgkQyUhSUUBVism47wCeJe0dWWZZLLXgn3r5oBg+jy9UtN0An3qCOCwxFxql7Ik42c/6kUKiCd1V
+ 11ef524500964054ae8e4e6150f890b1864139eb 0 iEYEABECAAYFAk5zUvIACgkQyUhSUUBVisnDTgCdHVHSwKeZjHV4KrlTmqipFoO26mkAoIMqPTna3Y1ETIGnPq6XRCB90C8p
diff --cc .hgtags
index 4794d6c34427ead8608db302708519ba63e1ad81,895fe5eb41cfca0a616ba95d80a2bc3267ea9ad6..e619d568d640071a116a14aa5f24762c1a103dbc
+++ b/.hgtags
@@@ -65,4 -65,4 +65,5 @@@ d0d3aca1c9587887a32a890548ec7db76c3bbbe
  606faab2b896295b7dae7941b47e9374dbf90a66 2.0.12
  aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 2.0.13
  aa68f38c04f080fe4d3142fb3f73425b78ef98bd 2.0.14
 +8ae243558677b23f2077c3fe9683cc7890f5eb5d 2.1.alpha1
+ 11ef524500964054ae8e4e6150f890b1864139eb 2.0.15
diff --cc NEWS
index 6ab8e662d240c8844375f33005e87220c4e4f303,5e83e001878933bfc020c3c5c166a72e88b335fa..27ee0f41c06d04ea96ae8bc8d3e0ae76dfc58ea9
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,32 -1,16 +1,45 @@@
 +v2.1.UNSTABLE 2011-xx-xx  Timo Sirainen <tss@iki.fi>
 +
 +      * Plugins now use UTF-8 mailbox names rather than mUTF-7:
 +        acl, autocreate, expire, trash, virtual
 +      * auth_username_format default changed to %Lu. If you really want
 +        case sensitive usernames, set it back to empty.
 +      * Solr full text search backend changed to use mailbox GUIDs instead of
 +        mailbox names, requiring reindexing everything. solr_old backend can
 +        be used with old indexes to avoid reindexing, but it doesn't support
 +        some newer features.
 +
 +      + imapc (= IMAP client) storage allows using a remote IMAP server to
 +        be used as storage. This allows using Dovecot as a smart (caching)
 +        proxy or using dsync to do migration from remote IMAP server.
 +      + Mailbox indexing via queuing indexer service (required for Lucene)
 +      + Lucene full text search (FTS) backend rewritten with support for
 +        different languages
 +      + FTS finally supports "OR" search operation
 +      + FTS supports indexing attachments via external programs
 +      + IMAP FUZZY extension, supported by Lucene and Solr FTS backends
 +      + Mailbox list indexes
 +      + Statistics tracking via stats service. Exported via doveadm stats.
 +      + Autocreate plugin creates/subscribes mailboxes physically only when
 +        the mailbox is opened for the first time. Mailbox listing shows the
 +        autocreated mailboxes even if they don't physically exist.
 +      + Password and user databases now support default_fields and
 +        override_fields settings to specify template defaults/overrides.
 +      - listescape plugin works perfectly now
 +
+ v2.0.15 2011-09-16  Timo Sirainen <tss@iki.fi>
+       + doveadm altmove: Added -r parameter to move mails back to primary
+         storage.
+       - v2.0.14: Index reading could have eaten a lot of memory in some
+         situations
+       - doveadm index no longer affects future caching decisions
+       - mbox: Fixed crash during mail delivery when mailbox didn't yet have
+         GUID assigned to it.
+       - zlib+mbox: Fetching last message from compressed mailboxes crashed.
+       - lib-sql: Fixed load balancing and error handling when multiple hosts
+         are used.
  v2.0.14 2011-08-29  Timo Sirainen <tss@iki.fi>
  
        + doveadm: Added support for running mail commands by proxying to
index 97314c027df4929f53c00a3ad431eda861e6329c,72e7a7412c939c4eaeb00a3178ea04f71b3e3847..06bc48c1488b534848c0977b45afff87e2cd3f86
@@@ -16,19 -21,22 +21,21 @@@ cmd_altmove_box(const struct mailbox_in
        struct doveadm_mail_iter *iter;
        struct mailbox_transaction_context *trans;
        struct mail *mail;
+       enum modify_type modify_type =
+               !reverse ? MODIFY_ADD : MODIFY_REMOVE;
  
 -      if (doveadm_mail_iter_init(info, search_args, &trans, &iter) < 0)
 +      if (doveadm_mail_iter_init(info, search_args, 0, NULL,
 +                                 &trans, &iter) < 0)
                return -1;
  
 -      mail = mail_alloc(trans, 0, NULL);
 -      while (doveadm_mail_iter_next(iter, mail)) {
 +      while (doveadm_mail_iter_next(iter, &mail)) {
                if (doveadm_debug) {
                        i_debug("altmove: box=%s uid=%u",
                                info->name, mail->uid);
                }
-               mail_update_flags(mail, MODIFY_ADD,
+               mail_update_flags(mail, modify_type,
                        (enum mail_flags)MAIL_INDEX_MAIL_FLAG_BACKEND);
        }
 -      mail_free(&mail);
        return doveadm_mail_iter_deinit_sync(&iter);
  }
  
@@@ -41,11 -49,12 +48,12 @@@ static void ns_purge(struct mail_namesp
  }
  
  static void
- cmd_altmove_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user)
+ cmd_altmove_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
  {
+       struct altmove_cmd_context *ctx = (struct altmove_cmd_context *)_ctx;
        const enum mailbox_list_iter_flags iter_flags =
                MAILBOX_LIST_ITER_RAW_LIST |
 -              MAILBOX_LIST_ITER_NO_AUTO_INBOX |
 +              MAILBOX_LIST_ITER_NO_AUTO_BOXES |
                MAILBOX_LIST_ITER_RETURN_NO_FLAGS;
        struct doveadm_mail_list_iter *iter;
        const struct mailbox_info *info;
index d50872741c8cd9a8acad4904bf0f5771e3108975,cf25cce8ed5040c0c42099c3119237b613143284..22d8f8e0c29d944db48668efe340b7a25e3faf4c
@@@ -64,9 -63,9 +64,9 @@@ doveadm_mail_iter_deinit_transaction(st
        }
        if (commit) {
                if (mailbox_transaction_commit(&iter->t) < 0) {
-                       i_error("Commiting mailbox %s failed: %s",
+                       i_error("Committing mailbox %s failed: %s",
                                mailbox_get_vname(iter->box),
 -                              mail_storage_get_last_error(iter->storage, NULL));
 +                      mailbox_get_last_error(iter->box, NULL));
                        ret = -1;
                }
        } else {
Simple merge
index 846e526e3d1a21584c8cc543161fda494ba20a4b,e9c3f7d9e0a68441c1554ba4959088286355c1c2..6c6549f3f22ceb5fc3da2558947d543e0dfa3c98
@@@ -71,8 -69,8 +71,13 @@@ bool mail_cache_exists(struct mail_cach
  
  struct mail_cache_view *
  mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview);
 -void mail_cache_view_close(struct mail_cache_view *view);
 +void mail_cache_view_close(struct mail_cache_view **view);
 +
++/* Normally cache decisions are updated on lookup/add. Use this function to
++   enable/disable this (useful for precaching data). */
++void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
++                                          bool update);
  /* Normally cache decisions are updated on lookup/add. Use this function to
     enable/disable this (useful for precaching data). */
  void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
Simple merge
index eea1b3e7b7a0cb3d73aa4139c939c4efa18ed007,0983c970c1fb425f5bfccd847a3e9ecf9e15e980..8ed6fba4ff99ef24a1c9e06b7d65bc557a75b55f
@@@ -144,8 -143,7 +144,8 @@@ enum mail_index_sync_flags 
        MAIL_INDEX_SYNC_FLAG_REQUIRE_CHANGES    = 0x08,
        /* Create the transaction with FSYNC flag */
        MAIL_INDEX_SYNC_FLAG_FSYNC              = 0x10,
 -      /* If we see "delete index" request transaction, finish it */
 +      /* If we see "delete index" request transaction, finish it.
-          This flag also allows commiting more changes to a deleted index. */
++         This flag also allows committing more changes to a deleted index. */
        MAIL_INDEX_SYNC_FLAG_DELETING_INDEX     = 0x20
  };
  
index b92a82b2782edb498a21266c865d028e5fd551c2,2a1b0bb3d4cb945b0cbc66856fe6d303002e253f..c24a9805250963fdb389be3217c3ac2884bd7944
@@@ -82,9 -85,12 +82,12 @@@ void index_transaction_init(struct mail
        array_create(&t->module_contexts, default_pool,
                     sizeof(void *), 5);
  
 -      it->cache_view = mail_cache_view_open(box->cache, t->view);
 -      it->cache_trans = mail_cache_get_transaction(it->cache_view, t->itrans);
 +      t->cache_view = mail_cache_view_open(box->cache, t->view);
 +      t->cache_trans = mail_cache_get_transaction(t->cache_view, t->itrans);
  
 -      t->cache_view = it->cache_view;
 -      t->cache_trans = it->cache_trans;
++      if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0)
++              mail_cache_view_update_cache_decisions(t->cache_view, FALSE);
        if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0)
                mail_cache_view_update_cache_decisions(t->cache_view, FALSE);
  
index 54f533cc4b492dcc8b3c6e4d88ad2dbd062d6d0f,54a7f3fc533c6faeca27dc98b497756d24e43b19..727ffffa88d37b3156426a58330684db7b4a8a5b
@@@ -595,19 -583,22 +595,29 @@@ mbox_mailbox_get_guid(struct mbox_mailb
                        "Mailbox GUIDs are not permanent without index files");
                return -1;
        }
 -      if (mail_guid_128_is_empty(mbox->mbox_hdr.mailbox_guid)) {
 +      if (!guid_128_is_empty(mbox->mbox_hdr.mailbox_guid)) {
 +              /* we have the GUID */
 +      } else if (mbox_file_open(mbox) < 0)
 +              return -1;
 +      else if (mbox->backend_readonly) {
 +              mail_storage_set_error(mbox->box.storage, MAIL_ERROR_PERM,
 +                      "Can't set mailbox GUID to a read-only mailbox");
 +              return -1;
 +      } else {
-               if (mbox_sync_get_guid(mbox) < 0)
-                       return -1;
+               /* create another mailbox and sync  */
+               struct mailbox *box2;
+               struct mbox_mailbox *mbox2;
+               int ret;
+               i_assert(mbox->mbox_lock_type == F_UNLCK);
 -              box2 = mailbox_alloc(box->list, box->name,
 -                                   MAILBOX_FLAG_KEEP_RECENT);
++              box2 = mailbox_alloc(mbox->box.list, mbox->box.name, 0);
+               ret = mailbox_sync(box2, 0);
+               mbox2 = (struct mbox_mailbox *)box2;
 -              memcpy(guid, mbox2->mbox_hdr.mailbox_guid, MAIL_GUID_128_SIZE);
++              memcpy(guid_r, mbox2->mbox_hdr.mailbox_guid, GUID_128_SIZE);
+               mailbox_free(&box2);
+               return ret;
        }
 -      memcpy(guid, mbox->mbox_hdr.mailbox_guid, MAIL_GUID_128_SIZE);
 +      memcpy(guid_r, mbox->mbox_hdr.mailbox_guid, GUID_128_SIZE);
        return 0;
  }
  
index 07f7ada828740750548d0ec23250601c639bae07,b9e048659e33a8adbb9f1eb59fc10f3de4bdc39f..a59fa461ec83d1bffd1409906c58988a468ac00c
@@@ -79,6 -79,12 +79,12 @@@ shared_storage_create(struct mail_stora
                *error_r = "Shared namespace prefix doesn't contain %u or %n";
                return -1;
        }
 -      if (p[-1] != ns->sep &&
++      if (p[-1] != mail_namespace_get_sep(ns) &&
+           (ns->flags & (NAMESPACE_FLAG_LIST_PREFIX |
+                         NAMESPACE_FLAG_LIST_CHILDREN)) != 0) {
+               *error_r = "Shared namespace prefix doesn't end with hierarchy separator";
+               return -1;
+       }
  
        /* truncate prefix after the above checks are done, so they can log
           the full prefix in error conditions */
index f4456557686a53ab44903143b82e28f1c43e1c25,b86f5bae20afabe25433a873ecfcbaafa1f5ba28..13d6c9dd1593d7a4d67dfa547b549c6308ba048c
@@@ -897,8 -869,6 +896,7 @@@ int mail_storage_service_lookup(struct 
        }
  
        user = p_new(user_pool, struct mail_storage_service_user, 1);
-       memset(user_r, 0, sizeof(user_r));
 +      user->service_ctx = ctx;
        user->pool = user_pool;
        user->input = *input;
        user->input.userdb_fields = NULL;
Simple merge
index bcf1daad891ce0be49d4bfbc16c7f1a02506e00c,02bae1df600ad1764afc30764c0a63777f5b1688..0a88f8dd8390128b9f03594f3c272a0d1011fc2e
@@@ -634,32 -434,22 +634,33 @@@ void mailbox_list_get_permissions(struc
                        mailbox_list_set_critical(list, "stat(%s) failed: %m",
                                                  path);
                } else if (list->mail_set->mail_debug) {
-                       i_debug("Namespace %s: Permission lookup failed from %s",
-                              list->ns->prefix, path);
+                       i_debug("Namespace %s: %s doesn't exist yet, "
+                               "using default permissions",
+                               list->ns->prefix, path);
                }
                if (name != NULL) {
 -                      /* return defaults */
 -                      mailbox_list_get_permissions_full(list, NULL,
 -                                                        file_mode_r,
 -                                                        dir_mode_r, gid_r,
 -                                                        gid_origin_r);
 +                      /* return parent mailbox */
 +                      p = strrchr(name, mailbox_list_get_hierarchy_sep(list));
 +                      if (p == NULL) {
 +                              /* return root defaults */
 +                              parent_name = NULL;
 +                      } else {
 +                              parent_name = t_strdup_until(name, p);
 +                      }
 +                      mailbox_list_get_permissions(list, parent_name,
 +                                                   permissions_r);
                        return;
                }
 +              /* assume current defaults for mailboxes that don't exist or
 +                 can't be looked up for some other reason */
 +              permissions_r->file_uid = geteuid();
 +              permissions_r->file_gid = getegid();
        } else {
 -              *file_mode_r = (st.st_mode & 0666) | 0600;
 -              *dir_mode_r = (st.st_mode & 0777) | 0700;
 -              *gid_origin_r = path;
 +              permissions_r->file_uid = st.st_uid;
 +              permissions_r->file_gid = st.st_gid;
 +              permissions_r->file_create_mode = (st.st_mode & 0666) | 0600;
 +              permissions_r->dir_create_mode = (st.st_mode & 0777) | 0700;
 +              permissions_r->file_create_gid_origin = path;
  
                if (!S_ISDIR(st.st_mode)) {
                        /* we're getting permissions from a file.
Simple merge
Simple merge