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

« back to all changes in this revision

Viewing changes to debian/patches/dovecot-managesieve.dpatch

  • 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:
1
1
#! /bin/sh -e
2
 
## DP: Adds support for MANAGESIEVE
 
2
## DP: Adds support for ManageSieve
3
3
## DP: Author: Stephan Bosch <stephan@rename-it.nl>
4
 
## DP: Version: 0.10.5
5
 
# ManageSieve patch v0.10.5 for dovecot-1.1.11
 
4
## DP: Version: 0.11.9
 
5
 
6
6
# Copyright (c) 2006-2009 by Stephan Bosch <stephan@rename-it.nl>
7
 
# This patch is licenced under LGPLv2.1 (see COPYING.LGPL in the dovecot sources)
 
7
# This patch is licenced under LGPLv2.1
8
8
 
9
 
# Patch obtained from http://hg.rename-it.nl/dovecot-1.1-managesieve-patch/raw-file/f8e808e5a6f0/managesieve.patch
 
9
# Patch obtained from http://www.rename-it.nl/dovecot/1.2/dovecot-1.2.4-managesieve-0.11.9.diff.gz
10
10
 
11
11
. $(dirname $0)/DPATCH
12
12
 
13
13
exit 0
14
 
 
15
 
diff -r 8cacf7ad431d README.managesieve
16
 
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
17
 
+++ b/README.managesieve        Thu Feb 05 09:50:24 2009 +0100
18
 
@@ -0,0 +1,29 @@
19
 
+
20
 
+MANAGESIEVE service support patch for Dovecot 1.1
21
 
+
22
 
+NOTICE: As per dovecot-1.1, this patch only contains the changes to the 
23
 
+Dovecot tree that are necessary to use the now external 
24
 
+dovecot-1.1-managesieve package. So, applying this patch is no longer 
25
 
+the only thing you need to do to give Dovecot managesieve support. 
26
 
+Eventually the need for this patch will disappear completely. 
27
 
+
28
 
+Compile
29
 
+-------
30
 
+
31
 
+You can just use the usual build process
32
 
+(http://wiki.dovecot.org/CompilingSource):
33
 
+
34
 
+./configure
35
 
+make
36
 
+sudo make install 
37
 
+
38
 
+Don't forget to execute ./autogen.sh if you downloaded dovecot from the
39
 
+Mercurial repository.
40
 
+
41
 
+Installation and Configuration
42
 
+------------------------------
43
 
+
44
 
+Read the README of the dovecot-managesieve package for the next steps. 
45
 
+Note that this patch adds configuration examples to the dovecot-example.conf 
46
 
+configuration file example.
47
 
+
48
 
diff -r 8cacf7ad431d dovecot-example.conf
49
 
--- a/dovecot-example.conf      Tue Feb 03 18:44:27 2009 -0500
50
 
+++ b/dovecot-example.conf      Thu Feb 05 09:50:24 2009 +0100
51
 
@@ -18,7 +18,7 @@
 
14
@DPATCH@
 
15
Binary files dovecot-1.2.4.orig/dovecot-1.2.4-managesieve-0.11.9.diff.gz and dovecot-1.2.4/dovecot-1.2.4-managesieve-0.11.9.diff.gz differ
 
16
diff -urN dovecot-1.2.4.orig/dovecot-example.conf dovecot-1.2.4/dovecot-example.conf
 
17
--- dovecot-1.2.4.orig/dovecot-example.conf     2009-08-08 01:46:04.000000000 +0200
 
18
+++ dovecot-1.2.4/dovecot-example.conf  2009-08-29 17:20:49.000000000 +0200
 
19
@@ -19,7 +19,7 @@
52
20
 # Base directory where to store runtime data.
53
21
 #base_dir = /var/run/dovecot/
54
22
 
57
25
 # If you only want to use dovecot-auth, you can set this to "none".
58
26
 #protocols = imap imaps
59
27
 
60
 
@@ -27,8 +27,8 @@
 
28
@@ -28,8 +28,8 @@
61
29
 # interfaces. Use "*, [::]" for listening both IPv4 and IPv6.
62
30
 #
63
31
 # If you want to specify ports for each service, you will need to configure
68
36
 #   protocol imap {
69
37
 #     listen = *:10143
70
38
 #     ssl_listen = *:10943
71
 
@@ -36,6 +36,10 @@
72
 
 #   }
73
 
 #   protocol pop3 {
 
39
@@ -39,6 +39,10 @@
74
40
 #     listen = *:10100
 
41
 #     ..
 
42
 #   }
 
43
+#   protocol managesieve {
 
44
+#     listen = *:12000
75
45
+#     ..
76
46
+#   }
77
 
+#   protocol managesieve {
78
 
+#     listen = *:12000
79
 
 #     ..
80
 
 #   }
81
47
 #listen = *
82
 
@@ -650,6 +654,48 @@
 
48
 
 
49
 # Disable LOGIN command and all other plaintext authentications unless
 
50
@@ -692,6 +696,42 @@
83
51
 }
84
52
 
85
53
 ##
86
 
+## MANAGESIEVE specific settings
 
