- add support for cyrus mailbox lookup

This offers completed support for realtime address verification
against Cyrus IMAP server, complementing the PR # ports/64566.
Files and idea by Andrzej Filip. Details and updates can be found at
http://anfi.webhop.net/sendmail/rtcyrus2.html
PR:		65320
Submitted by:	Michael O. Boev

- fix duplicate "pre-configure" target.
- keep originals of modififed cf files, submission/65320 breaks packaging
This commit is contained in:
Dirk Meyer 2004-04-11 06:23:18 +00:00
parent 40fbadaa37
commit 5b6b83339d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=106717
6 changed files with 444 additions and 8 deletions

View file

@ -50,15 +50,17 @@ PKGMESSAGE= ${WRKSRC}/pkg-message
# SENDMAIL_WITH_SASL2=yes
# SENDMAIL_WITH_LDAP=yes
# SENDMAIL_WITH_SOCKETMAP=yes
# SENDMAIL_WITH_CYRUSLOOKUP=yes
# SENDMAIL_WITH_PICKY_HELO_CHECK=yes
# SENDMAIL_WITH_CONNECTION_RATE=yes
.if defined(SENDMAIL_WITH_SMTPS)
.if !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS)
.if defined(SENDMAIL_WITH_SMTPS) && !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS)
SENDMAIL_WITH_TLS=yes
pre-configure:
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_TLS will be enabled to support SENDMAIL_WITH_SMTPS"
AUTO_ENABLED_TLS=yes
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP) && !defined(SENDMAIL_WITH_SOCKETMAP)
SENDMAIL_WITH_SOCKETMAP=yes
AUTO_ENABLED_SOCKETMAP=yes
.endif
.if defined(SENDMAIL_WITH_LDAP)
@ -106,6 +108,9 @@ CONFLICTS+= sendmail*+sasl2*-8.*
.if defined(SENDMAIL_WITH_SOCKETMAP)
EXTRA_PATCHES+= ${FILESDIR}/socketmap.patch
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
EXTRA_PATCHES+= ${FILESDIR}/cyruslookup.patch
.endif
.if defined(SENDMAIL_WITH_TLS) || defined(WITH_TLS)
TLS_SUFFIX?= +tls
CONFLICTS+= sendmail+sasl-8.* \
@ -160,6 +165,14 @@ post-extract:
-e "s=%%PORTSDIR%%=${PORTSDIR}=g" \
${PKGDIR}/pkg-message > ${WRKSRC}/pkg-message
pre-configure:
.if defined(AUTO_ENABLED_TLS)
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_TLS will be enabled to support SENDMAIL_WITH_SMTPS"
.endif
.if defined(AUTO_ENABLED_SOCKETMAP)
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_SOCKETMAP will be enabled to support SENDMAIL_WITH_CYRUSLOOKUP"
.endif
do-configure:
@${MV} ${WRKSRC}/devtools/OS/FreeBSD ${WRKSRC}/devtools/OS/FreeBSD.sed
${SED} -e "s;\`-pthread\';\`${PTHREAD_LIBS}\';" \
@ -221,6 +234,9 @@ pre-install:
.endfor
.if defined(SENDMAIL_WITH_CONNECTION_RATE)
@${ECHO_CMD} "share/doc/sendmail/CONNECTION_RATE_CONTROL" >>${PLIST}
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
@${ECHO_CMD} "share/doc/sendmail/CYRUS_LOOKUP" >>${PLIST}
.endif
@${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST}
.endif
@ -281,6 +297,9 @@ post-install:
${INSTALL_DATA} ${FILESDIR}/CONNECTION_RATE_CONTROL \
${DOCSDIR}/CONNECTION_RATE_CONTROL
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
${INSTALL_DATA} ${FILESDIR}/CYRUS_LOOKUP ${DOCSDIR}/CYRUS_LOOKUP
.endif
.endif
.if exists(${DESTDIR}/etc/mail/mailer.conf)
@${CAT} ${PKGMESSAGE}

View file

