From e74f9da761e0518459b0a8709950abb829202f94 Mon Sep 17 00:00:00 2001 From: Alejandro Pulver Date: Wed, 4 Oct 2006 23:28:43 +0000 Subject: [PATCH] Courier pythonfilter pythonfilter is a framework for developing courierfilter programs in Python. The pythonfilter program itself is a multi-threaded daemon that loads filters as python modules and passes the control and data files from courier to each module in turn. pythonfilter includes several modules that provide utility functions. These modules are found in the "courier" directory. The "config" module provides functions to access or interpret Courier's configuration settings. The "control" module provides functions to interpret Courier's control files. pythonfilter is distributed under the GNU General Public License (GPL), as described in the COPYING file. PR: ports/101862 Submitted by: Milan Obuch --- mail/Makefile | 1 + mail/courier-pythonfilter/Makefile | 38 ++++++++++++++ mail/courier-pythonfilter/distinfo | 3 ++ .../files/patch-filters__comeagain.py | 11 ++++ .../files/patch-filters__dialback.py | 11 ++++ .../files/patch-pythonfilter.conf | 13 +++++ .../courier-pythonfilter/files/patch-setup.py | 9 ++++ .../files/patch-whitelist_auth.py | 26 ++++++++++ mail/courier-pythonfilter/pkg-descr | 15 ++++++ mail/courier-pythonfilter/pkg-plist | 52 +++++++++++++++++++ 10 files changed, 179 insertions(+) create mode 100644 mail/courier-pythonfilter/Makefile create mode 100644 mail/courier-pythonfilter/distinfo create mode 100644 mail/courier-pythonfilter/files/patch-filters__comeagain.py create mode 100644 mail/courier-pythonfilter/files/patch-filters__dialback.py create mode 100644 mail/courier-pythonfilter/files/patch-pythonfilter.conf create mode 100644 mail/courier-pythonfilter/files/patch-setup.py create mode 100644 mail/courier-pythonfilter/files/patch-whitelist_auth.py create mode 100644 mail/courier-pythonfilter/pkg-descr create mode 100644 mail/courier-pythonfilter/pkg-plist diff --git a/mail/Makefile b/mail/Makefile index 5e9575121069..d33a5f49ba69 100644 --- a/mail/Makefile +++ b/mail/Makefile @@ -45,6 +45,7 @@ SUBDIR += courier SUBDIR += courier-authlib-vchkpw SUBDIR += courier-imap + SUBDIR += courier-pythonfilter SUBDIR += couriergraph SUBDIR += crashecho SUBDIR += crm114 diff --git a/mail/courier-pythonfilter/Makefile b/mail/courier-pythonfilter/Makefile new file mode 100644 index 000000000000..312f929c18be --- /dev/null +++ b/mail/courier-pythonfilter/Makefile @@ -0,0 +1,38 @@ +# New ports collection makefile for: courier-pythonfilter +# Date created: Jun 19, 2006 +# Whom: Milan Obuch +# +# $FreeBSD$ +# + +PORTNAME= courier-pythonfilter +PORTVERSION= 0.9 +CATEGORIES= mail python +MASTER_SITES= http://phantom.dragonsdawn.net/~gordon/courier-patches/courier-pythonfilter/ + +MAINTAINER= bsd@dino.sk +COMMENT= Framework for courier filter development in python + +BUILD_DEPENDS= courier-config:${PORTSDIR}/mail/courier + +USE_PYTHON= yes +USE_PYDISTUTILS=yes + +MAILOWN= courier +MAILGRP= courier +MAILUID= 465 +MAILGID= 465 + +LOCALSTATEDIR= /var/spool/courier +SCRIPTSDIR= ${PREFIX}/libexec/filters + +post-extract: + ${MV} ${WRKSRC}/filters/whitelist-auth.py ${WRKSRC}/filters/whitelist_auth.py + +post-install: + ${MKDIR} ${LOCALSTATEDIR}/pythonfilter + ${CHOWN} ${MAILOWN}:${MAILGRP} ${LOCALSTATEDIR}/pythonfilter + +.include + +PYDISTUTILS_INSTALLARGS:= ${PYDISTUTILS_INSTALLARGS} --install-scripts=${SCRIPTSDIR} diff --git a/mail/courier-pythonfilter/distinfo b/mail/courier-pythonfilter/distinfo new file mode 100644 index 000000000000..46aa0b8e4ed3 --- /dev/null +++ b/mail/courier-pythonfilter/distinfo @@ -0,0 +1,3 @@ +MD5 (courier-pythonfilter-0.9.tar.gz) = 06d2c901ba6b700298da1c649d2788b9 +SHA256 (courier-pythonfilter-0.9.tar.gz) = 6840d63817ccae143f2c889d31e91f73a05966db350a7c5472e4859b278c84b3 +SIZE (courier-pythonfilter-0.9.tar.gz) = 27084 diff --git a/mail/courier-pythonfilter/files/patch-filters__comeagain.py b/mail/courier-pythonfilter/files/patch-filters__comeagain.py new file mode 100644 index 000000000000..889bbb61a1cb --- /dev/null +++ b/mail/courier-pythonfilter/files/patch-filters__comeagain.py @@ -0,0 +1,11 @@ +--- filters/comeagain.py.orig Mon Dec 13 09:26:13 2004 ++++ filters/comeagain.py Thu Jul 27 08:34:25 2006 +@@ -27,7 +27,7 @@ + + # Keep a dictionary of sender/recipient pairs that we've seen before + _sendersLock = thread.allocate_lock() +-_sendersDir = '/var/state/pythonfilter' ++_sendersDir = '/var/spool/courier/pythonfilter' + try: + _senders = anydbm.open(_sendersDir + '/correspondents', 'c') + except: diff --git a/mail/courier-pythonfilter/files/patch-filters__dialback.py b/mail/courier-pythonfilter/files/patch-filters__dialback.py new file mode 100644 index 000000000000..d99fd282da60 --- /dev/null +++ b/mail/courier-pythonfilter/files/patch-filters__dialback.py @@ -0,0 +1,11 @@ +--- filters/dialback.py.orig Sun Dec 26 00:01:02 2004 ++++ filters/dialback.py Thu Jul 27 08:33:13 2006 +@@ -32,7 +32,7 @@ + # Keep a dictionary of authenticated senders to avoid more work than + # required. + _sendersLock = thread.allocate_lock() +-_sendersDir = '/var/state/pythonfilter' ++_sendersDir = '/var/spool/courier/pythonfilter' + try: + _goodSenders = anydbm.open(_sendersDir + '/goodsenders', 'c') + _badSenders = anydbm.open(_sendersDir + '/badsenders', 'c') diff --git a/mail/courier-pythonfilter/files/patch-pythonfilter.conf b/mail/courier-pythonfilter/files/patch-pythonfilter.conf new file mode 100644 index 000000000000..e133b6384076 --- /dev/null +++ b/mail/courier-pythonfilter/files/patch-pythonfilter.conf @@ -0,0 +1,13 @@ +--- pythonfilter.conf.orig Thu Jul 27 07:44:46 2006 ++++ pythonfilter.conf Thu Jul 27 07:44:56 2006 +@@ -11,8 +11,8 @@ + # whitelist: exempts IP addresses for which you relay from further filtering. + whitelist + +-# whitelist-auth: exempts users who authenticate from further filtering. +-whitelist-auth ++# whitelist_auth: exempts users who authenticate from further filtering. ++whitelist_auth + + # spfcheck: checks the sender against SPF records. + # Requires: spf - http://www.wayforward.net/spf/ diff --git a/mail/courier-pythonfilter/files/patch-setup.py b/mail/courier-pythonfilter/files/patch-setup.py new file mode 100644 index 000000000000..df1d0f313ebc --- /dev/null +++ b/mail/courier-pythonfilter/files/patch-setup.py @@ -0,0 +1,9 @@ +--- setup.py.orig Mon Mar 13 20:44:45 2006 ++++ setup.py Wed Jul 26 21:21:34 2006 +@@ -15,5 +15,5 @@ + scripts=['pythonfilter'], + packages=['courier', 'pythonfilter'], + package_dir = {'pythonfilter': 'filters'}, +- data_files=[('/etc/', ['pythonfilter.conf'])] ++ data_files=[('/usr/local/etc/', ['pythonfilter.conf'])] + ) diff --git a/mail/courier-pythonfilter/files/patch-whitelist_auth.py b/mail/courier-pythonfilter/files/patch-whitelist_auth.py new file mode 100644 index 000000000000..f9ff0221b7fb --- /dev/null +++ b/mail/courier-pythonfilter/files/patch-whitelist_auth.py @@ -0,0 +1,26 @@ +--- filters/whitelist_auth.py.orig Sun Dec 26 00:01:02 2004 ++++ filters/whitelist_auth.py Thu Jul 27 07:46:24 2006 +@@ -1,5 +1,5 @@ + #!/usr/bin/python +-# whitelist-auth -- Courier filter which exempts authenticated users from filtering ++# whitelist_auth -- Courier filter which exempts authenticated users from filtering + # Copyright (C) 2004 Gordon Messmer + # + # This program is free software; you can redistribute it and/or modify +@@ -28,7 +28,7 @@ + _auth_regex = re.compile(r'\(AUTH: \w* \w*([^)]*)\)\s*by %s' % _hostname) + + # Record in the system log that this filter was initialized. +-sys.stderr.write('Initialized the "whitelist-auth" python filter\n') ++sys.stderr.write('Initialized the "whitelist_auth" python filter\n') + + + def checkHeader(header): +@@ -105,6 +105,6 @@ + # is whitelisted, or nothing to indicate that the remaining + # filters would be run. + if not sys.argv[1:]: +- print 'Use: whitelist-auth.py ' ++ print 'Use: whitelist_auth.py ' + sys.exit(1) + print doFilter(sys.argv[1], []) diff --git a/mail/courier-pythonfilter/pkg-descr b/mail/courier-pythonfilter/pkg-descr new file mode 100644 index 000000000000..c07777030341 --- /dev/null +++ b/mail/courier-pythonfilter/pkg-descr @@ -0,0 +1,15 @@ +Courier pythonfilter + +pythonfilter is a framework for developing courierfilter programs in +Python. The pythonfilter program itself is a multi-threaded daemon +that loads filters as python modules and passes the control and data +files from courier to each module in turn. + +pythonfilter includes several modules that provide utility functions. +These modules are found in the "courier" directory. The "config" +module provides functions to access or interpret Courier's +configuration settings. The "control" module provides functions +to interpret Courier's control files. + +pythonfilter is distributed under the GNU General Public License +(GPL), as described in the COPYING file. diff --git a/mail/courier-pythonfilter/pkg-plist b/mail/courier-pythonfilter/pkg-plist new file mode 100644 index 000000000000..ff0c2d2bf8e3 --- /dev/null +++ b/mail/courier-pythonfilter/pkg-plist @@ -0,0 +1,52 @@ +etc/pythonfilter.conf +libexec/filters/pythonfilter +%%PYTHON_SITELIBDIR%%/courier/__init__.py +%%PYTHON_SITELIBDIR%%/courier/__init__.pyc +%%PYTHON_SITELIBDIR%%/courier/__init__.pyo +%%PYTHON_SITELIBDIR%%/courier/config.py +%%PYTHON_SITELIBDIR%%/courier/config.pyc +%%PYTHON_SITELIBDIR%%/courier/config.pyo +%%PYTHON_SITELIBDIR%%/courier/control.py +%%PYTHON_SITELIBDIR%%/courier/control.pyc +%%PYTHON_SITELIBDIR%%/courier/control.pyo +%%PYTHON_SITELIBDIR%%/courier/xfilter.py +%%PYTHON_SITELIBDIR%%/courier/xfilter.pyc +%%PYTHON_SITELIBDIR%%/courier/xfilter.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/__init__.py +%%PYTHON_SITELIBDIR%%/pythonfilter/__init__.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/__init__.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/attachments.py +%%PYTHON_SITELIBDIR%%/pythonfilter/attachments.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/attachments.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/clamav.py +%%PYTHON_SITELIBDIR%%/pythonfilter/clamav.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/clamav.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/comeagain.py +%%PYTHON_SITELIBDIR%%/pythonfilter/comeagain.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/comeagain.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/debug.py +%%PYTHON_SITELIBDIR%%/pythonfilter/debug.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/debug.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/dialback.py +%%PYTHON_SITELIBDIR%%/pythonfilter/dialback.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/dialback.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/noduplicates.py +%%PYTHON_SITELIBDIR%%/pythonfilter/noduplicates.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/noduplicates.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/nosuccessdsn.py +%%PYTHON_SITELIBDIR%%/pythonfilter/nosuccessdsn.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/nosuccessdsn.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/ratelimit.py +%%PYTHON_SITELIBDIR%%/pythonfilter/ratelimit.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/ratelimit.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/spfcheck.py +%%PYTHON_SITELIBDIR%%/pythonfilter/spfcheck.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/spfcheck.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist_auth.py +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist_auth.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist_auth.pyo +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist.py +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist.pyc +%%PYTHON_SITELIBDIR%%/pythonfilter/whitelist.pyo +@dirrm %%PYTHON_SITELIBDIR%%/courier +@dirrm %%PYTHON_SITELIBDIR%%/pythonfilter