~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/doveadm/doveadm-mail-index.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2010-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2010-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "str.h"
5
5
#include "strescape.h"
6
 
#include "network.h"
 
6
#include "net.h"
7
7
#include "write-full.h"
8
8
#include "mail-namespace.h"
9
9
#include "mail-storage.h"
10
10
#include "mail-search-build.h"
 
11
#include "mailbox-list-iter.h"
11
12
#include "doveadm-settings.h"
12
13
#include "doveadm-mail.h"
13
14
 
38
39
        int ret = 0;
39
40
 
40
41
        if (mailbox_get_metadata(box, MAILBOX_METADATA_PRECACHE_FIELDS,
41
 
                                 &metadata) < 0)
 
42
                                 &metadata) < 0 ||
 
43
            mailbox_get_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
 
44
                               &status) < 0)
42
45
                return -1;
43
 
        mailbox_get_open_status(box, STATUS_MESSAGES | STATUS_LAST_CACHED_SEQ,
44
 
                                &status);
45
46
 
46
47
        seq = status.last_cached_seq + 1;
47
48
        if (seq > status.messages) {
87
88
        struct mailbox_status status;
88
89
        int ret = 0;
89
90
 
90
 
        box = mailbox_alloc(info->ns->list, info->name,
 
91
        box = mailbox_alloc(info->ns->list, info->vname,
91
92
                            MAILBOX_FLAG_IGNORE_ACLS);
92
93
        if (ctx->max_recent_msgs != 0) {
93
94
                /* index only if there aren't too many recent messages.
94
95
                   don't bother syncing the mailbox, that alone can take a
95
96
                   while with large maildirs. */
96
97
                if (mailbox_open(box) < 0) {
97
 
                        i_error("Opening mailbox %s failed: %s", info->name,
 
98
                        i_error("Opening mailbox %s failed: %s", info->vname,
98
99
                                mail_storage_get_last_error(mailbox_get_storage(box), NULL));
99
100
                        doveadm_mail_failed_mailbox(&ctx->ctx, box);
100
101
                        mailbox_free(&box);
109
110
        }
110
111
 
111
112
        if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) {
112
 
                i_error("Syncing mailbox %s failed: %s", info->name,
 
113
                i_error("Syncing mailbox %s failed: %s", info->vname,
113
114
                        mail_storage_get_last_error(mailbox_get_storage(box), NULL));
114
115
                doveadm_mail_failed_mailbox(&ctx->ctx, box);
115
116
                ret = -1;
147
148
                string_t *str = t_str_new(256);
148
149
 
149
150
                str_append(str, "APPEND\t0\t");
150
 
                str_tabescape_write(str, user->username);
 
151
                str_append_tabescaped(str, user->username);
151
152
                str_append_c(str, '\t');
152
 
                str_tabescape_write(str, mailbox);
 
153
                str_append_tabescaped(str, mailbox);
153
154
                str_printfa(str, "\t%u\n", ctx->max_recent_msgs);
154
155
                if (write_full(ctx->queue_fd, str_data(str), str_len(str)) < 0)
155
156
                        i_fatal("write(indexer) failed: %m");
161
162
{
162
163
        struct index_cmd_context *ctx = (struct index_cmd_context *)_ctx;
163
164
        const enum mailbox_list_iter_flags iter_flags =
164
 
                MAILBOX_LIST_ITER_RAW_LIST |
165
165
                MAILBOX_LIST_ITER_NO_AUTO_BOXES |
166
166
                MAILBOX_LIST_ITER_RETURN_NO_FLAGS |
167
167
                MAILBOX_LIST_ITER_STAR_WITHIN_NS;
168
 
        const enum namespace_type ns_mask =
169
 
                NAMESPACE_PRIVATE | NAMESPACE_SHARED | NAMESPACE_PUBLIC;
 
168
        const enum mail_namespace_type ns_mask = MAIL_NAMESPACE_TYPE_MASK_ALL;
170
169
        struct mailbox_list_iterate_context *iter;
171
170
        const struct mailbox_info *info;
172
171
        unsigned int i;
185
184
                if ((info->flags & (MAILBOX_NOSELECT |
186
185
                                    MAILBOX_NONEXISTENT)) == 0) T_BEGIN {
187
186
                        if (ctx->queue)
188
 
                                cmd_index_queue(ctx, user, info->name);
 
187
                                cmd_index_queue(ctx, user, info->vname);
189
188
                        else {
190
189
                                if (cmd_index_box(ctx, info) < 0)
191
190
                                        ret = -1;