54
+## ManageSieve specific settings
87
55
+##
88
56
+
89
57
+protocol managesieve {
90
58
+  # Login executable location.
91
59
+  #login_executable = /usr/libexec/dovecot/managesieve-login
92
60
+
93
 
+  # MANAGESIEVE executable location. See IMAP's mail_executable above for 
 
61
+  # ManageSieve executable location. See IMAP's mail_executable above for 
94
62
+  # examples how this could be changed.
95
63
+  #mail_executable = /usr/libexec/dovecot/managesieve
96
64
+
97
 
+  # Maximum MANAGESIEVE command line length in bytes. This setting is 
 
65
+  # Maximum ManageSieve command line length in bytes. This setting is 
98
66
+  # directly borrowed from IMAP. But, since long command lines are very
99
 
+  # unlikely with MANAGESIEVE, changing this will not be very useful.  
 
67
+  # unlikely with ManageSieve, changing this will not be very useful.  
100
68
+  #managesieve_max_line_length = 65536
101
69
+
102
 
+  # Specifies the location of the symlink pointing to the active script in
103
 
+  # the sieve storage directory. This must match the SIEVE setting used by
104
 
+  # deliver (refer to http://wiki.dovecot.org/LDA/Sieve#location for more
105
 
+  # info). Variable substitution with % is recognized.
106
 
+  sieve=~/.dovecot.sieve
107
 
+
108
 
+  # This specifies the path to the directory where the uploaded scripts must
109
 
+  # be stored. In terms of '%' variable substitution it is identical to
110
 
+  # dovecot's mail_location setting used by the mail protocol daemons.
111
 
+  sieve_storage=~/sieve
 
70
+  # ManageSieve logout format string:
 
71
+  #  %i - total number of bytes read from client
 
72
+  #  %o - total number of bytes sent to client
 
73
+  #managesieve_logout_format = bytes=%i/%o
112
74
+
113
75
+  # If, for some inobvious reason, the sieve_storage remains unset, the 
114
 
+  # managesieve daemon uses the specification of the mail_location to find out 
 
76
+  # ManageSieve daemon uses the specification of the mail_location to find out 
115
77
+  # where to store the sieve files (see explaination in README.managesieve). 
116
78
+  # The example below, when uncommented, overrides any global mail_location 
117
79
+  # specification and stores all the scripts in '~/mail/sieve' if sieve_storage 
118
80
+  # is unset. However, you should always use the sieve_storage setting.
119
81
+  # mail_location = mbox:~/mail
120
82
+
121
 
+  # To fool managesieve clients that are focused on timesieved you can
 
83
+  # To fool ManageSieve clients that are focused on timesieved you can
122
84
+  # specify the IMPLEMENTATION capability that the dovecot reports to clients 
123
 
+  # (default: dovecot).
 
85
+  # (default: "dovecot").
124
86
+  #managesieve_implementation_string = Cyrus timsieved v2.2.13
125
87
+}
126
88
+
128
90
 ## LDA specific settings
129
91
 ##
130
92
 
131
 
diff -r 8cacf7ad431d src/master/child-process.c
132
 
--- a/src/master/child-process.c        Tue Feb 03 18:44:27 2009 -0500
133
 
+++ b/src/master/child-process.c        Thu Feb 05 09:50:24 2009 +0100
 
93
@@ -1207,6 +1247,16 @@
 
94
   # Available fields: uid, box, msgid, from, subject, size, vsize, flags
 
95
   # size and vsize are available only for expunge and copy events.
 
96
   #mail_log_fields = uid box msgid size
 
97
+
 
98
+  # Sieve plugin (http://wiki.dovecot.org/LDA/Sieve) and ManageSieve service
 
99
+  # 
 
100
+  # Location of the active script. When ManageSieve is used this is actually 
 
101
+  # a symlink pointing to the active script in the sieve storage directory. 
 
102
+  #sieve=~/.dovecot.sieve
 
103
+  #
 
104
+  # The path to the directory where the personal Sieve scripts are stored. For 
 
105
+  # ManageSieve this is where the uploaded scripts are stored.
 
106
+  #sieve_dir=~/sieve
 
107
 }
 
108
 
 
109
 # Config files can also be included:
 
110
diff -urN dovecot-1.2.4.orig/README.managesieve dovecot-1.2.4/README.managesieve
 
111
--- dovecot-1.2.4.orig/README.managesieve       1970-01-01 01:00:00.000000000 +0100
 
112
+++ dovecot-1.2.4/README.managesieve    2009-08-29 17:20:49.000000000 +0200
 
113
@@ -0,0 +1,29 @@
 
114
+
 
115
+MANAGESIEVE service support patch for Dovecot 1.2
 
116
+
 
117
+NOTICE: As per dovecot-1.1, this patch only contains the changes to the 
 
118
+Dovecot tree that are necessary to use the now external 
 
119
+dovecot-1.x-managesieve package. So, applying this patch is no longer 
 
120
+the only thing you need to do to give Dovecot managesieve support. 
 
121
+Eventually the need for this patch will disappear completely. 
 
122
+
 
123
+Compile
 
124
+-------
 
125
+
 
126
+After applying this patch you can just use the usual build process
 
