~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
#include "lib.h"
4
4
#include "ioloop.h"
 
5
#include "hostpid.h"
5
6
#include "mail-storage-private.h"
6
7
 
 
8
#include <time.h>
 
9
 
7
10
struct mail *mail_alloc(struct mailbox_transaction_context *t,
8
11
                        enum mail_fetch_field wanted_fields,
9
12
                        struct mailbox_header_lookup_ctx *wanted_headers)
40
43
        return p->v.get_flags(mail);
41
44
}
42
45
 
 
46
uint64_t mail_get_modseq(struct mail *mail)
 
47
{
 
48
        struct mail_private *p = (struct mail_private *)mail;
 
49
 
 
50
        return p->v.get_modseq(mail);
 
51
}
 
52
 
43
53
const char *const *mail_get_keywords(struct mail *mail)
44
54
{
45
55
        struct mail_private *p = (struct mail_private *)mail;
141
151
        return p->v.get_header_stream(mail, headers, stream_r);
142
152
}
143
153
 
 
154
int mail_set_aborted(struct mail *mail)
 
155
{
 
156
        mail_storage_set_error(mail->box->storage, MAIL_ERROR_NOTPOSSIBLE,
 
157
                               "Mail field not cached");
 
158
        return -1;
 
159
}
 
160
 
144
161
int mail_get_stream(struct mail *mail, struct message_size *hdr_size,
145
162
                    struct message_size *body_size, struct istream **stream_r)
146
163
{
147
164
        struct mail_private *p = (struct mail_private *)mail;
148
165
 
 
166
        if (mail->lookup_abort != MAIL_LOOKUP_ABORT_NEVER)
 
167
                return mail_set_aborted(mail);
149
168
        return p->v.get_stream(mail, hdr_size, body_size, stream_r);
150
169
}
151
170
 
173
192
        p->v.update_keywords(mail, modify_type, keywords);
174
193
}
175
194
 
 
195
void mail_update_pop3_uidl(struct mail *mail, const char *uidl)
 
196
{
 
197
        struct mail_private *p = (struct mail_private *)mail;
 
198
 
 
199
        if (p->v.update_pop3_uidl != NULL)
 
200
                p->v.update_pop3_uidl(mail, uidl);
 
201
}
 
202
 
176
203
void mail_expunge(struct mail *mail)
177
204
{
178
205
        struct mail_private *p = (struct mail_private *)mail;
193
220
 
194
221
        p->v.set_cache_corrupted(mail, field);
195
222
}
 
223
 
 
224
const char *mail_generate_guid_string(void)
 
225
{
 
226
        static struct timespec ts = { 0, 0 };
 
227
        static unsigned int pid = 0;
 
228
 
 
229
        /* we'll use the current time in nanoseconds as the initial 64bit
 
230
           counter. */
 
231
        if (ts.tv_sec == 0) {
 
232
                if (clock_gettime(CLOCK_REALTIME, &ts) < 0)
 
233
                        i_fatal("clock_gettime() failed: %m");
 
234
                pid = getpid();
 
235
        } else if ((uint32_t)ts.tv_nsec < (uint32_t)-1) {
 
236
                ts.tv_nsec++;
 
237
        } else {
 
238
                ts.tv_sec++;
 
239
                ts.tv_nsec = 0;
 
240
        }
 
241
        return t_strdup_printf("%04x%04lx%04x%s",
 
242
                               (unsigned int)ts.tv_nsec,
 
243
                               (unsigned long)ts.tv_sec,
 
244
                               pid, my_hostname);
 
245
}