~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/lib-storage/test-mail.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-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/{control,rules}: enable PIE hardening.
  + 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.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2009-2011 Dovecot authors, see the included COPYING file */
2
 
 
3
 
#include "lib.h"
4
 
#include "array.h"
5
 
#include "mail-storage-private.h"
6
 
#include "test-mail-storage.h"
7
 
 
8
 
extern struct mail_vfuncs test_mail_vfuncs;
9
 
 
10
 
struct mail *
11
 
test_mailbox_mail_alloc(struct mailbox_transaction_context *t,
12
 
                        enum mail_fetch_field wanted_fields ATTR_UNUSED,
13
 
                        struct mailbox_header_lookup_ctx *wanted_headers ATTR_UNUSED)
14
 
{
15
 
        struct mail_private *mail;
16
 
        pool_t pool;
17
 
 
18
 
        pool = pool_alloconly_create("test mail", 1024);
19
 
        mail = p_new(pool, struct mail_private, 1);
20
 
        mail->mail.box = t->box;
21
 
        mail->mail.transaction = t;
22
 
        mail->v = test_mail_vfuncs;
23
 
        mail->pool = pool;
24
 
        p_array_init(&mail->module_contexts, pool, 5);
25
 
        return &mail->mail;
26
 
}
27
 
 
28
 
static void test_mail_free(struct mail *mail)
29
 
{
30
 
        struct mail_private *pmail = (struct mail_private *)mail;
31
 
 
32
 
        pool_unref(&pmail->pool);
33
 
}
34
 
 
35
 
static void test_mail_set_seq(struct mail *mail, uint32_t seq)
36
 
{
37
 
        mail->seq = seq;
38
 
        mail->uid = seq;
39
 
 
40
 
        mail->expunged = TRUE;
41
 
        mail->has_nuls = FALSE;
42
 
        mail->has_no_nuls = FALSE;
43
 
}
44
 
 
45
 
static bool test_mail_set_uid(struct mail *mail, uint32_t uid)
46
 
{
47
 
        test_mail_set_seq(mail, uid);
48
 
        return TRUE;
49
 
}
50
 
 
51
 
static void test_mail_set_uid_cache_updates(struct mail *mail ATTR_UNUSED,
52
 
                                            bool set ATTR_UNUSED)
53
 
{
54
 
}
55
 
 
56
 
static enum mail_flags test_mail_get_flags(struct mail *mail ATTR_UNUSED)
57
 
{
58
 
        return 0;
59
 
}
60
 
 
61
 
static const char *const *
62
 
test_mail_get_keywords(struct mail *mail ATTR_UNUSED)
63
 
{
64
 
        return t_new(const char *, 1);
65
 
}
66
 
 
67
 
static const ARRAY_TYPE(keyword_indexes) *
68
 
test_mail_get_keyword_indexes(struct mail *mail ATTR_UNUSED)
69
 
{
70
 
        ARRAY_TYPE(keyword_indexes) *kw_indexes;
71
 
 
72
 
        kw_indexes = t_new(ARRAY_TYPE(keyword_indexes), 1);
73
 
        t_array_init(kw_indexes, 1);
74
 
        (void)array_append_space(kw_indexes);
75
 
        return kw_indexes;
76
 
}
77
 
 
78
 
static uint64_t test_mail_get_modseq(struct mail *mail ATTR_UNUSED)
79
 
{
80
 
        return 0;
81
 
}
82
 
 
83
 
static int
84
 
test_mail_get_parts(struct mail *mail ATTR_UNUSED,
85
 
                    struct message_part **parts_r ATTR_UNUSED)
86
 
{
87
 
        return -1;
88
 
}
89
 
 
90
 
static int
91
 
test_mail_get_date(struct mail *mail ATTR_UNUSED,
92
 
                   time_t *date_r ATTR_UNUSED, int *timezone_r ATTR_UNUSED)
93
 
{
94
 
        return -1;
95
 
}
96
 
 
97
 
static int
98
 
test_mail_get_received_date(struct mail *mail ATTR_UNUSED,
99
 
                            time_t *date_r ATTR_UNUSED)
100
 
{
101
 
        return -1;
102
 
}
103
 
 
104
 
static int
105
 
test_mail_get_save_date(struct mail *mail ATTR_UNUSED,
106
 
                        time_t *date_r ATTR_UNUSED)
107
 
{
108
 
        return -1;
109
 
}
110
 
 
111
 
static int
112
 
test_mail_get_test_mail_size(struct mail *mail ATTR_UNUSED,
113
 
                             uoff_t *size_r ATTR_UNUSED)
114
 
{
115
 
        return -1;
116
 
}
117
 
 
118
 
static int
119
 