127
+(http://wiki.dovecot.org/CompilingSource):
 
128
+
 
129
+./configure
 
130
+make
 
131
+sudo make install 
 
132
+
 
133
+Don't forget to execute ./autogen.sh if you downloaded dovecot from the
 
134
+Mercurial repository.
 
135
+
 
136
+Installation and Configuration
 
137
+------------------------------
 
138
+
 
139
+Read the README of the dovecot-managesieve package for the next steps. 
 
140
+Note that this patch adds configuration examples to the dovecot-example.conf 
 
141
+configuration file example.
 
142
+
 
143
diff -urN dovecot-1.2.4.orig/src/master/child-process.c dovecot-1.2.4/src/master/child-process.c
 
144
--- dovecot-1.2.4.orig/src/master/child-process.c       2009-04-28 22:01:59.000000000 +0200
 
145
+++ dovecot-1.2.4/src/master/child-process.c    2009-08-29 17:20:49.000000000 +0200
134
146
@@ -20,7 +20,8 @@
135
147
        "imap",
136
148
        "pop3",
149
161
                        return "Out of memory - see mail_process_size setting";
150
162
                case PROCESS_TYPE_UNKNOWN:
151
163
                case PROCESS_TYPE_SSL_PARAM:
152
 
diff -r 8cacf7ad431d src/master/child-process.h
153
 
--- a/src/master/child-process.h        Tue Feb 03 18:44:27 2009 -0500
154
 
+++ b/src/master/child-process.h        Thu Feb 05 09:50:24 2009 +0100
 
164
@@ -157,6 +159,7 @@
 
165
 #endif
 
166
        case PROCESS_TYPE_IMAP:
 
167
        case PROCESS_TYPE_POP3:
 
168
+       case PROCESS_TYPE_MANAGESIEVE:
 
169
 #ifndef HAVE_PR_SET_DUMPABLE
 
170
                if (!settings_root->defaults->mail_drop_priv_before_exec) {
 
171
                        str_append(str, " (core not dumped - set mail_drop_priv_before_exec=yes)");
 
172
diff -urN dovecot-1.2.4.orig/src/master/child-process.h dovecot-1.2.4/src/master/child-process.h
 
173
--- dovecot-1.2.4.orig/src/master/child-process.h       2009-02-23 19:26:01.000000000 +0100
 
174
+++ dovecot-1.2.4/src/master/child-process.h    2009-08-29 17:20:49.000000000 +0200
155
175
@@ -10,6 +10,7 @@
156
176
        PROCESS_TYPE_POP3,
157
177
        PROCESS_TYPE_SSL_PARAM,
160
180
 
161
181
        PROCESS_TYPE_MAX
162
182
 };
163
 
diff -r 8cacf7ad431d src/master/listener.c
164
 
--- a/src/master/listener.c     Tue Feb 03 18:44:27 2009 -0500
165
 
+++ b/src/master/listener.c     Thu Feb 05 09:50:24 2009 +0100
166
 
@@ -126,6 +126,10 @@
 
183
diff -urN dovecot-1.2.4.orig/src/master/listener.c dovecot-1.2.4/src/master/listener.c
 
184
--- dovecot-1.2.4.orig/src/master/listener.c    2009-06-05 00:28:14.000000000 +0200
 
185
+++ dovecot-1.2.4/src/master/listener.c 2009-08-29 17:20:49.000000000 +0200
 
186
@@ -130,6 +130,10 @@
167
187
                        check_conflicts_set(server->pop3, ip, port,
168
188
                                            "pop3", proto);
169
189
                }
174
194
        }
175
195
 }
176
196
 
177
 
@@ -226,13 +230,29 @@
 
197
@@ -230,13 +234,29 @@
178
198
                        if (set->protocol == MAIL_PROTOCOL_POP3 &&
179
 
                            !set->ssl_disable)
 
199
                            strcmp(set->ssl, "no") != 0)
180
200
                                ssl_listen = TRUE;
181
201
+               } else if (strcasecmp(*proto, "managesieve") == 0) {
182
202
+                       if (set->protocol == MAIL_PROTOCOL_MANAGESIEVE)
205
225
                listener_init("listen", set->listen, default_port,
206
226
                              &set->listens);
207
227
        }
208
 
@@ -332,9 +352,11 @@
 
228
@@ -336,9 +356,11 @@
209
229
                if (old_set != NULL) {
210
230
                        listen_copy_old(old_set->imap, server->imap);
211
231
                        listen_copy_old(old_set->pop3, server->pop3);
217
237
 
218
238
                if (old_set != NULL)
219
239
                        old_set = old_set->next;
220
 
@@ -345,6 +367,8 @@
 
240
@@ -349,6 +371,8 @@
221
241
                        listener_listen_missing(server->imap, "imap", retry);
222
242
                if (server->pop3 != NULL)
223
243
                        listener_listen_missing(server->pop3, "pop3", retry);
226
246
        }
227
247
 }
228
248
 
229
 
@@ -361,5 +385,8 @@
 
249
@@ -365,5 +389,8 @@
230
250
                        listener_close_fds(&server->pop3->listens);
231
251
                        listener_close_fds(&server->pop3->ssl_listens);
232
252
                }
235
255
+               }
236
256
        }
