network/cyrus-imapd: Updated for version 2.4.8.

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
mario 2011-05-08 13:03:25 -05:00 committed by Robby Workman
parent 798336f889
commit 23b75a01ed
6 changed files with 2391 additions and 27 deletions

View file

@ -1,5 +1,3 @@
What is IMAP?
The Cyrus IMAP (Internet Message Access Protocol) server provides access to The Cyrus IMAP (Internet Message Access Protocol) server provides access to
personal mail and system-wide bulletin boards through the IMAP protocol. personal mail and system-wide bulletin boards through the IMAP protocol.
The Cyrus IMAP server is a scalable enterprise mail system designed for use The Cyrus IMAP server is a scalable enterprise mail system designed for use
@ -25,5 +23,16 @@ Cyrus technologies scale from independent use in email departments to a system
centrally managed in a large enterprise. centrally managed in a large enterprise.
For more information on how to install and run cyrus-imapd, see For more information on how to install and run cyrus-imapd, see
README.SLACKWARE that came with this package (which is also installed with the README.SLACKWARE that came with this package (which is also installed
docs). with the documentation).
Two additional patches have been included, autocreate and autosieve, which
improve cyrus' capabilities. To learn more about them, check their accompanying
README files. To disable them, use: PATCHES=no ./cyrus-imapd.SlackBuild
You must have a "cyrus" user and group to run this script.
Something like this will create them:
# groupadd -g 238 cyrus
# useradd -d /var/imap -s /bin/sh -u 238 -g 238 cyrus
See http://slackbuilds.org/uid_gid.txt for uid/gid suggestions.

View file

@ -8,10 +8,10 @@ a specific directory structure, you can do something like this:
Afterwards run mkimap script to setup the enviroment: Afterwards run mkimap script to setup the enviroment:
# su - cyrus # su - cyrus
# /usr/doc/cyrus-imapd-2.3.16/tools/mkimap # /usr/doc/cyrus-imapd-2.4.6/tools/mkimap
You will probably also want to put this into rc.local: You will probably also want to put this into rc.local:
if [ -x /etc/rc.d/rc.cyrus-imapd ]; then if [ -x /etc/rc.d/rc.cyrus-imapd ]; then
. /etc/rc.d/rc.cyrus-imapd start /etc/rc.d/rc.cyrus-imapd start
fi fi

View file

