[Dovecot] lmtp: help needed
Timo Sirainen
tss at iki.fi
Wed Nov 29 20:51:50 UTC 2006
On Wed, 2006-11-29 at 18:59 +0100, Leonardo Lanzi wrote:
> parsing the mailing list archive, it seems that the lmtp-server will not
> be developed soon, so I'm looking for someone that could help me in
> writing one, even if not the best one. That's why:
Well.. Dovecot's deliver is what you should be looking to do this.
Unfortunately its code is quite kludgy. For Dovecot v2.0 I'm doing
larger changes which makes it much cleaner, but for now it's ugly..
Settings are read from environment variables. So in deliver there's now
code which parses dovecot.conf itself and puts pretty much everything in
it into environment variables. You'll need to do this or just set the
environment variables manually somehow.
Do you need to parse the message in any way? If not and you just want to
save it, then it's easier. You can use the mailbox_save_*() functions in
src/lib-storage/mail-storage.h to do it. Deliver however wants to use
the headers of the mails so it create an in-memory mbox formatted
mailbox of the incoming message, which is rather ugly.
There's also src/plugins/convert/ which contains convert-tool binary.
Its code is simpler than deliver's, and it might be easier to
understand.
For seeing how mailbox_save_*() functions work, you can check how
mailbox_copy() is implemented in src/lib-storage/mail-copy.c.
One reason why I don't really like implementing LMTP is because it
doesn't work well with multiple UIDs. You've only 3 choices:
1) Run everything under a single UID
2) Run LMTP delivery code as root which is temporarily setuid to the
user (security hole gives root access)
3) Fork a new process to handle each delivery (couldn't you just use
deliver binary then?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20061129/d7596bcf/attachment.pgp
More information about the dovecot
mailing list