Providing reliable services since 2001

Custom Search

23 Feb 2012 11:22 am GMT +8

Home > Resources > Scripts & Patches > Mailfront Imapfront-auth Dovecot

Introduction
mailfront-imapfront-auth-dovecot is a program to modify the MAIL environment variable according to dovecot imap requirements in order to access users mail storage.

Dovecot uses colons as internal field separators; however, since v1.2rc6, it allows colons occurrences via escaping (as : → ::). Before passing such mailbox paths via MAIL environment variable to dovecot imap, this wrapper performs such escaping.

From original MAIL environment variable:

/home/USERNAME/MAILDIR/mail:box:user

To:

maildir:/home/USERNAME/MAILDIR/mail::box::user

Or:

mbox:/home/USERNAME/MAILDIR/mail::box::user

More information can be read at:

http://wiki.dovecot.org/MailLocation
http://wiki2.dovecot.org/MailLocation

References:

http://lists.untroubled.org/?list=bgware&cmd=showthread&month=201011&threadid=elpfjlnilcganfkokehg
http://mij.oltrelinux.com/net/dovecot-qmail-vmailmgr/
http://wiki.dovecot.org/HowTo/VMailMgr



Copyright & Disclaimer
This package is Copyright(C) 2010 Giam Teck Choon or CHOON.NET, and may be copied according to the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 or a later version. A copy of this license is included with this package. This package comes with no warranty of any kind.

YOU ARE FREE TO USE THIS SCRIPT/PATCHES/GUIDE BUT I AM NOT RESPONSIBLE FOR ANY DAMAGE CAUSED! YOU HAVE BEEN WARNED!!!


Changes
19 Nov 2010 GMT +8 : Version 0.04
Use strcpy instead of strcat for initial maildir: or mbox: as using strcat might cause the funny string prefixed in some systems
Added mailfront-imapfront-auth-dovecot.sh
Place back gcc optimizations in Makefile as previous break issue is due to strcat
18 Nov 2010 GMT +8 : Version 0.03
Remove gcc optimizations in Makefile since it break some systems
13 Nov 2010 GMT +8 : Version 0.02
Support mbox format
Skip modifying $MAIL if starting string is mbox: or maildir:
10 Nov 2010 GMT +8 : Version 0.01
Initial release

Source
» mailfront-imapfront-auth-dovecot-0.04.tar.bz2 : 0269e406ca2c042583088a0e2f37d2da (md5sum)
» mailfront-imapfront-auth-dovecot-0.03.tar.bz2 : 26a49c8ed3906a097aabd9a97be87c08 (md5sum)
» mailfront-imapfront-auth-dovecot-0.02.tar.bz2 : 420a69495279ccc19030c1f5c052000d (md5sum)
» mailfront-imapfront-auth-dovecot-0.01.tar.bz2 : f9926ce5e90c62cf0dd487d8140f4d63 (md5sum)

Requirements
» gcc
» make
» mailfront >= 1.16
» dovecot >= 1.2rc6

How to compile, install and use?
Please read the README file provided in this package which contains more information about doing custom installation and so on.

1. Download the source:

wget http://choon.net/opensource/mailfront-imapfront-auth-dovecot/mailfront-imapfront-auth-dovecot-0.04.tar.bz2 -P /usr/local/src

2. Unpack:

cd /usr/local/src/
tar jxvf mailfront-imapfront-auth-dovecot-0.04.tar.bz2

3. Compile:

cd mailfront-imapfront-auth-dovecot-0.04
make

4. Install (default to prefix /usr/local):

make install

5. In your imapd run file, place mailfront-imapfront-auth-dovecot before dovecot imap. Example imapd/run file:
#!/bin/sh

DOVECOTWRAPPER=""
# Default to support dovecot 1.2
if [ -x "/usr/libexec/dovecot/imap" ] ; then
	IMAPD=/usr/libexec/dovecot/imap
	if [ -x "/usr/bin/mailfront-imapfront-auth-dovecot" ] ; then
		DOVECOTWRAPPER=/usr/bin/mailfront-imapfront-auth-dovecot
		# uncomment below line if you are using dovecot version 2
		#export DOVECOT_V2=1
		# uncomment below line if you want to see debug message
		#export IMAPFRONTAUTH_DOVECOT_DEBUG=1
	elif [ -x "/usr/local/bin/mailfront-imapfront-auth-dovecot" ] ; then
		# uncomment below line if you are using dovecot version 2
		#export DOVECOT_V2=1
		DOVECOTWRAPPER=/usr/local/bin/mailfront-imapfront-auth-dovecot
		# uncomment below line if you want to see debug message
		#export IMAPFRONTAUTH_DOVECOT_DEBUG=1
	fi
elif [ -x "/usr/local/bin/imapd" ] ; then
	IMAPD=/usr/local/bin/imapd
elif [ -x "/usr/lib/courier-imap/bin/imapd" ] ; then
	IMAPD=/usr/lib/courier-imap/bin/imapd
else
	IMAPD=/usr/bin/imapd
fi

if [ -x "/usr/bin/imapfront-auth" ] ; then
	IMAPFRONT_AUTH=/usr/bin/imapfront-auth
else
	IMAPFRONT_AUTH=/usr/local/bin/imapfront-auth
fi

ulimitdata=500000000
concurrency=40

CVM_SASL_PLAIN=cvm-local:/tmp/.cvm-vmailmgr
CVM_SASL_LOGIN=cvm-local:/tmp/.cvm-vmailmgr
export CVM_SASL_PLAIN
export CVM_SASL_LOGIN

exec \
softlimit -m $ulimitdata \
tcpserver -DHRUvX -c "$concurrency" -l "`head -n 1 /var/qmail/control/me`" \
	-x /etc/tcpcontrol/imap.cdb 0 imap \
$IMAPFRONT_AUTH $DOVECOTWRAPPER \
$IMAPD 2>&1





All trademarks, trade names, service marks and logos referenced herein belong to their respective companies.

Copyright © 2001 - 2009, CHOON.NET. All rights reserved.