@ -0,0 +1,80 @@
CYRUS MAILBOX LOOKUP FOR SENDMAIL
---------------------------------
You have enabled modifications for sendmail for looking up
whether a cyrus (2.2.3+) mailbox exists and is under quota
before accepting any mail to be relayed to cyrus.
They are based on the idea and work by
Andrzej Filip
published at
http://anfi.homeunix.net/sendmail/rtcyrus2.html.
Please, use this url to learn all configuration details
(although a quick recipe is provided below) and may be to give
credits to the author.
******************************************************************
HOW TO :
---------
0. Build the `mail/sendmail' sendmail port with
SENDMAIL_WITH_SOCKETMAP=yes SENDMAIL_WITH_CYRUSLOOKUP=yes
This is what you've just obviously done, unless you are just browsing the
ports tree. To stick with these settings, you can place something like
the following in your `/etc/make.conf'.
PORTSDIR?= /usr/ports
.if ${.CURDIR} == ${PORTSDIR}/mail/sendmail
SENDMAIL_WITH_CYRUSLOOKUP= yes
SENDMAIL_WITH_SOCKETMAP= yes
# possibly other sendmail knobs here too.
.endif
You should have also installed and configured Cyrus IMAP server,
version 2.2.3 or higher. Not the worst idea is to utilize the
`mail/cyrus-imapd22' port.
1. Insert the following lines to the SERVICES sections of `cyrus.conf'.
By default, the port installs it to `/usr/local/etc'.
# Sendmail socket map smmapd(8)
smmap cmd="smmapd" listen="/var/imap/socket/smmapd" prefork=0
A SIGHUP would make the Cyrus master(8) process catch this change
on-the-fly. Please, also note, that if sendmail and cyrus run on
separate machines, you will obviously need to modify this line
and a couple of others.
2. As per the `install-configure' from Cyrus IMAP server's documentation,
in the simplest case, you add:
define(`confLOCAL_MAILER', `cyrusv2')dnl
MAILER(`cyrusv2')dnl
to your sendmail's .mc file to make local delivery to Cyrus mailboxes.
Per the instructions, provided by Andrzej Filip (see the above URL),
these lines should become:
define(`LOCAL_RELAY',`mrs_cyrus_user:stripdom')dnl
FEATURE(`mrs')dnl
FEATURE(`mrs_cyrus')dnl
MODIFY_MAILER_FLAGS(`CYRUSV2',`-A5')dnl
MAILER(`cyrusv2')dnl
for sendmail to start rejecting local addresses for nonexisting and
full mailboxes. Rebuild your sendmail.cf, restart sendmail, and enjoy!
If your configuration is more complicated than the above two lines,
read Andrzej's article. It contains more examples.
******************************************************************
2004, April 8th
Michael O. Boev,
mike@tric.ru.

View file

@ -0,0 +1,119 @@
*** cf/m4/proto.m4 2004/03/09 15:49:38 1.1
--- cf/m4/proto.m4 2004/03/10 20:29:48
***************
*** 1299,1304 ****
--- 1299,1307 ----
R< error : $- : $+ > $* $#error $@ $(dequote $1 $) $: $2
R< error : $+ > $* $#error $: $1
R< local : $* > $* $>CanonLocal < $1 > $2
+ ifdef(`_MRS_RELAY_',`dnl
+ R< $={MRS} : $* > $* $@ $> $1 < $2 > $3
+ dnl')
dnl it is $~[ instead of $- to avoid matches on IPv6 addresses
R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
--- /dev/null Wed Apr 7 20:03:20 2004
+++ cf/feature/mrs.m4 Tue Mar 23 14:00:30 2004
@@ -0,0 +1,25 @@
+divert(-1)
+dnl
+dnl Updates: http://anfi.webhop.net/sendmail/mrs.html
+dnl
+dnl By using this file, you agree to the terms and conditions set
+dnl forth in the LICENSE file which can be found at the top level of
+dnl the sendmail distribution (sendmail-8.12).
+dnl
+dnl Contributed by Andrzej Filip
+dnl
+dnl THE FEATURE REQUIRES PATCHING cf/m4/proto.m4
+dnl SEE THE LINK AFTER "Updates:"
+dnl
+dnl $Log: mrs.m4,v $
+dnl Revision 8.3 2004/03/18 21:39:22 anfi
+dnl Changed comments prefixes to dnl to avoid m4 expansions
+dnl
+dnl Revision 8.2 2004/03/15 09:14:28 anfi
+dnl Added "Updates:" web link.
+dnl
+divert(0)
+VERSIONID(`$Id: mrs.m4,v 8.3 2004/03/18 21:39:22 anfi Exp $')
+divert(-1)
+
+define(`_MRS_RELAY_', `')
--- /dev/null Thu Apr 8 15:55:21 2004
+++ cf/feature/mrs_cyrus.m4 Thu Apr 1 21:37:05 2004
@@ -0,0 +1,74 @@
+divert(-1)
+dnl
+dnl Updates: http://anfi.webhop.net/sendmail/rtcyrus2.html
+dnl
+dnl By using this file, you agree to the terms and conditions set
+dnl forth in the LICENSE file which can be found at the top level of
+dnl the sendmail distribution (sendmail-8.12).
+dnl
+dnl Contributed by Andrzej Filip
+dnl
+dnl $Log: mrs_cyrus.m4,v $
+dnl Revision 8.7 2004/04/01 14:29:50 anfi
+dnl Added "stripdom" handling in mrs_cyrus_user.
+dnl Fully defined error mailer details.
+dnl
+dnl Revision 8.6 2004/03/18 23:17:57 anfi
+dnl Fundamental rewrite.
+dnl
+ifdef(`_MRS_RELAY_',`',
+ `errprint(`*** ERROR: FEATURE(mrs_cyrus) requires FEATURE(mrs)
+')')
+ifdef(`_MRS_CYRUS_',
+ `errprint(`*** ERROR: There can be only one FEATURE(mrs_cyrus*)
+')')
+define(`_MRS_CYRUS_',`')
+
+divert(0)
+VERSIONID(`$Id: mrs_cyrus.m4,v 8.7 2004/04/01 14:29:50 anfi Exp $')
+divert(-1)
+define(`CYRUS_SMMAPD_SOCKET',
+ ifelse(len(X`'_ARG_), `1', `/var/imap/socket/smmapd', _ARG_))
+define(`CYRUS_SMMAPD_SOCKET_TYPE',
+ ifelse(len(X`'_ARG2_), `1', `local', _ARG2_))
+LOCAL_CONFIG
+# Add 3 mrs_cyrus rule sets to list of valid mrs rule sets
+C{MRS}mrs_cyrus_user mrs_cyrus_mailertable mrs_cyrus_stickyhub
+# map for checking cyrus imap mailbox existence
+Kcyrus socket -a<OK> -T<TMPF> CYRUS_SMMAPD_SOCKET_TYPE:CYRUS_SMMAPD_SOCKET
+
+LOCAL_RULESETS
+######################################################################
+### feature mrs_cyrus rulesets to be used by feature mrs
+######################################################################
+
+Smrs_cyrus_user
+R<$*> $+ <@$+.> $: <$1> $2 <@ $3 >
+R<$*> $+ <@$*> $: <$1> $2 <@$3> $| $(cyrus $2 $: $)
+R<$*> $+ <@$*> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<$*> $+ <@$*> $| $* <OK> $# cyrusv2 $@ dummy $: $4
+R<$*> $+ <@$*> $| $* $: <$1> $2 <@$3>
+R<stripdom> $+ <@stripdom> $@ $1
+R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3
+R< $+ > $* $>MailerToTriple < $1 > $2
+R< > $* $# error $@ 5.1.1 $: "550 User unknown"
+
+Smrs_cyrus_mailertable
+R<$*> $+ <@$+.> $: <$1> $2 <@ $3 >
+R<$*> $+ <@$+> $: <$1> $2 <@$3> $| $(cyrus $2@$3 $: $)
+R<$*> $+ <@$+> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<$*> $+ <@$+> $| $* <OK> $# cyrusv2d $@ dummy $: $2 <@$3>
+R<$*> $+ <@$*> $| $* $: <$1> $2 <@$3>
+R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3
+R< $+ > $* $>MailerToTriple < $1 > $2
+R< > $* $# error $@ 5.1.1 $: "550 User unknown"
+
+Smrs_cyrus_stickyhub
+R<dummy> $+ <@$+.> $: <dummy> $1 <@ $2 >
+R<dummy> $* <@dummy> $@ $1
+R<dummy> $+ <@$={VirtCyrus}> $: <dummy> $1 <@$2> $| $(cyrus $1@$2 $: $)
+R<dummy> $+ <@$={VirtCyrus}> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<dummy> $+ <@$={VirtCyrus}> $| $* <OK> $# cyrusv2d $@ dummy $: $1 <@$2>
+R<dummy> $+ <@$={VirtCyrus}> $| $* $# error $@ 5.1.1 $: "550 User unknown"
+R<dummy> $=L <@$*> $# ifdef(`confLOCAL_MAILER',confLOCAL_MAILER,`local') $: @$1
+R<dummy> $* <@$*> $# ifdef(`confLOCAL_MAILER',confLOCAL_MAILER,`local') $: $1

View file

@ -50,15 +50,17 @@ PKGMESSAGE= ${WRKSRC}/pkg-message
# SENDMAIL_WITH_SASL2=yes
# SENDMAIL_WITH_LDAP=yes
# SENDMAIL_WITH_SOCKETMAP=yes
# SENDMAIL_WITH_CYRUSLOOKUP=yes
# SENDMAIL_WITH_PICKY_HELO_CHECK=yes
# SENDMAIL_WITH_CONNECTION_RATE=yes
.if defined(SENDMAIL_WITH_SMTPS)
.if !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS)
.if defined(SENDMAIL_WITH_SMTPS) && !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS)
SENDMAIL_WITH_TLS=yes
pre-configure:
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_TLS will be enabled to support SENDMAIL_WITH_SMTPS"
AUTO_ENABLED_TLS=yes
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP) && !defined(SENDMAIL_WITH_SOCKETMAP)
SENDMAIL_WITH_SOCKETMAP=yes
AUTO_ENABLED_SOCKETMAP=yes
.endif
.if defined(SENDMAIL_WITH_LDAP)
@ -106,6 +108,9 @@ CONFLICTS+= sendmail*+sasl2*-8.*
.if defined(SENDMAIL_WITH_SOCKETMAP)
EXTRA_PATCHES+= ${FILESDIR}/socketmap.patch
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
EXTRA_PATCHES+= ${FILESDIR}/cyruslookup.patch
.endif
.if defined(SENDMAIL_WITH_TLS) || defined(WITH_TLS)
TLS_SUFFIX?= +tls
CONFLICTS+= sendmail+sasl-8.* \
@ -160,6 +165,14 @@ post-extract:
-e "s=%%PORTSDIR%%=${PORTSDIR}=g" \
${PKGDIR}/pkg-message > ${WRKSRC}/pkg-message
pre-configure:
.if defined(AUTO_ENABLED_TLS)
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_TLS will be enabled to support SENDMAIL_WITH_SMTPS"
.endif
.if defined(AUTO_ENABLED_SOCKETMAP)
@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_SOCKETMAP will be enabled to support SENDMAIL_WITH_CYRUSLOOKUP"
.endif
do-configure:
@${MV} ${WRKSRC}/devtools/OS/FreeBSD ${WRKSRC}/devtools/OS/FreeBSD.sed
${SED} -e "s;\`-pthread\';\`${PTHREAD_LIBS}\';" \
@ -221,6 +234,9 @@ pre-install:
.endfor
.if defined(SENDMAIL_WITH_CONNECTION_RATE)
@${ECHO_CMD} "share/doc/sendmail/CONNECTION_RATE_CONTROL" >>${PLIST}
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
@${ECHO_CMD} "share/doc/sendmail/CYRUS_LOOKUP" >>${PLIST}
.endif
@${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST}
.endif
@ -281,6 +297,9 @@ post-install:
${INSTALL_DATA} ${FILESDIR}/CONNECTION_RATE_CONTROL \
${DOCSDIR}/CONNECTION_RATE_CONTROL
.endif
.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
${INSTALL_DATA} ${FILESDIR}/CYRUS_LOOKUP ${DOCSDIR}/CYRUS_LOOKUP
.endif
.endif
.if exists(${DESTDIR}/etc/mail/mailer.conf)
@${CAT} ${PKGMESSAGE}

View file

@ -0,0 +1,80 @@
CYRUS MAILBOX LOOKUP FOR SENDMAIL
---------------------------------
You have enabled modifications for sendmail for looking up
whether a cyrus (2.2.3+) mailbox exists and is under quota
before accepting any mail to be relayed to cyrus.
They are based on the idea and work by
Andrzej Filip
published at
http://anfi.homeunix.net/sendmail/rtcyrus2.html.
Please, use this url to learn all configuration details
(although a quick recipe is provided below) and may be to give
credits to the author.
******************************************************************
HOW TO :
---------
0. Build the `mail/sendmail' sendmail port with
SENDMAIL_WITH_SOCKETMAP=yes SENDMAIL_WITH_CYRUSLOOKUP=yes
This is what you've just obviously done, unless you are just browsing the
ports tree. To stick with these settings, you can place something like
the following in your `/etc/make.conf'.
PORTSDIR?= /usr/ports
.if ${.CURDIR} == ${PORTSDIR}/mail/sendmail
SENDMAIL_WITH_CYRUSLOOKUP= yes
SENDMAIL_WITH_SOCKETMAP= yes
# possibly other sendmail knobs here too.
.endif
You should have also installed and configured Cyrus IMAP server,
version 2.2.3 or higher. Not the worst idea is to utilize the
`mail/cyrus-imapd22' port.
1. Insert the following lines to the SERVICES sections of `cyrus.conf'.
By default, the port installs it to `/usr/local/etc'.
# Sendmail socket map smmapd(8)
smmap cmd="smmapd" listen="/var/imap/socket/smmapd" prefork=0
A SIGHUP would make the Cyrus master(8) process catch this change
on-the-fly. Please, also note, that if sendmail and cyrus run on
separate machines, you will obviously need to modify this line
and a couple of others.
2. As per the `install-configure' from Cyrus IMAP server's documentation,
in the simplest case, you add:
define(`confLOCAL_MAILER', `cyrusv2')dnl
MAILER(`cyrusv2')dnl
to your sendmail's .mc file to make local delivery to Cyrus mailboxes.
Per the instructions, provided by Andrzej Filip (see the above URL),
these lines should become:
define(`LOCAL_RELAY',`mrs_cyrus_user:stripdom')dnl
FEATURE(`mrs')dnl
FEATURE(`mrs_cyrus')dnl
MODIFY_MAILER_FLAGS(`CYRUSV2',`-A5')dnl
MAILER(`cyrusv2')dnl
for sendmail to start rejecting local addresses for nonexisting and
full mailboxes. Rebuild your sendmail.cf, restart sendmail, and enjoy!
If your configuration is more complicated than the above two lines,
read Andrzej's article. It contains more examples.
******************************************************************
2004, April 8th
Michael O. Boev,
mike@tric.ru.

View file

@ -0,0 +1,119 @@
*** cf/m4/proto.m4 2004/03/09 15:49:38 1.1
--- cf/m4/proto.m4 2004/03/10 20:29:48
***************
*** 1299,1304 ****
--- 1299,1307 ----
R< error : $- : $+ > $* $#error $@ $(dequote $1 $) $: $2
R< error : $+ > $* $#error $: $1
R< local : $* > $* $>CanonLocal < $1 > $2
+ ifdef(`_MRS_RELAY_',`dnl
+ R< $={MRS} : $* > $* $@ $> $1 < $2 > $3
+ dnl')
dnl it is $~[ instead of $- to avoid matches on IPv6 addresses
R< $~[ : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
R< $~[ : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
--- /dev/null Wed Apr 7 20:03:20 2004
+++ cf/feature/mrs.m4 Tue Mar 23 14:00:30 2004
@@ -0,0 +1,25 @@
+divert(-1)
+dnl
+dnl Updates: http://anfi.webhop.net/sendmail/mrs.html
+dnl
+dnl By using this file, you agree to the terms and conditions set
+dnl forth in the LICENSE file which can be found at the top level of
+dnl the sendmail distribution (sendmail-8.12).
+dnl
+dnl Contributed by Andrzej Filip
+dnl
+dnl THE FEATURE REQUIRES PATCHING cf/m4/proto.m4
+dnl SEE THE LINK AFTER "Updates:"
+dnl
+dnl $Log: mrs.m4,v $
+dnl Revision 8.3 2004/03/18 21:39:22 anfi
+dnl Changed comments prefixes to dnl to avoid m4 expansions
+dnl
+dnl Revision 8.2 2004/03/15 09:14:28 anfi
+dnl Added "Updates:" web link.
+dnl
+divert(0)
+VERSIONID(`$Id: mrs.m4,v 8.3 2004/03/18 21:39:22 anfi Exp $')
+divert(-1)
+
+define(`_MRS_RELAY_', `')
--- /dev/null Thu Apr 8 15:55:21 2004
+++ cf/feature/mrs_cyrus.m4 Thu Apr 1 21:37:05 2004
@@ -0,0 +1,74 @@
+divert(-1)
+dnl
+dnl Updates: http://anfi.webhop.net/sendmail/rtcyrus2.html
+dnl
+dnl By using this file, you agree to the terms and conditions set
+dnl forth in the LICENSE file which can be found at the top level of
+dnl the sendmail distribution (sendmail-8.12).
+dnl
+dnl Contributed by Andrzej Filip
+dnl
+dnl $Log: mrs_cyrus.m4,v $
+dnl Revision 8.7 2004/04/01 14:29:50 anfi
+dnl Added "stripdom" handling in mrs_cyrus_user.
+dnl Fully defined error mailer details.
+dnl
+dnl Revision 8.6 2004/03/18 23:17:57 anfi
+dnl Fundamental rewrite.
+dnl
+ifdef(`_MRS_RELAY_',`',
+ `errprint(`*** ERROR: FEATURE(mrs_cyrus) requires FEATURE(mrs)
+')')
+ifdef(`_MRS_CYRUS_',
+ `errprint(`*** ERROR: There can be only one FEATURE(mrs_cyrus*)
+')')
+define(`_MRS_CYRUS_',`')
+
+divert(0)
+VERSIONID(`$Id: mrs_cyrus.m4,v 8.7 2004/04/01 14:29:50 anfi Exp $')
+divert(-1)
+define(`CYRUS_SMMAPD_SOCKET',
+ ifelse(len(X`'_ARG_), `1', `/var/imap/socket/smmapd', _ARG_))
+define(`CYRUS_SMMAPD_SOCKET_TYPE',
+ ifelse(len(X`'_ARG2_), `1', `local', _ARG2_))
+LOCAL_CONFIG
+# Add 3 mrs_cyrus rule sets to list of valid mrs rule sets
+C{MRS}mrs_cyrus_user mrs_cyrus_mailertable mrs_cyrus_stickyhub
+# map for checking cyrus imap mailbox existence
+Kcyrus socket -a<OK> -T<TMPF> CYRUS_SMMAPD_SOCKET_TYPE:CYRUS_SMMAPD_SOCKET
+
+LOCAL_RULESETS
+######################################################################
+### feature mrs_cyrus rulesets to be used by feature mrs
+######################################################################
+
+Smrs_cyrus_user
+R<$*> $+ <@$+.> $: <$1> $2 <@ $3 >
+R<$*> $+ <@$*> $: <$1> $2 <@$3> $| $(cyrus $2 $: $)
+R<$*> $+ <@$*> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<$*> $+ <@$*> $| $* <OK> $# cyrusv2 $@ dummy $: $4
+R<$*> $+ <@$*> $| $* $: <$1> $2 <@$3>
+R<stripdom> $+ <@stripdom> $@ $1
+R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3
+R< $+ > $* $>MailerToTriple < $1 > $2
+R< > $* $# error $@ 5.1.1 $: "550 User unknown"
+
+Smrs_cyrus_mailertable
+R<$*> $+ <@$+.> $: <$1> $2 <@ $3 >
+R<$*> $+ <@$+> $: <$1> $2 <@$3> $| $(cyrus $2@$3 $: $)
+R<$*> $+ <@$+> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<$*> $+ <@$+> $| $* <OK> $# cyrusv2d $@ dummy $: $2 <@$3>
+R<$*> $+ <@$*> $| $* $: <$1> $2 <@$3>
+R< $~[ : $* > $* $>MailerToTriple < $1 : $2 > $3
+R< $+ > $* $>MailerToTriple < $1 > $2
+R< > $* $# error $@ 5.1.1 $: "550 User unknown"
+
+Smrs_cyrus_stickyhub
+R<dummy> $+ <@$+.> $: <dummy> $1 <@ $2 >
+R<dummy> $* <@dummy> $@ $1
+R<dummy> $+ <@$={VirtCyrus}> $: <dummy> $1 <@$2> $| $(cyrus $1@$2 $: $)
+R<dummy> $+ <@$={VirtCyrus}> $| $* <TMPF> $# error $@ 4.3.0 $: "451 Temporary system failure. Please try again later."
+R<dummy> $+ <@$={VirtCyrus}> $| $* <OK> $# cyrusv2d $@ dummy $: $1 <@$2>
+R<dummy> $+ <@$={VirtCyrus}> $| $* $# error $@ 5.1.1 $: "550 User unknown"
+R<dummy> $=L <@$*> $# ifdef(`confLOCAL_MAILER',confLOCAL_MAILER,`local') $: @$1
+R<dummy> $* <@$*> $# ifdef(`confLOCAL_MAILER',confLOCAL_MAILER,`local') $: $1