237
257
 }
238
 
diff -r 8cacf7ad431d src/master/login-process.c
239
 
--- a/src/master/login-process.c        Tue Feb 03 18:44:27 2009 -0500
240
 
+++ b/src/master/login-process.c        Thu Feb 05 09:50:24 2009 +0100
241
 
@@ -73,8 +73,20 @@
 
258
diff -urN dovecot-1.2.4.orig/src/master/login-process.c dovecot-1.2.4/src/master/login-process.c
 
259
--- dovecot-1.2.4.orig/src/master/login-process.c       2009-04-28 22:01:59.000000000 +0200
 
260
+++ dovecot-1.2.4/src/master/login-process.c    2009-08-29 17:20:49.000000000 +0200
 
261
@@ -72,8 +72,20 @@
242
262
        group = i_new(struct login_group, 1);
243
263
        group->refcount = 1;
244
264
        group->set = set;
261
281
 
262
282
        group->next = login_groups;
263
283
        login_groups = group;
264
 
@@ -226,6 +238,8 @@
 
284
@@ -224,6 +236,8 @@
265
285
                        login_group_create(server->imap);
266
286
                if (server->pop3 != NULL)
267
287
                        login_group_create(server->pop3);
270
290
        }
271
291
 }
272
292
 
273
 
@@ -287,6 +301,8 @@
 
293
@@ -285,6 +299,8 @@
274
294
                        protocol = MAIL_PROTOCOL_IMAP;
275
295
                else if (strcmp(proto, "pop3") == 0)
276
296
                        protocol = MAIL_PROTOCOL_POP3;
279
299
                else {
280
300
                        i_error("login: Unknown protocol '%s'", proto);
281
301
                        return FALSE;
282
 
@@ -595,6 +611,9 @@
 
302
@@ -619,7 +635,13 @@
283
303
                                    *set->imap_capability != '\0' ?
284
304
                                    set->imap_capability :
285
305
                                    set->imap_generated_capability, NULL));
286
306
+       } else if (group->mail_process_type == PROCESS_TYPE_MANAGESIEVE) {
 
307
+               env_put(t_strconcat("CAPABILITY_STRING=",
 
308
+                       set->managesieve_generated_capability, NULL));
287
309
+               env_put(t_strconcat("MANAGESIEVE_IMPLEMENTATION_STRING=",
288
 
+                       set->managesieve_implementation_string, NULL));
 
310
+                                       set->managesieve_implementation_string, NULL));
289
311
        }
290
 
        env_put(t_strconcat("LOGIN_DIR=", set->login_dir, NULL));
291
 
 }
292
 
diff -r 8cacf7ad431d src/master/mail-process.c
293
 
--- a/src/master/mail-process.c Tue Feb 03 18:44:27 2009 -0500
294
 
+++ b/src/master/mail-process.c Thu Feb 05 09:50:24 2009 +0100
295
 
@@ -337,6 +337,27 @@
 
312
+
 
