[Dovecot] Dovecot-LDA: Development questions
Hello,
I'm tinkering with Dovecot-LDA in order to achieve:
- Better intergration into sendmail, and
- tweaking its way to act on errors.
Attached patch is a "brainstorming" like suggestion:
a) when sendmail is dropping a message, it spawns the LDA, captures stderr/stdout and, if the LDA returns an exit code != 0, generates either a DSN or, when EX_TEMPFAIL, queues the mail. Hence, it is not necessary to have mail_send_rejection() to spawn another sendmail instance. The attached patch suggest to introduce an "operation_mode", in which Dovecot-LDA behaves differently for different environments.
b) Some errors, like when spooling the message into the users folders fails, because the user is out of quota, one should prefer tempfailing the message, rather than a permanent error. Attached patch includes an option "-f", which has main() to return EX_TEMPFAIL. This is the way maildrop is acting, BTW.
===
Sendmail supports "account+detail" syntax out-of-the-box; that is for recipient matching only the portion left of the plus-sign is significant, the trailing portion may be used by the LDA as a hint to spool the message. Usually the information is passed via command line to the LDA.
The libsieve seems to already support this notation, see tokens DETAIL, subaddress, :detail and the README file: Derrick Brashear (shadow+sieve@andrew...)
Did somebody used or have some idea how to make use of the "+detail" stuff of libsieve? Basically the main problem in my opinion is what to query, because the information (final physical mailbox and/or owner) one can query is neither a header nor an envelope information (besides that the envelope information is not available to the LDA anyway). Consider a BCC to one recipient that expands to numerous maildrops, then the maildrop of actual delivery attempt can not be derived from neither the envelope nor the header information.
The only way to integrate the +detail stuff into Dovecot-LDA seems to be when "keep" is performed (or no Sieve script is present). Then one could spool the message into folder "detail", if it already exists -- one should be allow other people to create mailboxes ;-) This is no action of the Sieve library, but of the LDA calling sieve.
The Wiki mentions in the section about to setup exim:
envelope_to_add
What's this setting is doing?
In src/sieve-cmu.c, static int getenvelope, there is:
} else if (!strcasecmp(field, "to")) {
*contents = m->temp;
m->temp[0] = /*FIXME:msg_getrcptall(m, m->cur_rcpt)*/m->authuser;
m->temp[1] = NULL;
return SIEVE_OK;
So it seems appropriate to tweak dovecot_sieve_run() into: mdata.authuser = username; mdata.recipient = detail_on_commandline ? concat(username, "+", detail_on_commandline) : username ; Or better: Have the complete recipient passed via command line option?
and alter getenvelope(): m->temp[0] = m->recipient;
I think this tweaks would be better than have the "-d" option support the plus-syntax.
===
Currently, the compiled Sieve script is placed into the same directory the script is located itself.
How about to _always_ file the compiled script into [CONTROLDIR]/.dovecot.sievec? That would come over the problem with the system-wide default sieve script.
Otherwise: The README mentions a test application and I found a sievec and sieved application (Sieve compile / decompiler) I presume. I can not just run "make sievec" to have it compile, does somebody played around with the Sieve stuff in LDA?
Regards,
-- Steffen Kaiser
participants (1)
-
Steffen Kaiser