[Dovecot] Custom 'quota exceeded' message + Sieve script from database
Hi!
I'm quite new to Dovecot. helping my friend to migrate from Courier-IMAP to something more efficient, we are evaluating Dovecot at the moment.
I had to prepare 2 small patches for Dovecot to suit our needs, and I've decided to post it here. I'm not fully familiar with Dovecot architecture yet, I'd appreciate if someone could look if these changes make sense (i.e. doesn't break anything). And of course, maybe someone is interested as well.
- Customized "quota exceeded" message.
http://czajnick.sitenet.pl/dovecot/dovecot_1.0.9_quota_exceeded_message.diff
- quick hack to let me define custom message instead of typical "Quota exceeded", simply by using plugins { quota_exceeded_message = ... }. Browsing this mailing list I've seen some posts about such feature being implemented in Dovecot. Is it done in a similar way? Which stable version is the first to include this functionality?
- Sieve filter modification
http://czajnick.sitenet.pl/dovecot/dovecot_sieve_1.0.2_envscript_patch.diff
In our systems we currently use a modified maildrop MDA that picks the filter script from the database instead of the file. This has proven useful - end-user's administration panel doesn't need any special permissions (or networking capabilities), as it doesn't need to access the filesystem - it is reduced to a plain database web-app.
The patch above makes the delivery agent check for the sieve script present in SIEVE_SCRIPT environment variable. If this is the case, env var content is used instead of the script stored in a usual file pointed to by SIEVE variable. This makes it trivial to pass the script from the database using base dovecot functionality.
A minor drawback of such solution is that the script is re-compiled on each delivery, but I don't think it takes much time to compile a few lines of a script using (f)lex/bison-or-yacc parser. Yes, I've noticed the sieve-manage patch, but I don't want the complexity of managing sieve script over the socket connection (if my understanding of the script is wrong, please correct me).
BR, Przemyslaw
On Sun, 2008-01-06 at 19:11 +0100, Przemyslaw Wegrzyn wrote:
- Customized "quota exceeded" message.
http://czajnick.sitenet.pl/dovecot/dovecot_1.0.9_quota_exceeded_message.diff
- quick hack to let me define custom message instead of typical "Quota exceeded", simply by using plugins { quota_exceeded_message = ... }. Browsing this mailing list I've seen some posts about such feature being implemented in Dovecot. Is it done in a similar way? Which stable version is the first to include this functionality?
There's only a customizable rejection reason:
# Human readable error message for rejection mails. Use can use variables: # %n = CRLF, %r = reason, %s = subject, %t = recipient #rejection_reason = Your message to <%t> was automatically rejected:%n%r
The "Quota exceeded" is still not configurable. I guess maybe it could be, since it's pretty much the only visible rejection reason and people have been asking for it for so long.. For v1.1: http://hg.dovecot.org/dovecot/rev/740a17139b67
- Sieve filter modification
http://czajnick.sitenet.pl/dovecot/dovecot_sieve_1.0.2_envscript_patch.diff .. A minor drawback of such solution is that the script is re-compiled on each delivery, but I don't think it takes much time to compile a few lines of a script using (f)lex/bison-or-yacc parser. Yes, I've noticed the sieve-manage patch, but I don't want the complexity of managing sieve script over the socket connection (if my understanding of the script is wrong, please correct me).
Managesieve's author is also writing a new Sieve implementation from scratch. I'm hoping it eventually replaces the current dovecot-sieve, but that patch doesn't look too invasive, so I guess I could include it. Except for these:
sieve-cmu.c: In function 'dovecot_sieve_compile_buffer': sieve-cmu.c:606: warning: passing argument 1 of 'sieve_generate_bytecode' from incompatible pointer type sieve-cmu.c: In function 'cmu_sieve_run': sieve-cmu.c:654: warning: passing argument 4 of 'dovecot_sieve_compile_buffer' from incompatible pointer type
I'm not sure why it even works. :)
Timo Sirainen wrote:
The "Quota exceeded" is still not configurable. I guess maybe it could be, since it's pretty much the only visible rejection reason and people have been asking for it for so long.. For v1.1: http://hg.dovecot.org/dovecot/rev/740a17139b67
Cool, thx.
Managesieve's author is also writing a new Sieve implementation from scratch. I'm hoping it eventually replaces the current dovecot-sieve, but that patch doesn't look too invasive, so I guess I could include it. Except for these:
sieve-cmu.c: In function 'dovecot_sieve_compile_buffer': sieve-cmu.c:606: warning: passing argument 1 of 'sieve_generate_bytecode' from incompatible pointer type sieve-cmu.c: In function 'cmu_sieve_run': sieve-cmu.c:654: warning: passing argument 4 of 'dovecot_sieve_compile_buffer' from incompatible pointer type
I'm not sure why it even works. :)
Huh, I must haves messed up something when diff'ing, as it compiled and worked for me :) I'll recheck and repost it when ready, I'm quite busy these days :/
BR, Przemyslaw
participants (2)
-
Przemyslaw Wegrzyn
-
Timo Sirainen