Re: mailfront imapfront-auth with dovecot 1.2.16 : SUCCESS
Giam Teck Choon <[email protected]> Sat, 13 Nov 2010 15:37:50 +0800
| Newsgroups | gmane.comp.sysutils.bgware |
|---|---|
| Organization | CHOON.NET |
| Message-ID | <[email protected]> |
For the benefit of others, I will just update the list members as
below. Sorry in advance if my posting pissed off anyone (if any).
Why version 2 needs -O -o mail_location=... ... options? See:
http://dovecot.org/pipermail/dovecot/2010-November/054780.html
> 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.
Already tested. Their v1.2.16 not support those options and has been
confirmed by Timo from dovecot.org (thanks to Timo for the
confirmation/reply):
http://dovecot.org/pipermail/dovecot/2010-November/054784.html
> 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:
Updated sh wrapper to support v1 and v2 and also see whether $MAIL is
prefixed with maildir or mbox before modifying $MAIL accordingly. This
wrapper also check $MAIL to see whether it is a directory to assume it
is maildir or otherwise assume it is mbox:
--------------------8<----------8<----------8<----------8<---------------------
#!/bin/sh
DOVECOTIMAPOPTIONS=""
if [ -n "$MAIL" ] ; then
# test to see whether maildir or mbox is prefixed in $MAIL
checkmaildir=`grep -E '^maildir:' $MAIL | grep -v grep`
checkmbox=`grep -E '^mbox:' $MAIL | grep -v grep`
if [ ! -n "$checkmaildir" ] && [ ! -n "$checkmbox" ] ; then
# if mailbox is a directory, assume it is maildir
# otherwise assume it is mbox
if [ -d "$MAIL" ] ; then
export MAIL=maildir:`echo $MAIL | sed 's@:@::@g'`
else
export MAIL=mbox:`echo $MAIL | sed 's@:@::@g'`
fi
fi
# we need to know dovecot is v1 or v2
# as v1 is not supporting the options
# -O -o mail_location=... ...
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
fi
exec "$@" $DOVECOTIMAPOPTIONS
--------------------8<----------8<----------8<----------8<---------------------
My C wrapper also updated and can be found at:
http://choon.net/mailfront-imapfront-auth-dovecot.php
Hopefully the above information is useful to someone ;)
Thanks.
Kindest regards,
Giam Teck Choon