313
        if (*set->login_trusted_networks != '\0') {
 
314
                env_put(t_strconcat("TRUSTED_NETWORKS=",
 
315
                                    set->login_trusted_networks, NULL));
 
316
diff -urN dovecot-1.2.4.orig/src/master/mail-process.c dovecot-1.2.4/src/master/mail-process.c
 
317
--- dovecot-1.2.4.orig/src/master/mail-process.c        2009-08-08 01:46:04.000000000 +0200
 
318
+++ dovecot-1.2.4/src/master/mail-process.c     2009-08-29 17:20:49.000000000 +0200
 
319
@@ -368,6 +368,15 @@
296
320
        /* We care about POP3 UIDL format in all process types */
297
321
        env_put(t_strconcat("POP3_UIDL_FORMAT=", set->pop3_uidl_format, NULL));
298
322
 
299
323
+       if (set->protocol == MAIL_PROTOCOL_MANAGESIEVE) {
300
324
+               env_put(t_strdup_printf("MANAGESIEVE_MAX_LINE_LENGTH=%u",
301
325
+                                   set->managesieve_max_line_length));
 
326
+               env_put(t_strconcat("MANAGESIEVE_LOGOUT_FORMAT=",
 
327
+                                   set->managesieve_logout_format, NULL));
302
328
+               env_put(t_strconcat("MANAGESIEVE_IMPLEMENTATION_STRING=",
303
329
+                           set->managesieve_implementation_string, NULL));
304
330
+       }
305
331
+
306
 
+       /* Set sieve environment 
307
 
+        *   FIXME: Currently just uses the expand_mail_env function to 
308
 
+        *   substitute variables and home dir. Technically, that function
309
 
+        *   is not meant for the sieve implementation.  
310
 
+        */
311
 
+       if ( set->sieve_storage != NULL ) {
312
 
+               env_put(t_strconcat("SIEVE_STORAGE=",
313
 
+               expand_mail_env(set->sieve_storage, var_expand_table), NULL));
314
 
+       }
315
 
+       if (set->sieve != NULL) {
316
 
+               env_put(t_strconcat("SIEVE=",
317
 
+                       expand_mail_env(set->sieve, var_expand_table), NULL));
318
 
+       }
319
 
+
320
332
        if (set->mail_save_crlf)
321
333
                env_put("MAIL_SAVE_CRLF=1");
322
334
        if (set->mmap_disable)
323
 
@@ -457,6 +478,8 @@
 
335
@@ -490,6 +499,8 @@
324
336
                        set = server->imap;
325
337
                else if (strcmp(protocol, "pop3") == 0)
326
338
                        set = server->pop3;
329
341
                else
330
342
                        i_fatal("Unknown protocol: '%s'", protocol);
331
343
                executable = set->mail_executable;
332
 
@@ -556,7 +579,8 @@
 
344
@@ -589,7 +600,8 @@
333
345
        bool home_given, nfs_check;
334
346
 
335
347
        i_assert(process_type == PROCESS_TYPE_IMAP ||
339
351
 
340
352
        if (mail_process_count == set->max_mail_processes) {
341
353
                i_error("Maximum number of mail processes exceeded "
342
 
@@ -922,6 +946,8 @@
 
354
@@ -980,6 +992,8 @@
343
355
                                           mail_process_destroyed);
344
356
        child_process_set_destroy_callback(PROCESS_TYPE_POP3,
345
357
                                           mail_process_destroyed);
348
360
 }
349
361
 
350
362
 void mail_processes_deinit(void)
351
 
diff -r 8cacf7ad431d src/master/main.c
352
 
--- a/src/master/main.c Tue Feb 03 18:44:27 2009 -0500
353
 
+++ b/src/master/main.c Thu Feb 05 09:50:24 2009 +0100
354
 
@@ -201,6 +201,8 @@
355
 
                if (server->imap != NULL && have_stderr_set(server->imap))
 
363
diff -urN dovecot-1.2.4.orig/src/master/main.c dovecot-1.2.4/src/master/main.c
 
364
--- dovecot-1.2.4.orig/src/master/main.c        2009-05-20 23:48:16.000000000 +0200
 
365
+++ dovecot-1.2.4/src/master/main.c     2009-08-29 17:20:49.000000000 +0200
 
366
@@ -207,6 +207,8 @@
356
367
                        return TRUE;
357
368
                if (server->pop3 != NULL && have_stderr_set(server->pop3))
 
369
                        return TRUE;
 
370
+               if (server->managesieve != NULL && have_stderr_set(server->managesieve))
358
371
+                       return TRUE;
359
 
+               if (server->managesieve != NULL && have_stderr_set(server->managesieve))
360
 
                        return TRUE;
361
372
 
362
373
                server = server->next;
363
 
diff -r 8cacf7ad431d src/master/master-settings-defs.c
364
 
--- a/src/master/master-settings-defs.c Tue Feb 03 18:44:27 2009 -0500
365
 
+++ b/src/master/master-settings-defs.c Thu Feb 05 09:50:24 2009 +0100
366
 
@@ -127,5 +127,13 @@
367
 
        /* dict */
368
 
        DEF_STR(dict_db_config),
369
 
 
370
 
+       /* managesieve */
371
 
+       DEF_INT(managesieve_max_line_length),
372
 
+       DEF_STR(managesieve_implementation_string),
373
 
+
374
 
+       /* sieve */
375
 
+       DEF_STR(sieve_storage),
376
 
+       DEF_STR(sieve),
377
 
+
378
 
        { 0, NULL, 0 }
379
 
 };
380
 
diff -r 8cacf7ad431d src/master/master-settings.c
381
 
--- a/src/master/master-settings.c      Tue Feb 03 18:44:27 2009 -0500
382
 
+++ b/src/master/master-settings.c      Thu Feb 05 09:50:24 2009 +0100
383
 
@@ -293,6 +293,14 @@
384
 
        /* dict */
 
374
        }
 
375
diff -urN dovecot-1.2.4.orig/src/master/master-settings.c dovecot-1.2.4/src/master/master-settings.c
 
376
--- dovecot-1.2.4.orig/src/master/master-settings.c     2009-08-08 01:46:04.000000000 +0200
 
377
+++ dovecot-1.2.4/src/master/master-settings.c  2009-08-29 17:20:49.000000000 +0200
 
378
@@ -296,6 +296,11 @@
385
379
        MEMBER(dict_db_config) NULL,
 
380
        MEMBER(dict_process_count) 1,
386
381
 
387
382
+       /* managesieve */
388
383
+       MEMBER(managesieve_max_line_length) 65536,
 
384
+       MEMBER(managesieve_logout_format) "bytes=%i/%o",
389
385
+       MEMBER(managesieve_implementation_string) PACKAGE,
390
386
+
391
 
+       /* sieve */
392
 
+       MEMBER(sieve_storage) "",
393
 
+       MEMBER(sieve) NULL,
394
 
+
395
387
        /* .. */
396
388
 };
397
389
 
398
 
@@ -473,6 +481,8 @@
 
390
@@ -476,6 +481,8 @@
399
391
                        auth->parent->pop3->ssl_verify_client_cert = TRUE;
400
392
                if (auth->parent->imap != NULL)
401
393
                        auth->parent->imap->ssl_verify_client_cert = TRUE;
404
396
        }
405
397
 
