diff options
author | roam <roam@FreeBSD.org> | 2003-11-01 01:24:01 +0800 |
---|---|---|
committer | roam <roam@FreeBSD.org> | 2003-11-01 01:24:01 +0800 |
commit | 331b8be0dcebf5223029941e8267f644b932e2ec (patch) | |
tree | 97fe4c12bd473dbb4cabb3d56c2bbc52d66d5cae | |
parent | f7f4fdebb28087fd69da3667f952b989775ae663 (diff) | |
download | freebsd-ports-gnome-331b8be0dcebf5223029941e8267f644b932e2ec.tar.gz freebsd-ports-gnome-331b8be0dcebf5223029941e8267f644b932e2ec.tar.zst freebsd-ports-gnome-331b8be0dcebf5223029941e8267f644b932e2ec.zip |
Add Alex Dupre's patch for SpamAssassin integration, conditional
on the WITH_SPAMASSASSIN knob.
PR: 58503
Submitted by: Alex Dupre <sysadmin@alexdupre.com>
-rw-r--r-- | mail/vpopmail-devel/Makefile | 66 | ||||
-rw-r--r-- | mail/vpopmail-devel/files/patch-config.h.in | 12 | ||||
-rw-r--r-- | mail/vpopmail-devel/files/patch-configure | 47 | ||||
-rw-r--r-- | mail/vpopmail-devel/files/patch-vdelivermail.c | 45 | ||||
-rw-r--r-- | mail/vpopmail/Makefile | 66 | ||||
-rw-r--r-- | mail/vpopmail/files/patch-config.h.in | 12 | ||||
-rw-r--r-- | mail/vpopmail/files/patch-configure | 47 | ||||
-rw-r--r-- | mail/vpopmail/files/patch-vdelivermail.c | 45 |
8 files changed, 270 insertions, 70 deletions
diff --git a/mail/vpopmail-devel/Makefile b/mail/vpopmail-devel/Makefile index 16bf36af3ff4..98d51a4f888b 100644 --- a/mail/vpopmail-devel/Makefile +++ b/mail/vpopmail-devel/Makefile @@ -55,6 +55,7 @@ CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_DIR} \ # WITHOUT_USERS_BIG_DIR - disables using big directories for users # WITHOUT_SEEKABLE - disables vdelivermail's attempt to make its input seekable # WITH_DOMAIN_QUOTAS - enable domain quotas +# WITH_SPAMASSASSIN - enable SpamAssassin checks before Maildir delivery # # Set these to the values you'd prefer # @@ -116,6 +117,33 @@ HARDQUOTA?= 10000000 RELAYCLEAR?= 30 LOGLEVEL?= y +.if defined(WITH_MYSQL) +USE_MYSQL= yes +CONFIGURE_ARGS+= --enable-mysql=y \ + --enable-incdir=${LOCALBASE}/include/mysql \ + --enable-libdir=${LOCALBASE}/lib/mysql +.if defined(WITH_MYSQL_REPLICATION) +CONFIGURE_ARGS+= --enable-mysql-replication=y +.endif +.if defined(WITH_MYSQL_LOG) +CONFIGURE_ARGS+= --enable-mysql-logging=y +.endif +.if defined(WITH_MYSQL_LIMITS) +CONFIGURE_ARGS+= --enable-mysql-limits=y +.endif + +WITH_MYSQL_SERVER?= localhost +WITH_MYSQL_READ_SERVER?= ${WITH_MYSQL_SERVER} +WITH_MYSQL_UPDATE_SERVER?= ${WITH_MYSQL_SERVER} +WITH_MYSQL_USER?= vpopmail +WITH_MYSQL_READ_USER?= ${WITH_MYSQL_USER} +WITH_MYSQL_UPDATE_USER?= ${WITH_MYSQL_USER} +WITH_MYSQL_PASSWD?= secret +WITH_MYSQL_READ_PASSWD?= ${WITH_MYSQL_PASSWD} +WITH_MYSQL_UPDATE_PASSWD?= ${WITH_MYSQL_PASSWD} +WITH_MYSQL_DB?= vpopmail +.endif + .include <bsd.port.pre.mk> .if exists(${LOCALBASE}/qmail/bin/qmail-send) @@ -168,33 +196,6 @@ CONFIGURE_ARGS+= --enable-clear-passwd=n CONFIGURE_ARGS+= --enable-learn-passwords=y .endif -.if defined(WITH_MYSQL) -USE_MYSQL= yes -CONFIGURE_ARGS+= --enable-mysql=y \ - --enable-incdir=${LOCALBASE}/include/mysql \ - --enable-libdir=${LOCALBASE}/lib/mysql -.if defined(WITH_MYSQL_REPLICATION) -CONFIGURE_ARGS+= --enable-mysql-replication=y -.endif -.if defined(WITH_MYSQL_LOG) -CONFIGURE_ARGS+= --enable-mysql-logging=y -.endif -.if defined(WITH_MYSQL_LIMITS) -CONFIGURE_ARGS+= --enable-mysql-limits=y -.endif - -WITH_MYSQL_SERVER?= localhost -WITH_MYSQL_READ_SERVER?= ${WITH_MYSQL_SERVER} -WITH_MYSQL_UPDATE_SERVER?= ${WITH_MYSQL_SERVER} -WITH_MYSQL_USER?= vpopmail -WITH_MYSQL_READ_USER?= ${WITH_MYSQL_USER} -WITH_MYSQL_UPDATE_USER?= ${WITH_MYSQL_USER} -WITH_MYSQL_PASSWD?= secret -WITH_MYSQL_READ_PASSWD?= ${WITH_MYSQL_PASSWD} -WITH_MYSQL_UPDATE_PASSWD?= ${WITH_MYSQL_PASSWD} -WITH_MYSQL_DB?= vpopmail -.endif - .if defined(WITH_SYBASE) CONFIGURE_ARGS+= --enable-sybase=y .endif @@ -240,6 +241,11 @@ CONFIGURE_ARGS+= --enable-make-seekable=n CONFIGURE_ARGS+= --enable-domainquotas=y .endif +.if defined(WITH_SPAMASSASSIN) +BUILD_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin +CONFIGURE_ARGS+= --enable-spamassassin=${LOCALBASE}/bin/spamc +.endif + # autoconf and automake can remove our patches to the configure scripts. post-patch: @@ -309,5 +315,11 @@ post-install: >> ${PREFIX}/vpopmail/etc/vpopmail.mysql .endif ${CHOWN} -R vpopmail:vchkpw ${PREFIX}/vpopmail/bin/ ${PREFIX}/vpopmail/etc/ +.if defined(WITH_SPAMASSASSIN) + ${ECHO_CMD} "***********************************************************************" + ${ECHO_CMD} "Now you should add the following options to your spamd.sh startup file:" + ${ECHO_CMD} "-v -u vpopmail" + ${ECHO_CMD} "***********************************************************************" +.endif .include <bsd.port.post.mk> diff --git a/mail/vpopmail-devel/files/patch-config.h.in b/mail/vpopmail-devel/files/patch-config.h.in new file mode 100644 index 000000000000..f795be18e767 --- /dev/null +++ b/mail/vpopmail-devel/files/patch-config.h.in @@ -0,0 +1,12 @@ +--- config.h.in.orig Fri Oct 24 18:43:20 2003 ++++ config.h.in Fri Oct 24 18:43:45 2003 +@@ -89,6 +89,9 @@ + #undef QMAILNEWU + + /* */ ++#undef SPAMC ++ ++/* */ + #undef QMAILINJECT + + /* */ diff --git a/mail/vpopmail-devel/files/patch-configure b/mail/vpopmail-devel/files/patch-configure index dff6d39e78a5..af635b3504dc 100644 --- a/mail/vpopmail-devel/files/patch-configure +++ b/mail/vpopmail-devel/files/patch-configure @@ -1,6 +1,15 @@ ---- configure.orig Thu Aug 28 21:09:47 2003 -+++ configure Fri Sep 5 00:13:14 2003 -@@ -1317,7 +1317,7 @@ +--- configure.orig Fri Oct 17 01:12:22 2003 ++++ configure Sat Oct 25 01:18:27 2003 +@@ -20,6 +20,8 @@ + ac_help="$ac_help + --enable-qmail-newmrh=path Full path to qmail-newmrh program" + ac_help="$ac_help ++ --enable-spamassassin=path Enable SpamAssassin. Full path to spamc program. default /usr/local/bin/spamc" ++ac_help="$ac_help + --enable-vpopuser=vpopmail user vchkpw was installed as." + ac_help="$ac_help + --enable-vpopgroup=vchkpw group vchkpw was installed as." +@@ -1317,7 +1319,7 @@ ;; esac @@ -9,7 +18,35 @@ then echo "configure: warning: === vpopmail must be configured as root. ===" 1>&2 echo "configure: warning: === please switch to the root user and ===" 1>&2 -@@ -1601,15 +1601,6 @@ +@@ -1446,6 +1448,27 @@ + EOF + + ++# Check whether --enable-spamassassin or --disable-spamassassin was given. ++if test "${enable_spamassassin+set}" = set; then ++ enableval="$enable_spamassassin" ++ spamc="$enableval" ++ ++ case $spamc in ++ 1*|y*|Y*) ++ spamc="/usr/local/bin/spamc" ++ ;; ++ esac ++ ++ if test ! -f "$spamc" ++ then ++ { echo "configure: error: Unable to find your spamc file, specify --enable-spamassassin=/full/path/to/spamc" 1>&2; exit 1; } ++ fi ++ ++ cat >> confdefs.h <<EOF ++#define SPAMC "$spamc" ++EOF ++fi ++ + + vpopuser="vpopmail" + # Check whether --enable-vpopuser or --disable-vpopuser was given. +@@ -1601,15 +1624,6 @@ EOF @@ -25,7 +62,7 @@ # Check whether --enable-roaming-users or --disable-roaming-users was given. if test "${enable_roaming_users+set}" = set; then enableval="$enable_roaming_users" -@@ -1671,17 +1662,7 @@ +@@ -1671,17 +1685,7 @@ if test "${enable_tcpserver_file+set}" = set; then enableval="$enable_tcpserver_file" tcpserver_file="$enableval" diff --git a/mail/vpopmail-devel/files/patch-vdelivermail.c b/mail/vpopmail-devel/files/patch-vdelivermail.c index 106281226007..8a23e9bb5c43 100644 --- a/mail/vpopmail-devel/files/patch-vdelivermail.c +++ b/mail/vpopmail-devel/files/patch-vdelivermail.c @@ -1,6 +1,6 @@ ---- vdelivermail.c.orig Sat Nov 2 22:34:39 2002 -+++ vdelivermail.c Sat Nov 2 22:35:20 2002 -@@ -263,7 +263,7 @@ +--- vdelivermail.c.orig Mon Oct 20 20:59:57 2003 ++++ vdelivermail.c Fri Oct 24 18:31:45 2003 +@@ -257,7 +257,7 @@ /* check for wildcard if there's no match */ if(tmpstr == NULL) { @@ -9,3 +9,42 @@ if(TheUser[i-1]=='-') { tmpuser[0] = '\0'; strncat(tmpuser,TheUser,i); +@@ -444,6 +444,7 @@ + int inject = 0; + FILE *fs; + char tmp_file[256]; ++ int pim[2]; + + /* check if the email is looping to this user */ + if ( is_looping( address ) == 1 ) { +@@ -631,6 +632,30 @@ + } + } + ++#ifdef SPAMC ++ /* fork the SpamAssassin client - patch by Alex Dupre */ ++ if (!pipe(pim)) { ++ pid = vfork(); ++ switch (pid) { ++ case -1: ++ close(pim[0]); ++ close(pim[1]); ++ break; ++ case 0: ++ close(pim[0]); ++ dup2(pim[1], 1); ++ close(pim[1]); ++ if (execl(SPAMC, SPAMC, "-u", maildir_to_email(address), 0) == -1) { ++ while ((file_count=read(0, msgbuf, MSG_BUF_SIZE)) > 0) ++ write(1, msgbuf, file_count); ++ _exit(0); ++ } ++ } ++ close(pim[1]); ++ dup2(pim[0], 0); ++ close(pim[0]); ++ } ++#endif + + /* read it in chunks and write it to the new file */ + while((file_count=read(0,msgbuf,MSG_BUF_SIZE))>0) { diff --git a/mail/vpopmail/Makefile b/mail/vpopmail/Makefile index 16bf36af3ff4..98d51a4f888b 100644 --- a/mail/vpopmail/Makefile +++ b/mail/vpopmail/Makefile @@ -55,6 +55,7 @@ CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_DIR} \ # WITHOUT_USERS_BIG_DIR - disables using big directories for users # WITHOUT_SEEKABLE - disables vdelivermail's attempt to make its input seekable # WITH_DOMAIN_QUOTAS - enable domain quotas +# WITH_SPAMASSASSIN - enable SpamAssassin checks before Maildir delivery # # Set these to the values you'd prefer # @@ -116,6 +117,33 @@ HARDQUOTA?= 10000000 RELAYCLEAR?= 30 LOGLEVEL?= y +.if defined(WITH_MYSQL) +USE_MYSQL= yes +CONFIGURE_ARGS+= --enable-mysql=y \ + --enable-incdir=${LOCALBASE}/include/mysql \ + --enable-libdir=${LOCALBASE}/lib/mysql +.if defined(WITH_MYSQL_REPLICATION) +CONFIGURE_ARGS+= --enable-mysql-replication=y +.endif +.if defined(WITH_MYSQL_LOG) +CONFIGURE_ARGS+= --enable-mysql-logging=y +.endif +.if defined(WITH_MYSQL_LIMITS) +CONFIGURE_ARGS+= --enable-mysql-limits=y +.endif + +WITH_MYSQL_SERVER?= localhost +WITH_MYSQL_READ_SERVER?= ${WITH_MYSQL_SERVER} +WITH_MYSQL_UPDATE_SERVER?= ${WITH_MYSQL_SERVER} +WITH_MYSQL_USER?= vpopmail +WITH_MYSQL_READ_USER?= ${WITH_MYSQL_USER} +WITH_MYSQL_UPDATE_USER?= ${WITH_MYSQL_USER} +WITH_MYSQL_PASSWD?= secret +WITH_MYSQL_READ_PASSWD?= ${WITH_MYSQL_PASSWD} +WITH_MYSQL_UPDATE_PASSWD?= ${WITH_MYSQL_PASSWD} +WITH_MYSQL_DB?= vpopmail +.endif + .include <bsd.port.pre.mk> .if exists(${LOCALBASE}/qmail/bin/qmail-send) @@ -168,33 +196,6 @@ CONFIGURE_ARGS+= --enable-clear-passwd=n CONFIGURE_ARGS+= --enable-learn-passwords=y .endif -.if defined(WITH_MYSQL) -USE_MYSQL= yes -CONFIGURE_ARGS+= --enable-mysql=y \ - --enable-incdir=${LOCALBASE}/include/mysql \ - --enable-libdir=${LOCALBASE}/lib/mysql -.if defined(WITH_MYSQL_REPLICATION) -CONFIGURE_ARGS+= --enable-mysql-replication=y -.endif -.if defined(WITH_MYSQL_LOG) -CONFIGURE_ARGS+= --enable-mysql-logging=y -.endif -.if defined(WITH_MYSQL_LIMITS) -CONFIGURE_ARGS+= --enable-mysql-limits=y -.endif - -WITH_MYSQL_SERVER?= localhost -WITH_MYSQL_READ_SERVER?= ${WITH_MYSQL_SERVER} -WITH_MYSQL_UPDATE_SERVER?= ${WITH_MYSQL_SERVER} -WITH_MYSQL_USER?= vpopmail -WITH_MYSQL_READ_USER?= ${WITH_MYSQL_USER} -WITH_MYSQL_UPDATE_USER?= ${WITH_MYSQL_USER} -WITH_MYSQL_PASSWD?= secret -WITH_MYSQL_READ_PASSWD?= ${WITH_MYSQL_PASSWD} -WITH_MYSQL_UPDATE_PASSWD?= ${WITH_MYSQL_PASSWD} -WITH_MYSQL_DB?= vpopmail -.endif - .if defined(WITH_SYBASE) CONFIGURE_ARGS+= --enable-sybase=y .endif @@ -240,6 +241,11 @@ CONFIGURE_ARGS+= --enable-make-seekable=n CONFIGURE_ARGS+= --enable-domainquotas=y .endif +.if defined(WITH_SPAMASSASSIN) +BUILD_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin +CONFIGURE_ARGS+= --enable-spamassassin=${LOCALBASE}/bin/spamc +.endif + # autoconf and automake can remove our patches to the configure scripts. post-patch: @@ -309,5 +315,11 @@ post-install: >> ${PREFIX}/vpopmail/etc/vpopmail.mysql .endif ${CHOWN} -R vpopmail:vchkpw ${PREFIX}/vpopmail/bin/ ${PREFIX}/vpopmail/etc/ +.if defined(WITH_SPAMASSASSIN) + ${ECHO_CMD} "***********************************************************************" + ${ECHO_CMD} "Now you should add the following options to your spamd.sh startup file:" + ${ECHO_CMD} "-v -u vpopmail" + ${ECHO_CMD} "***********************************************************************" +.endif .include <bsd.port.post.mk> diff --git a/mail/vpopmail/files/patch-config.h.in b/mail/vpopmail/files/patch-config.h.in new file mode 100644 index 000000000000..f795be18e767 --- /dev/null +++ b/mail/vpopmail/files/patch-config.h.in @@ -0,0 +1,12 @@ +--- config.h.in.orig Fri Oct 24 18:43:20 2003 ++++ config.h.in Fri Oct 24 18:43:45 2003 +@@ -89,6 +89,9 @@ + #undef QMAILNEWU + + /* */ ++#undef SPAMC ++ ++/* */ + #undef QMAILINJECT + + /* */ diff --git a/mail/vpopmail/files/patch-configure b/mail/vpopmail/files/patch-configure index dff6d39e78a5..af635b3504dc 100644 --- a/mail/vpopmail/files/patch-configure +++ b/mail/vpopmail/files/patch-configure @@ -1,6 +1,15 @@ ---- configure.orig Thu Aug 28 21:09:47 2003 -+++ configure Fri Sep 5 00:13:14 2003 -@@ -1317,7 +1317,7 @@ +--- configure.orig Fri Oct 17 01:12:22 2003 ++++ configure Sat Oct 25 01:18:27 2003 +@@ -20,6 +20,8 @@ + ac_help="$ac_help + --enable-qmail-newmrh=path Full path to qmail-newmrh program" + ac_help="$ac_help ++ --enable-spamassassin=path Enable SpamAssassin. Full path to spamc program. default /usr/local/bin/spamc" ++ac_help="$ac_help + --enable-vpopuser=vpopmail user vchkpw was installed as." + ac_help="$ac_help + --enable-vpopgroup=vchkpw group vchkpw was installed as." +@@ -1317,7 +1319,7 @@ ;; esac @@ -9,7 +18,35 @@ then echo "configure: warning: === vpopmail must be configured as root. ===" 1>&2 echo "configure: warning: === please switch to the root user and ===" 1>&2 -@@ -1601,15 +1601,6 @@ +@@ -1446,6 +1448,27 @@ + EOF + + ++# Check whether --enable-spamassassin or --disable-spamassassin was given. ++if test "${enable_spamassassin+set}" = set; then ++ enableval="$enable_spamassassin" ++ spamc="$enableval" ++ ++ case $spamc in ++ 1*|y*|Y*) ++ spamc="/usr/local/bin/spamc" ++ ;; ++ esac ++ ++ if test ! -f "$spamc" ++ then ++ { echo "configure: error: Unable to find your spamc file, specify --enable-spamassassin=/full/path/to/spamc" 1>&2; exit 1; } ++ fi ++ ++ cat >> confdefs.h <<EOF ++#define SPAMC "$spamc" ++EOF ++fi ++ + + vpopuser="vpopmail" + # Check whether --enable-vpopuser or --disable-vpopuser was given. +@@ -1601,15 +1624,6 @@ EOF @@ -25,7 +62,7 @@ # Check whether --enable-roaming-users or --disable-roaming-users was given. if test "${enable_roaming_users+set}" = set; then enableval="$enable_roaming_users" -@@ -1671,17 +1662,7 @@ +@@ -1671,17 +1685,7 @@ if test "${enable_tcpserver_file+set}" = set; then enableval="$enable_tcpserver_file" tcpserver_file="$enableval" diff --git a/mail/vpopmail/files/patch-vdelivermail.c b/mail/vpopmail/files/patch-vdelivermail.c index 106281226007..8a23e9bb5c43 100644 --- a/mail/vpopmail/files/patch-vdelivermail.c +++ b/mail/vpopmail/files/patch-vdelivermail.c @@ -1,6 +1,6 @@ ---- vdelivermail.c.orig Sat Nov 2 22:34:39 2002 -+++ vdelivermail.c Sat Nov 2 22:35:20 2002 -@@ -263,7 +263,7 @@ +--- vdelivermail.c.orig Mon Oct 20 20:59:57 2003 ++++ vdelivermail.c Fri Oct 24 18:31:45 2003 +@@ -257,7 +257,7 @@ /* check for wildcard if there's no match */ if(tmpstr == NULL) { @@ -9,3 +9,42 @@ if(TheUser[i-1]=='-') { tmpuser[0] = '\0'; strncat(tmpuser,TheUser,i); +@@ -444,6 +444,7 @@ + int inject = 0; + FILE *fs; + char tmp_file[256]; ++ int pim[2]; + + /* check if the email is looping to this user */ + if ( is_looping( address ) == 1 ) { +@@ -631,6 +632,30 @@ + } + } + ++#ifdef SPAMC ++ /* fork the SpamAssassin client - patch by Alex Dupre */ ++ if (!pipe(pim)) { ++ pid = vfork(); ++ switch (pid) { ++ case -1: ++ close(pim[0]); ++ close(pim[1]); ++ break; ++ case 0: ++ close(pim[0]); ++ dup2(pim[1], 1); ++ close(pim[1]); ++ if (execl(SPAMC, SPAMC, "-u", maildir_to_email(address), 0) == -1) { ++ while ((file_count=read(0, msgbuf, MSG_BUF_SIZE)) > 0) ++ write(1, msgbuf, file_count); ++ _exit(0); ++ } ++ } ++ close(pim[1]); ++ dup2(pim[0], 0); ++ close(pim[0]); ++ } ++#endif + + /* read it in chunks and write it to the new file */ + while((file_count=read(0,msgbuf,MSG_BUF_SIZE))>0) { |