test_mail_get_physical_size(struct mail *mail ATTR_UNUSED,
120
 
                            uoff_t *size_r ATTR_UNUSED)
121
 
{
122
 
        return -1;
123
 
}
124
 
 
125
 
static int
126
 
test_mail_get_first_header(struct mail *mail ATTR_UNUSED,
127
 
                           const char *field ATTR_UNUSED,
128
 
                           bool decode_to_utf8 ATTR_UNUSED,
129
 
                           const char **value_r)
130
 
{
131
 
        *value_r = NULL;
132
 
        return 0;
133
 
}
134
 
 
135
 
static int
136
 
test_mail_get_headers(struct mail *mail ATTR_UNUSED,
137
 
                      const char *field ATTR_UNUSED,
138
 
                      bool decode_to_utf8 ATTR_UNUSED,
139
 
                      const char *const **value_r)
140
 
{
141
 
        *value_r = NULL;
142
 
        return 0;
143
 
}
144
 
 
145
 
static int
146
 
test_mail_get_header_stream(struct mail *mail ATTR_UNUSED,
147
 
                            struct mailbox_header_lookup_ctx *headers ATTR_UNUSED,
148
 
                            struct istream **stream_r ATTR_UNUSED)
149
 
{
150
 
        return -1;
151
 
}
152
 
 
153
 
static int
154
 
test_mail_get_stream(struct mail *mail ATTR_UNUSED,
155
 
                     struct message_size *hdr_size ATTR_UNUSED,
156
 
                     struct message_size *body_size ATTR_UNUSED,
157
 
                     struct istream **stream_r ATTR_UNUSED)
158
 
{
159
 
        return -1;
160
 
}
161
 
 
162
 
static int
163
 
test_mail_get_special(struct mail *mail ATTR_UNUSED,
164
 
                      enum mail_fetch_field field ATTR_UNUSED,
165
 
                      const char **value_r ATTR_UNUSED)
166
 
{
167
 
        return -1;
168
 
}
169
 
 
170
 
static struct mail *test_mail_get_real_mail(struct mail *mail)
171
 
{
172
 
        return mail;
173
 
}
174
 
 
175
 
static void
176
 
test_mail_update_flags(struct mail *mail ATTR_UNUSED,
177
 
                       enum modify_type modify_type ATTR_UNUSED,
178
 
                       enum mail_flags flags ATTR_UNUSED)
179
 
{
180
 
}
181
 
 
182
 
static void
183
 
test_mail_update_keywords(struct mail *mail ATTR_UNUSED,
184
 
                          enum modify_type modify_type ATTR_UNUSED,
185
 
                          struct mail_keywords *keywords ATTR_UNUSED)
186
 
{
187
 
}
188
 
 
189
 
static void test_mail_update_modseq(struct mail *mail ATTR_UNUSED,
190
 
                                    uint64_t min_modseq ATTR_UNUSED)
191
 
{
192
 
}
193
 
 
194
 
static void test_mail_expunge(struct mail *mail ATTR_UNUSED)
195
 
{
196
 
}
197
 
 
198
 
static void test_mail_parse(struct mail *mail ATTR_UNUSED,
199
 
                            bool parse_body ATTR_UNUSED)
200
 
{
201
 
}
202
 
 
203
 
static void
204
 
test_mail_set_cache_corrupted(struct mail *mail ATTR_UNUSED,
205
 
                              enum mail_fetch_field field ATTR_UNUSED)
206
 
{
207
 
}
208
 
 
209
 
struct mail_vfuncs test_mail_vfuncs = {
210
 
        NULL,
211
 
        test_mail_free,
212
 
        test_mail_set_seq,
213
 
        test_mail_set_uid,
214
 
        test_mail_set_uid_cache_updates,
215
 
 
216
 
        test_mail_get_flags,
217
 
        test_mail_get_keywords,
218
 
        test_mail_get_keyword_indexes,
219
 
        test_mail_get_modseq,
220
 
        test_mail_get_parts,
221
 
        test_mail_get_date,
222
 
        test_mail_get_received_date,
223
 
        test_mail_get_save_date,
224
 
        test_mail_get_test_mail_size,
225
 
        test_mail_get_physical_size,
226
 
        test_mail_get_first_header,
227
 
        test_mail_get_headers,
228
 
        test_mail_get_header_stream,
229
 
        test_mail_get_stream,
230
 
        test_mail_get_special,
231
 
        test_mail_get_real_mail,
232
 
        test_mail_update_flags,
233
 
        test_mail_update_keywords,
234
 
        test_mail_update_modseq,
235
 
        NULL,
236
 
        test_mail_expunge,
237
 
        test_mail_parse,
238
 
        test_mail_set_cache_corrupted,
239
 
        NULL
240
 
};