Re: mailfront imapfront-auth with dovecot 1.2.16 : SUCCESS
Giam Teck Choon <[email protected]> Fri, 12 Nov 2010 04:30:17 +0800
| Newsgroups | gmane.comp.sysutils.bgware |
|---|---|
| Organization | CHOON.NET |
| Message-ID | <[email protected]> |
On 11/12/2010 03:56 AM, Bruce Guenter wrote:
> On Fri, Nov 12, 2010 at 03:08:24AM +0800, Giam Teck Choon wrote:
>> SUCCESS with v2.0.7... Many thanks to Timo from dovecot.org :)
>>> Things not what we expected. Their version 2.0.7 not honouring $MAIL at
>>> all. I will keep on testing various environment variables and report
>>> back if I find out more.
>>
>> exec "$@" -O -o mail_location=$MAIL
>
> So you could replace the $IMAPD part of the original script with:
>
> sh -c "exec $IMAPD -O -o mail_location=\$MAIL"
>
> so it would end up running:
>
> tcpserver [options] \
> imapfront-auth \
> sh -c 'exec /usr/libexec/dovecot/imap -O -o mail_location=$MAIL'
>
> making sh do the substitution of $MAIL. No wrapper script should be
> needed for that.
>
If v1.2.16 not support the options? I haven't test that in depth but
mostly will not. I asked Timo and still waiting for reply. If v1 not
supporting those options, a wrapper is needed.
On my choon.net server:
# /usr/libexec/dovecot/imap -O -o mail_location=maildir:/tmp/haha
* PREAUTH [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID
ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND
UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1
CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH
LIST-STATUS] Logged in as root
* BYE Server shutting down.
Info: Server shutting down. bytes=0/332
# /usr/sbin/dovecot --version
2.0.7
On my client server:
# /usr/libexec/dovecot/imap -O -o mail_location=maildir:/tmp/haha
imap(root): Error: Ambiguous mail location setting, don't know what to
do with it: /root/Maildir/ (try prefixing it with mbox: or maildir:)
imap(root): Fatal: Mail storage creation failed with mail_location:
/root/Maildir/
# /usr/sbin/dovecot --version
1.0.15
So I guess a wrapper is needed. I need a generic imapd/run script which
support both dovecot versions (v1 and v2) and courier-imap. If just for
a specific imap server like dovecot v2 then wrapper not needed like what
you stated.
Wrapper as below to support dovecot v1 and v2:
--------------------8<----------8<----------8<----------8<---------------------
#!/bin/sh
if [ -n "$MAIL" ] ; then
export MAIL=maildir:`echo $MAIL | sed 's@:@::@g'`
fi
# we need to know dovecot is v1 or v2
# as v1 might not be supporting the options
# -O -o mail_location=... ...
DOVECOTIMAPOPTIONS=""
if [ -x "/usr/sbin/dovecot" ] ; then
dovecotversion=`/usr/sbin/dovecot --version | cut -f1 -d '.'`
if [ "x$dovecotversion" == "x2" ] ; then
DOVECOTIMAPOPTIONS="-O -o mail_location=$MAIL"
fi
fi
exec "$@" $DOVECOTIMAPOPTIONS
--------------------8<----------8<----------8<----------8<---------------------
Thanks.
Kindest regards,
Giam Teck Choon