406
398
        for (s = auth->sockets; s != NULL; s = s->next) {
407
 
@@ -528,8 +538,11 @@
408
 
        if (set->protocol == MAIL_PROTOCOL_IMAP) {
 
399
@@ -555,12 +562,21 @@
 
400
                return TRUE;
 
401
        }
 
402
 
 
403
-       if (set->protocol == MAIL_PROTOCOL_IMAP) {
 
404
+       switch ( set->protocol ) {
 
405
+       case MAIL_PROTOCOL_IMAP:
409
406
                if (strstr(set->protocols, "imap") == NULL)
410
407
                        return FALSE;
411
 
+       } else if (set->protocol == MAIL_PROTOCOL_POP3) {
412
 
+               if (strstr(set->protocols, "pop3") == NULL)
413
 
+                       return FALSE;
414
 
        } else {
415
 
-               if (strstr(set->protocols, "pop3") == NULL)
 
408
-       } else {
 
409
+               break;
 
410
+       case MAIL_PROTOCOL_POP3:
 
411
                if (strstr(set->protocols, "pop3") == NULL)
 
412
                        return FALSE;
 
413
+               break;
 
414
+       case MAIL_PROTOCOL_MANAGESIEVE:
416
415
+               if (strstr(set->protocols, "managesieve") == NULL)
 
416
+                       return FALSE;
 
417
+               break;
 
418
+       default:
 
419
+               i_unreached();
 
420
        }
 
421
 
 
422
        return TRUE;
 
423
@@ -655,7 +671,6 @@
 
424
        (void)closedir(dirp);
 
425
 }
 
426
 
 
427
-#ifdef HAVE_MODULES
 
428
 static const char *
 
429
 get_process_capability(enum process_type ptype, struct settings *set)
 
430
 {
 
431
@@ -756,6 +771,7 @@
 
432
        return i_strdup(buf);
 
433
 }
 
434
 
 
435
+#ifdef HAVE_MODULES
 
436
 static bool get_imap_capability(struct settings *set)
 
437
 {
 
438
        static const char *generated_capability = NULL;
 
439
@@ -780,6 +796,26 @@
 
440
 }
 
441
 #endif
 
442
 
 
443
+static bool get_managesieve_capability(struct settings *set)
 
444
+{
 
445
+       static const char *generated_capability = NULL;
 
446
+
 
447
+       if (generated_capability != NULL) {
 
448
+               /* See get_imap_capability above.. */
 
449
+               set->managesieve_generated_capability =
 
450
+                       p_strdup(settings_pool, generated_capability);
 
451
+               return TRUE;
 
452
+       }
 
453
+
 
454
+       generated_capability = get_process_capability(PROCESS_TYPE_MANAGESIEVE, set);
 
455
+       if (generated_capability == NULL)
 
456
+               return FALSE;
 
457
+
 
458
+       set->managesieve_generated_capability =
 
459
+               p_strdup(settings_pool, generated_capability);
 
460
+       return TRUE;
 
461
+}
 
462
+
 
463
 static bool settings_verify(struct settings *set)
 
464
 {
 
465
        const char *dir;
 
466
@@ -965,6 +1001,11 @@
 
467
                strstr(set->server->imap->login_executable, " -D");
 
468
        if (p != NULL && p[3] == '\0')
 
469
                return TRUE;
 
470
+       p = set->server->managesieve == NULL ? NULL :
 
471
+               strstr(set->server->managesieve->login_executable, " -D");
 
472
+       if (p != NULL && p[3] == '\0')
 
473
+               return TRUE;
 
474
+
 
475
        return FALSE;
 
476
 }
 
477
 
 
478
@@ -1016,6 +1057,10 @@
417
479
                        return FALSE;
418
480
        }
419
 
 
420
 
@@ -1178,7 +1191,7 @@
421
 
 
422
 
        if (strcmp(key, "login") == 0) {
423
 
                i_warning("Ignoring deprecated 'login' section handling. "
424
 
-                         "Use protocol imap/pop3 { .. } instead. "
425
 
+                         "Use protocol imap/pop3/managesieve { .. } instead. "
426
 
                          "Some settings may have been read incorrectly.");
427
 
                return NULL;
428
 
        }
429
 
@@ -1201,6 +1214,15 @@
430
 
                        error = parse_setting_from_defs(settings_pool,
431
 
                                                        setting_defs,
432
 
                                                        ctx->server->pop3,
433
 
+                                                       key, value);
434
 
+               }
435
 
+
 
481
 #endif
 
482
+       if ( set->protocol == MAIL_PROTOCOL_MANAGESIEVE ) {
 
483
+               if (!get_managesieve_capability(set))
 
484
+                       return FALSE;
 
485
+       }
 
486
        return TRUE;
 
487
 }
 
488
 
 
489
@@ -1251,6 +1296,15 @@
 
490
                        array_append(&ctx->server->lda_settings, &value, 1);
 
491
                }
 
492
 
436
493
+               if (error == NULL &&
437
494
+                   (ctx->protocol == MAIL_PROTOCOL_ANY ||
438
495
+                    ctx->protocol == MAIL_PROTOCOL_MANAGESIEVE)) {
439
496
+                       error = parse_setting_from_defs(settings_pool,
440
497
+                                                       setting_defs,
441
498
+                                                       ctx->server->managesieve,
442
 
                                                        key, value);
443
 
                }
 