@ -2,7 +2,7 @@
# Slackware build script for cyrus-imapd # Slackware build script for cyrus-imapd
# Copyright 2010, mario <mario@slackverse.org> # Copyright 2010-2011, mario <mario@slackverse.org>
# All rights reserved. # All rights reserved.
# #
# Redistribution and use of this script, with or without modification, is # Redistribution and use of this script, with or without modification, is
@ -23,16 +23,16 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=cyrus-imapd PRGNAM=cyrus-imapd
VERSION=${VERSION:-2.3.16} VERSION=${VERSION:-2.4.8}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
# Automatically determine the architecture we're building on: PATCHES=${PATCHES:-yes}
if [ -z "$ARCH" ]; then if [ -z "$ARCH" ]; then
case "$( uname -m )" in case "$( uname -m )" in
i?86) ARCH=i486 ;; i?86) ARCH=i486 ;;
arm*) ARCH=arm ;; arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;; *) ARCH=$( uname -m ) ;;
esac esac
fi fi
@ -56,14 +56,14 @@ else
LIBDIRSUFFIX="" LIBDIRSUFFIX=""
fi fi
# Bail if user isn't valid on your system bailout() {
if ! grep -q ^cyrus: /etc/passwd ; then printf "\nYou must have a \"cyrus\" user and group to run this script.\n"
echo " You must have a cyrus user to run this script." printf "Something like this will create them:\n"
echo " # groupadd -g 238 cyrus" printf "\t# groupadd -g 238 cyrus\n\t# useradd -d /var/imap -s /bin/sh -u 238 -g 238 cyrus\n\n"
echo " # useradd -d /var/imap -s /bin/sh -u 238 -g 238 cyrus"
echo " Or something similar."
exit 1 exit 1
fi }
getent group cyrus >/dev/null || bailout
getent passwd cyrus >/dev/null || bailout
# Build with mysql database by default, sqlite/mysql/postgresql are supported # Build with mysql database by default, sqlite/mysql/postgresql are supported
DATABASE=${DATABASE:-mysql} DATABASE=${DATABASE:-mysql}
@ -89,6 +89,12 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \; -exec chmod 644 {} \;
if [ "$PATCHES" = yes ]; then
# Patches for autocreate/autosieve
patch -p1 <$CWD/patches/cyrus-imapd-2.4.4-autocreate-0.10-0-slackware.patch
patch -p1 <$CWD/patches/cyrus-imapd-2.4.4-autosieve-0.6.0.patch
fi
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \
./configure \ ./configure \
@ -105,8 +111,8 @@ CXXFLAGS="$SLKCFLAGS" \
--with-bdb-incdir=/usr/include/db4 \ --with-bdb-incdir=/usr/include/db4 \
--with-cyrus-user=cyrus \ --with-cyrus-user=cyrus \
--with-cyrus-group=cyrus \ --with-cyrus-group=cyrus \
$DATABASE \ --build=$ARCH-slackware-linux \
--build=$ARCH-slackware-linux $DATABASE
make PERL_MM_OPT='INSTALLDIRS=vendor' make PERL_MM_OPT='INSTALLDIRS=vendor'
make install DESTDIR=$PKG make install DESTDIR=$PKG
@ -133,14 +139,16 @@ find $PKG -name perllocal.pod \
| xargs rm -f | xargs rm -f
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYRIGHT README README.andrew doc/ master/conf tools/ $PKG/usr/doc/$PRGNAM-$VERSION cp -a COPYRIGHT README* doc/* master/conf tools/ $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
# Clean up the obsolete /usr/lib on 64bit systems. # Clean up the obsolete /usr/lib on 64bit systems.
if [ "$ARCH" = "x86_64" ]; then [ "$ARCH" = "x86_64" ] && rmdir $PKG/usr/lib
rmdir $PKG/usr/lib
fi # Remove perllocal.pod and other special files; remove empty directories
find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true
find $PKG -depth -type d -empty -delete || true
mkdir -p $PKG/install mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/slack-desc > $PKG/install/slack-desc

View file

@ -1,10 +1,10 @@
PRGNAM="cyrus-imapd" PRGNAM="cyrus-imapd"
VERSION="2.3.16" VERSION="2.4.8"
HOMEPAGE="http://www.cyrusimap.org/" HOMEPAGE="http://www.cyrusimap.org/"
DOWNLOAD="ftp://ftp.cyrusimap.org/cyrus-imapd/cyrus-imapd-2.3.16.tar.gz" DOWNLOAD="ftp://ftp.cyrusimap.org/cyrus-imapd/cyrus-imapd-2.4.8.tar.gz"
MD5SUM="6a37feb1985974eee8a4a4b2932dd54c" MD5SUM="b55930293787a42d571a47f69aaacf28"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
MAINTAINER="mario" MAINTAINER="mario"
EMAIL="mario@slackverse.org" EMAIL="mario@slackverse.org"
APPROVED="michiel" APPROVED="rworkman"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,182 @@
diff -Naur cyrus-imapd-2.4.4.orig/README.autosievefolder cyrus-imapd-2.4.4/README.autosievefolder
--- cyrus-imapd-2.4.4.orig/README.autosievefolder 1970-01-01 01:00:00.000000000 +0100
+++ cyrus-imapd-2.4.4/README.autosievefolder 2010-11-15 10:40:56.299163485 +0100
@@ -0,0 +1,43 @@
+Cyrus IMAP autosievefolder patch
+----------------------------------
+
+NOTE : This patch has been created at the University of Athens. For more info, as well
+as more patches on Cyrus IMAPD server, please visit http://email.uoa.gr
+
+NOTE : Patch updated to Cyrus IMAPD 2.4.x by Martin Matuska <mm@FreeBSD.org>
+
+ When the lmtpd daemon receives an email message prior to delivering it to the
+INBOX folder of the user, checks if the user has specified sieve filters. If the
+user has specified sieve filters the filters are evaluated. If the message matches
+any of the filters the action that is specified in the filter is executed. If the action
+is FileInto it is stored in the subfolder specified in the filter. If the
+subfolder doesn't exist then the message is sent to the INBOX folder of the user.
+
+ With this patch if the folder doesn't exist AND the name of the subfolder is
+specified in the autosievefolders option, OR the anysievefolder is set to
+yes in the cyrus-imap configuration file then the subfolder is created and the mail
+is stored there.
+
+
+Check the following options of the imapd.conf file
+==================================================
+
+* anysievefolder : It must be "yes" in order to permit the autocreation of any
+INBOX subfolder requested by a sieve filter, through the "fileinto" action. (default = no)
+* autosievefolders : It is a "|" separated list of subfolders of INBOX that will be
+automatically created, if requested by a sieve filter, through the "fileinto"
+action. (default = null)
+ i.e. autosievefolders: Junk | Spam
+
+WARNING: anysievefolder, takes precedence over autosievefolders . Which means that if
+anysievefolder is set to "yes", cyrus will create any INBOX subfolder requested, no-matter what the value of autosievefolders is.
+
+
+Things to be done
+=================
+
+1. Support cyrus wildcards in the autosievefolders option.
+
+
+For more information and updates please visit http://email.uoa.gr/projects/cyrus/autosievefolder
+
diff -Naur cyrus-imapd-2.4.4.orig/imap/lmtp_sieve.c cyrus-imapd-2.4.4/imap/lmtp_sieve.c
--- cyrus-imapd-2.4.4.orig/imap/lmtp_sieve.c 2010-11-11 23:15:33.000000000 +0100
+++ cyrus-imapd-2.4.4/imap/lmtp_sieve.c 2010-11-15 10:40:13.127210740 +0100
@@ -88,6 +88,9 @@
struct auth_state *authstate;
} script_data_t;
+static int autosieve_subfolder(char *userid, struct auth_state *auth_state,
+ char *subfolder, struct namespace *namespace);
+
static char *make_sieve_db(const char *user)
{
static char buf[MAX_MAILBOX_PATH+1];
@@ -496,7 +499,20 @@
sd->username, mdata->notifyheader,
namebuf, quotaoverride, 0);
}
-
+
+ if (ret == IMAP_MAILBOX_NONEXISTENT) {
+ /* if "plus" folder under INBOX, then try to create it */
+ ret = autosieve_subfolder((char *) sd->username, sd->authstate, namebuf, mdata->namespace);
+
+ /* Try to deliver the mail again. */
+ if (!ret)
+ ret = deliver_mailbox(md->f, mdata->content, mdata->stage, md->size,
+ fc->imapflags->flag, fc->imapflags->nflags,
+ (char *) sd->username, sd->authstate, md->id,
+ sd->username, mdata->notifyheader,
+ namebuf, quotaoverride, 0);
+ }
+
if (!ret) {
snmp_increment(SIEVE_FILEINTO, 1);
return SIEVE_OK;
@@ -947,3 +963,80 @@
we'll do normal delivery */
return r;
}
+
+
+#define SEP '|'
+
+static int autosieve_subfolder(char *userid, struct auth_state *auth_state,
+ char *subfolder, struct namespace *namespace)
+{
+ char option_name_external[MAX_MAILBOX_NAME + 1];
+ char option_name_internal[MAX_MAILBOX_NAME + 1];
+ const char *subf ;
+ char *p, *q, *next_subf;
+ int len, r = 0;
+ int createsievefolder = 0;
+
+ /* Check if subfolder or userid are NULL */
+ if(userid == NULL || subfolder == NULL)
+ return IMAP_MAILBOX_NONEXISTENT;
+
+ syslog(LOG_DEBUG, "autosievefolder: autosieve_subfolder() was called for user %s, folder %s",
+ userid, subfolder);
+
+ if (config_getswitch(IMAPOPT_ANYSIEVEFOLDER)) {
+ createsievefolder = 1;
+ } else if ((subf = config_getstring(IMAPOPT_AUTOSIEVEFOLDERS)) != NULL) {
+ /* Roll through subf */
+ next_subf = (char *) subf;
+ while (*next_subf) {
+ for (p = next_subf ; isspace((int) *p) || *p == SEP ; p++);
+ for (next_subf = p ; *next_subf && *next_subf != SEP ; next_subf++);
+ for (q = next_subf ; q > p && (isspace((int) *q) || *q == SEP || !*q); q--);
+
+ if (!*p) continue;
+
+ len = q - p + 1;
+ /*
+ * This is a preliminary length check based on the assumption
+ * that the *final* internal format will be something
+ * like user.userid.subfolder(s).
+ */
+ if (len > sizeof(option_name_external) - strlen(userid) - 5)
+ return IMAP_MAILBOX_BADNAME;
+
+ strlcpy(option_name_external, namespace->prefix[NAMESPACE_INBOX], sizeof(option_name_external));
+ strncat(option_name_external, p, len);
+
+ /*
+ * Transform the option folder name to internal namespace and compare it
+ * with what must be created.
+ */
+ r = namespace->mboxname_tointernal(namespace, option_name_external, userid, option_name_internal);
+ if (r) continue;
+
+ if (!strcmp(option_name_internal, subfolder)) {
+ createsievefolder = 1;
+ break;
+ }
+ }
+ }
+
+ if (createsievefolder) {
+ /* Folder is already in internal namespace format */
+ r = mboxlist_createmailbox(subfolder, 0, NULL,
+ 1, userid, auth_state, 0, 0, 0);
+ if (!r) {
+ mboxlist_changesub(subfolder, userid, auth_state, 1, 1);
+ syslog(LOG_DEBUG, "autosievefolder: User %s, folder %s creation succeeded",
+ userid, subfolder);
+ return 0;
+ } else {
+ syslog(LOG_ERR, "autosievefolder: User %s, folder %s creation failed. %s",
+ userid, subfolder,error_message(r));
+ return r;
+ }
+ } else
+ return IMAP_MAILBOX_NONEXISTENT;
+}
+
diff -Naur cyrus-imapd-2.4.4.orig/lib/imapoptions cyrus-imapd-2.4.4/lib/imapoptions
--- cyrus-imapd-2.4.4.orig/lib/imapoptions 2010-11-11 23:15:33.000000000 +0100
+++ cyrus-imapd-2.4.4/lib/imapoptions 2010-11-15 10:40:13.129220481 +0100
@@ -1096,6 +1096,15 @@
/* If enabled, lmtpd will look for Sieve scripts in user's home
directories: ~user/.sieve. */
+{ "anysievefolder", 0, SWITCH }
+/* It must be "yes" in order to permit the autocreation of any INBOX subfolder
+ requested by a sieve filter, through the "fileinto" action. (default = no) */
+
+{ "autosievefolders", NULL, STRING }
+/* It is a "|" separated list of subfolders of INBOX that will be automatically created,
+ if requested by a sieve filter, through the "fileinto" action. (default = null)
+ i.e. autosievefolders: Junk | Spam */
+
{ "singleinstancestore", 1, SWITCH }
/* If enabled, imapd, lmtpd and nntpd attempt to only write one copy
of a message per partition and create hard links, resulting in a