~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002110912

« back to all changes in this revision

Viewing changes to src/plugins/quota/quota-plugin.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:
11
11
/* defined by imap, pop3, lda */
12
12
extern void (*hook_mail_storage_created)(struct mail_storage *storage);
13
13
 
 
14
void (*quota_next_hook_mail_user_created)(struct mail_user *user);
14
15
void (*quota_next_hook_mail_storage_created)(struct mail_storage *storage);
15
16
void (*quota_next_hook_mailbox_list_created)(struct mailbox_list *list);
 
17
void (*quota_next_hook_mail_namespaces_created)(struct mail_namespace *namespaces);
16
18
 
17
19
const char *quota_plugin_version = PACKAGE_VERSION;
18
 
struct quota *quota_set;
 
20
struct quota_settings *quota_set;
19
21
 
20
22
static void quota_root_add_rules(const char *root_name, 
21
 
                                 struct quota_root *root)
 
23
                                 struct quota_root_settings *root_set)
22
24
{
23
25
        const char *rule_name, *rule, *error;
24
26
        unsigned int i;
30
32
                if (rule == NULL)
31
33
                        break;
32
34
 
33
 
                if (quota_root_add_rule(root, rule, &error) < 0) {
 
35
                if (quota_root_add_rule(root_set, rule, &error) < 0) {
34
36
                        i_fatal("Quota root %s: Invalid rule %s: %s",
35
37
                                root_name, rule, error);
36
38
                }
39
41
}
40
42
 
41
43
static void quota_root_add_warning_rules(const char *root_name,
42
 
                                         struct quota_root *root)
 
44
                                         struct quota_root_settings *root_set)
43
45
{
44
46
        const char *rule_name, *rule, *error;
45
47
        unsigned int i;
51
53
                if (rule == NULL)
52
54
                        break;
53
55
 
54
 
                if (quota_root_add_warning_rule(root, rule, &error) < 0) {
 
56
                if (quota_root_add_warning_rule(root_set, rule, &error) < 0) {
55
57
                        i_fatal("Quota root %s: Invalid warning rule: %s",
56
58
                                root_name, rule);
57
59
                }
61
63
 
62
64
void quota_plugin_init(void)
63
65
{
64
 
        struct quota_root *root;
 
66
        struct quota_root_settings *root_set;
65
67
        unsigned int i;
66
68
        const char *env;
67
69
 
72
74
                return;
73
75
        }
74
76
 
75
 
        quota_set = quota_init();
 
77
        quota_set = quota_settings_init();
76
78
 
77
 
        root = quota_root_init(quota_set, env);
78
 
        if (root == NULL)
 
79
        root_set = quota_root_settings_init(quota_set, env);
 
80
        if (root_set == NULL)
79
81
                i_fatal("Couldn't create quota root: %s", env);
80
 
        quota_root_add_rules("QUOTA", root);
81
 
        quota_root_add_warning_rules("QUOTA", root);
 
82
        quota_root_add_rules("QUOTA", root_set);
 
83
        quota_root_add_warning_rules("QUOTA", root_set);
82
84
 
83
85
        for (i = 2;; i++) {
84
86
                const char *root_name;
89
91
                if (env == NULL)
90
92
                        break;
91
93
 
92
 
                root = quota_root_init(quota_set, env);
93
 
                if (root == NULL)
 
94
                root_set = quota_root_settings_init(quota_set, env);
 
95
                if (root_set == NULL)
94
96
                        i_fatal("Couldn't create quota root: %s", env);
95
 
                quota_root_add_rules(root_name, root);
96
 
                quota_root_add_warning_rules(root_name, root);
 
97
                quota_root_add_rules(root_name, root_set);
 
98
                quota_root_add_warning_rules(root_name, root_set);
97
99
        }
98
100
 
 
101
        quota_next_hook_mail_user_created = hook_mail_user_created;
 
102
        hook_mail_user_created = quota_mail_user_created;
 
103
 
99
104
        quota_next_hook_mail_storage_created = hook_mail_storage_created;
100
105
        hook_mail_storage_created = quota_mail_storage_created;
101
106
 
102
107
        quota_next_hook_mailbox_list_created = hook_mailbox_list_created;
103
108
        hook_mailbox_list_created = quota_mailbox_list_created;
 
109
 
 
110
        quota_next_hook_mail_namespaces_created = hook_mail_namespaces_created;
 
111
        hook_mail_namespaces_created = quota_mail_namespaces_created;
104
112
}
105
113
 
106
114
void quota_plugin_deinit(void)
107
115
{
108
116
        if (quota_set != NULL) {
 
117
                hook_mail_user_created = quota_next_hook_mail_user_created;
109
118
                hook_mail_storage_created =
110
119
                        quota_next_hook_mail_storage_created;
111
120
                hook_mailbox_list_created =
112
121
                        quota_next_hook_mailbox_list_created;
113
 
                quota_deinit(&quota_set);
 
122
                hook_mail_namespaces_created =
 
123
                        quota_next_hook_mail_namespaces_created;
 
124
                quota_settings_deinit(&quota_set);
114
125
        }
115
126
}