499
+                                                       key, value);
 
500
+               }
 
501
+
 
502
                if (error == NULL)
 
503
                        return NULL;
444
504
 
445
 
@@ -1262,6 +1284,13 @@
 
505
@@ -1309,6 +1363,13 @@
446
506
                        array_append(&ctx->server->pop3->plugin_envs,
447
507
                                     &value, 1);
448
508
                }
456
516
                return NULL;
457
517
        }
458
518
 
459
 
@@ -1271,7 +1300,8 @@
 
519
@@ -1318,7 +1379,8 @@
460
520
 static struct server_settings *
461
521
 create_new_server(const char *name,
462
522
                  struct settings *imap_defaults,
466
526
 {
467
527
        struct server_settings *server;
468
528
 
469
 
@@ -1279,14 +1309,17 @@
 
529
@@ -1326,15 +1388,18 @@
470
530
        server->name = p_strdup(settings_pool, name);
471
531
        server->imap = p_new(settings_pool, struct settings, 1);
472
532
        server->pop3 = p_new(settings_pool, struct settings, 1);
478
538
+       *server->managesieve = *managesieve_defaults;
479
539
 
480
540
        p_array_init(&server->dicts, settings_pool, 4);
 
541
        p_array_init(&server->lda_settings, settings_pool, 12);
481
542
        p_array_init(&server->imap->plugin_envs, settings_pool, 8);
482
543
        p_array_init(&server->pop3->plugin_envs, settings_pool, 8);
483
544
+       p_array_init(&server->managesieve->plugin_envs, settings_pool, 8);
484
545
 
485
546
        server->imap->server = server;
486
547
        server->imap->protocol = MAIL_PROTOCOL_IMAP;
487
 
@@ -1300,6 +1333,12 @@
 
548
@@ -1348,6 +1413,12 @@
488
549
        server->pop3->mail_executable = PKG_LIBEXECDIR"/pop3";
489
550
        server->pop3->mail_plugin_dir = MODULEDIR"/pop3";
490
551
 
497
558
        return server;
498
559
 }
499
560
 
500
 
@@ -1342,8 +1381,8 @@
 
561
@@ -1390,8 +1461,8 @@
501
562
 
502
563
                ctx->type = SETTINGS_TYPE_SERVER;
503
564
                ctx->server = create_new_server(name, ctx->server->imap,
508
569
                while (server->next != NULL)
509
570
                        server = server->next;
510
571
                server->next = ctx->server;
511
 
@@ -1364,6 +1403,8 @@
 
572
@@ -1412,6 +1483,8 @@
512
573
                        ctx->protocol = MAIL_PROTOCOL_POP3;
513
574
                else if (strcmp(name, "lda") == 0)
514
575
                        ctx->protocol = MAIL_PROTOCOL_LDA;
517
578
                else {
518
579
                        *errormsg = "Unknown protocol name";
519
580
                        return FALSE;
520
 
@@ -1475,6 +1516,8 @@
 
581
@@ -1523,6 +1596,8 @@
521
582
                        fd_count += server->imap->login_max_processes_count;
522
583
                if (server->pop3 != NULL)
523
584
                        fd_count += server->pop3->login_max_processes_count;
526
587
                fd_count += server->defaults->max_mail_processes;
527
588
        }
528
589
 
529
 
@@ -1504,7 +1547,7 @@
 
590
@@ -1553,7 +1628,7 @@
530
591
        ctx.protocol = MAIL_PROTOCOL_ANY;
531
592
        ctx.server = ctx.root =
532
593
                create_new_server("default",
535
596
        ctx.auth = &ctx.server->auth_defaults;
536
597
 
537
598
        if (!settings_read(path, NULL, parse_setting, parse_section, &ctx))
538
 
@@ -1521,7 +1564,9 @@
 
599
@@ -1570,7 +1645,8 @@
539
600
 
540
601
        if (!nochecks && !nofixes) {
541
 
                ctx.root->defaults = settings_is_active(ctx.root->imap) ?
 
602
                def = settings_is_active(ctx.root->imap) ?
542
603
-                       ctx.root->imap : ctx.root->pop3;
543
 
+                       ctx.root->imap : 
544
 
+                       (settings_is_active(ctx.root->pop3) ? 
545
 
+                               ctx.root->pop3 : ctx.root->managesieve);
 
604
+                       ctx.root->imap : ( settings_is_active(ctx.root->pop3) ?
 
605
+                               ctx.root->pop3 : ctx.root->managesieve );
546
606
 
547
 
                path = t_strconcat(ctx.root->defaults->base_dir,
548
 
                                   "/master.pid", NULL);
549
 
@@ -1531,7 +1576,8 @@
 
607
                path = t_strconcat(def->base_dir, "/master.pid", NULL);
 
608
                pid_file_check_running(path);
 
609
@@ -1579,7 +1655,8 @@
550
610
        prev = NULL;
551
611
        for (server = ctx.root; server != NULL; server = server->next) {
552
612
                if ((*server->imap->protocols == '\0' ||
556
616
                        i_error("protocols: No protocols given "
557
617
                                "in configuration file");
558
618
                        return FALSE;
559
 
@@ -1560,6 +1606,15 @@
560
 
                                return FALSE;
561
 
                        if (server->defaults == NULL)
 
619
@@ -1610,6 +1687,15 @@
562
620
                                server->defaults = server->pop3;
563
 
+               }
564
 
+
 
621
                }
 
622
 
565
623
+               if (!settings_is_active(server->managesieve) && !nochecks)
566
624
+                       server->managesieve = NULL;
567
625
+               else {
569
627
+                               return FALSE;
570
628
+                       if (server->defaults == NULL)
571
629
+                               server->defaults = server->managesieve;
572
 
                }
573
 
 
 
630
+               }
 
631
+
574
632
                if (server->defaults == NULL) {
575
 
@@ -1779,8 +1834,8 @@
 
633
                        if (prev == NULL)
 
634
                                ctx.root = server->next;
 
635
@@ -1843,8 +1929,8 @@
576
636
 
577
637
 void master_settings_dump(struct server_settings *set, bool nondefaults)
578
638
 {
583
643
        unsigned int count;
584
644
 
585
645
        sets[0] = &default_settings;
586
 
@@ -1798,6 +1853,11 @@
587
 
        if (set->pop3 != NULL) {
 
646
@@ -1863,6 +1949,11 @@
588
647
                sets[count] = set->pop3;
589
648
                set_names[count] = "pop3";
590
 
+               count++;
 
649
                count++;
591
650
+       }       
592
651
+       if (set->managesieve != NULL) {
593
652
+               sets[count] = set->managesieve;
594
653
+               set_names[count] = "managesieve";
595
 
                count++;
 
654
+               count++;
596
655
        }
597
656
        settings_dump(setting_defs, sets, set_names, count, nondefaults, 0);
598
 
diff -r 8cacf7ad431d src/master/master-settings.h
599
 
--- a/src/master/master-settings.h      Tue Feb 03 18:44:27 2009 -0500
600
 
+++ b/src/master/master-settings.h      Thu Feb 05 09:50:24 2009 +0100
 
657
        namespace_settings_dump(set->namespaces, nondefaults);
 
658
diff -urN dovecot-1.2.4.orig/src/master/master-settings-defs.c dovecot-1.2.4/src/master/master-settings-defs.c
 
659
--- dovecot-1.2.4.orig/src/master/master-settings-defs.c        2009-04-28 22:01:59.000000000 +0200
 
660
+++ dovecot-1.2.4/src/master/master-settings-defs.c     2009-08-29 17:20:49.000000000 +0200
 
661
@@ -130,5 +130,10 @@
 
662
        DEF_STR(dict_db_config),
 
663
        DEF_INT(dict_process_count),
 
664
 
 
665
+       /* managesieve */
 
666
+       DEF_INT(managesieve_max_line_length),
 
667
+       DEF_STR(managesieve_logout_format),
 
668
+       DEF_STR(managesieve_implementation_string),
 
669
+
 
670
        { 0, NULL, 0 }
 
671
 };
 
672
diff -urN dovecot-1.2.4.orig/src/master/master-settings.h dovecot-1.2.4/src/master/master-settings.h
 
673
--- dovecot-1.2.4.orig/src/master/master-settings.h     2009-08-08 01:46:04.000000000 +0200
 
674
+++ dovecot-1.2.4/src/master/master-settings.h  2009-08-29 17:20:49.000000000 +0200
601
675
@@ -4,10 +4,11 @@
602
676
 #include "network.h"
603
677
 
613
687
 };
614
688
 
615
689
 struct listener {
616
 
@@ -139,6 +140,14 @@
617
 
        /* dict */
 
690
@@ -142,6 +143,11 @@
618
691
        const char *dict_db_config;
 
692
        unsigned int dict_process_count;
619
693
 
620
694
+       /* managesieve */
621
695
+       unsigned int managesieve_max_line_length;
 
696
+       const char *managesieve_logout_format;
622
697
+       const char *managesieve_implementation_string;
623
698
+
624
 
+       /* sieve */
625
 
+       const char *sieve_storage;
626
 
+       const char *sieve;
627
 
+
628
699
        /* .. */
629
700
        ARRAY_TYPE(listener) listens;
630
701
        ARRAY_TYPE(listener) ssl_listens;
631
 
@@ -252,9 +261,10 @@
 
702
@@ -150,6 +156,7 @@
 
703
        gid_t mail_gid_t, mail_priv_gid_t;
 
704
 
 
705
        const char *imap_generated_capability;
 
706
+       const char *managesieve_generated_capability;
 
707
 
 
708
        ARRAY_DEFINE(plugin_envs, const char *);
 
709
 };
 
710
@@ -255,9 +262,10 @@
632
711
        struct settings *defaults;
633
712
        struct settings *imap;
634
713
        struct settings *pop3;
638
717
-        struct namespace_settings *namespaces;
639
718
+       struct namespace_settings *namespaces;
640
719
 
 
720
        ARRAY_DEFINE(lda_settings, const char *);
641
721
        ARRAY_DEFINE(dicts, const char *);
642