From f4a88d4c6c0991f2eb067daa0441e3a005dc3679 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Fri, 31 Oct 2003 17:24:01 +0000 Subject: [PATCH] Add Alex Dupre's patch for SpamAssassin integration, conditional on the WITH_SPAMASSASSIN knob. PR: 58503 Submitted by: Alex Dupre --- mail/vpopmail-devel/Makefile | 66 +++++++++++-------- mail/vpopmail-devel/files/patch-config.h.in | 12 ++++ mail/vpopmail-devel/files/patch-configure | 47 +++++++++++-- .../vpopmail-devel/files/patch-vdelivermail.c | 45 ++++++++++++- mail/vpopmail/Makefile | 66 +++++++++++-------- mail/vpopmail/files/patch-config.h.in | 12 ++++ mail/vpopmail/files/patch-configure | 47 +++++++++++-- mail/vpopmail/files/patch-vdelivermail.c | 45 ++++++++++++- 8 files changed, 270 insertions(+), 70 deletions(-) create mode 100644 mail/vpopmail-devel/files/patch-config.h.in create mode 100644 mail/vpopmail/files/patch-config.h.in 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 .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 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 < 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 .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 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 < 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) {