ports/65320: [PATCH] add support for cyrus mailbox lookup to ports/mail/sendmail

Michael O. Boev mike at tric.tomsk.gov.ru
Thu Apr 8 11:10:23 UTC 2004


>Number:         65320
>Category:       ports
>Synopsis:       add support for cyrus mailbox lookup to ports/mail/sendmail
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 08 04:10:22 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Michael O. Boev
>Release:        FreeBSD 4.9-RELEASE-p4 i386
>Organization:
Tomsk Regional Information Center
>Environment:
System: FreeBSD isrv.tric.ru 4.9-RELEASE-p4 FreeBSD 4.9-RELEASE-p4 #1: Mon
Mar 29 15:48:23 NOVST 2004 root at isrv.tric.ru:/usr/obj/usr/src/sys/ISRV i386

>Description:
	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
>How-To-Repeat:

>Fix:
Please apply the following diff. I know it will be wrapped by my mailer,
so a backup is at
http://tric.ru/users/mike/20040408/sendmail.port

The diff is:
1. Makefile now has an extra option SENDMAIL_WITH_CYRUSLOOKUP, dependant
on SENDMAIL_WITH_SOCKETMAP.
2. Extra patch, activated by this option. The patch adds 3 lines to proto.m4
and two files to cf/feature/
3. A howto file, files/CYRUS_LOOKUP, for a quick configuration procedure
for those using default Cyrus installation from ports.

--- sendmail.port begins here ---
diff -ruN sendmail.orig/Makefile sendmail/Makefile
--- sendmail.orig/Makefile	Mon Mar 29 21:27:10 2004
+++ sendmail/Makefile	Thu Apr  8 17:12:57 2004
@@ -52,6 +52,7 @@
 # SENDMAIL_WITH_SOCKETMAP=yes
 # SENDMAIL_WITH_PICKY_HELO_CHECK=yes
 # SENDMAIL_WITH_CONNECTION_RATE=yes
+# SENDMAIL_WITH_CYRUSLOOKUP=yes

 .if defined(SENDMAIL_WITH_SMTPS)
 .if !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS)
@@ -103,6 +104,14 @@
 .else
 CONFLICTS+=	sendmail*+sasl2*-8.*
 .endif
+.if defined(SENDMAIL_WITH_CYRUSLOOKUP)
+.if !defined(SENDMAIL_WITH_SOCKETMAP)
+SENDMAIL_WITH_SOCKETMAP=yes
+pre-configure:
+	@${ECHO_CMD} "DEPENDENCY NOTE: SENDMAIL_WITH_SOCKETMAP will be enabled to
support SENDMAIL_WITH_CYRUSLOOKUP"
+.endif
+EXTRA_PATCHES+=	${FILESDIR}/cyruslookup.patch
+.endif
 .if defined(SENDMAIL_WITH_SOCKETMAP)
 EXTRA_PATCHES+=	${FILESDIR}/socketmap.patch
 .endif
@@ -222,6 +231,9 @@
 .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

@@ -260,7 +272,7 @@
 	${INSTALL_MAN} ${WRKSRC}/*/${i} ${MANPREFIX}/man/man1
 .endfor
 	${MKDIR} ${PREFIX}/share/sendmail
-	@${TAR} -C ${WRKSRC} -cf - cf | \
+	@${TAR} -C ${WRKSRC} --exclude '*.orig' -cf - cf | \
 		${TAR} -C ${PREFIX}/share/sendmail -xf -
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}
@@ -280,6 +292,9 @@
 .if defined(SENDMAIL_WITH_CONNECTION_RATE)
 	${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)
diff -ruN sendmail.orig/files/CYRUS_LOOKUP sendmail/files/CYRUS_LOOKUP
--- sendmail.orig/files/CYRUS_LOOKUP	Thu Jan  1 07:00:00 1970
+++ sendmail/files/CYRUS_LOOKUP	Thu Apr  8 17:28:42 2004
@@ -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 at tric.ru.
diff -ruN sendmail.orig/files/cyruslookup.patch
sendmail/files/cyruslookup.patch
--- sendmail.orig/files/cyruslookup.patch	Thu Jan  1 07:00:00 1970
+++ sendmail/files/cyruslookup.patch	Thu Apr  8 15:56:24 2004
@@ -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
--- sendmail.port ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list