Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 10fdccf366 | |||
| 7d097fa4a0 | |||
| ca81502c85 | |||
| 50356d4710 | |||
| ec3fa46799 | |||
| 04e0b15640 | |||
| ff6a07ef10 | |||
| 7dfda0a3bd | |||
| 183ce91a61 |
@@ -10,7 +10,6 @@ include testmime.py
|
||||
include testutils.py
|
||||
include test.py
|
||||
include sample.py
|
||||
include sgmllib.py
|
||||
include milter-template.py
|
||||
include test/*
|
||||
include Milter/*.py
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
# This code is under the GNU General Public License. See COPYING for details.
|
||||
|
||||
from __future__ import print_function
|
||||
__version__ = '1.0.3'
|
||||
__version__ = '1.0.4'
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -8,6 +8,7 @@ import socket
|
||||
import email.errors
|
||||
from email.header import decode_header
|
||||
import email.base64mime
|
||||
import email.utils
|
||||
from fnmatch import fnmatchcase
|
||||
from binascii import a2b_base64
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ web:
|
||||
rsync -ravKk doc/html/ bmsi.com:/var/www/html/pymilter
|
||||
cd doc/html; zip -r ../../doc .
|
||||
|
||||
VERSION=1.0.3
|
||||
VERSION=1.0.4
|
||||
PKG=pymilter-$(VERSION)
|
||||
SRCTAR=$(PKG).tar.gz
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
## A very simple milter to prevent mixing of internal and external mail.
|
||||
## A very simple sample milter to prevent mixing of internal and external mail.
|
||||
# Internal is defined as using one of a list of internal top level domains.
|
||||
# This code is open-source on the same terms as Python.
|
||||
|
||||
|
||||
-174
@@ -1,174 +0,0 @@
|
||||
diff --git a/miltermodule.c b/miltermodule.c
|
||||
index aa10a08..4d5a93d 100644
|
||||
--- a/miltermodule.c
|
||||
+++ b/miltermodule.c
|
||||
@@ -343,7 +343,7 @@ static struct MilterCallback {
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
-staticforward struct smfiDesc description; /* forward declaration */
|
||||
+static struct smfiDesc description; /* forward declaration */
|
||||
|
||||
static PyObject *MilterError;
|
||||
/* The interpreter instance that called milter.main */
|
||||
@@ -355,7 +355,7 @@ typedef struct {
|
||||
|
||||
static milter_Diag diag;
|
||||
|
||||
-staticforward PyTypeObject milter_ContextType;
|
||||
+static PyTypeObject milter_ContextType;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
@@ -700,7 +700,7 @@ _generic_wrapper(milter_ContextObject *self, PyObject *cb, PyObject *arglist) {
|
||||
result = PyEval_CallObject(cb, arglist);
|
||||
Py_DECREF(arglist);
|
||||
if (result == NULL) return _report_exception(self);
|
||||
- if (!PyInt_Check(result)) {
|
||||
+ if (!PyLong_Check(result)) {
|
||||
const struct MilterCallback *p;
|
||||
const char *cbname = "milter";
|
||||
char buf[40];
|
||||
@@ -715,7 +715,7 @@ _generic_wrapper(milter_ContextObject *self, PyObject *cb, PyObject *arglist) {
|
||||
PyErr_SetString(MilterError,buf);
|
||||
return _report_exception(self);
|
||||
}
|
||||
- retval = PyInt_AS_LONG(result);
|
||||
+ retval = PyLong_AS_LONG(result);
|
||||
Py_DECREF(result);
|
||||
_release_thread(self->t);
|
||||
return retval;
|
||||
@@ -732,7 +732,7 @@ makeipaddr(struct sockaddr_in *addr) {
|
||||
sprintf(buf, "%d.%d.%d.%d",
|
||||
(int) (x>>24) & 0xff, (int) (x>>16) & 0xff,
|
||||
(int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff);
|
||||
- return PyString_FromString(buf);
|
||||
+ return PyUnicode_FromString(buf);
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPV6_SUPPORT
|
||||
@@ -740,8 +740,8 @@ static PyObject *
|
||||
makeip6addr(struct sockaddr_in6 *addr) {
|
||||
char buf[100]; /* must be at least INET6_ADDRSTRLEN + 1 */
|
||||
const char *s = inet_ntop(AF_INET6, &addr->sin6_addr, buf, sizeof buf);
|
||||
- if (s) return PyString_FromString(s);
|
||||
- return PyString_FromString("inet6:unknown");
|
||||
+ if (s) return PyUnicode_FromString(s);
|
||||
+ return PyUnicode_FromString("inet6:unknown");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -832,7 +832,7 @@ generic_env_wrapper(SMFICTX *ctx, PyObject*cb, char **argv) {
|
||||
for (i=0;i<count;i++) {
|
||||
/* There's some error checking performed in do_mkvalue() for a string */
|
||||
/* that's not currently done here - it probably should be */
|
||||
- PyObject *o = PyString_FromStringAndSize(argv[i], strlen(argv[i]));
|
||||
+ PyObject *o = PyUnicode_FromStringAndSize(argv[i], strlen(argv[i]));
|
||||
if (o == NULL) { /* out of memory */
|
||||
Py_DECREF(arglist);
|
||||
return _report_exception(self);
|
||||
@@ -889,7 +889,7 @@ milter_wrap_body(SMFICTX *ctx, u_char *bodyp, size_t bodylen) {
|
||||
c = _get_context(ctx);
|
||||
if (!c) return SMFIS_TEMPFAIL;
|
||||
/* Unclear whether this should be s#, z#, or t# */
|
||||
- arglist = Py_BuildValue("(Os#)", c, bodyp, bodylen);
|
||||
+ arglist = Py_BuildValue("(Oy#)", c, bodyp, bodylen);
|
||||
return _generic_wrapper(c, body_callback, arglist);
|
||||
}
|
||||
|
||||
@@ -963,7 +963,7 @@ milter_wrap_negotiate(SMFICTX *ctx,
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
*pa[i] = (i <= len)
|
||||
- ? PyInt_AsUnsignedLongMask(PyList_GET_ITEM(optlist,i))
|
||||
+ ? PyLong_AsUnsignedLongMask(PyList_GET_ITEM(optlist,i))
|
||||
: fa[i];
|
||||
}
|
||||
if (PyErr_Occurred()) {
|
||||
@@ -1551,11 +1551,6 @@ static PyMethodDef context_methods[] = {
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
-static PyObject *
|
||||
-milter_Context_getattr(PyObject *self, char *name) {
|
||||
- return Py_FindMethod(context_methods, self, name);
|
||||
-}
|
||||
-
|
||||
static struct smfiDesc description = { /* Set some reasonable defaults */
|
||||
"pythonfilter",
|
||||
SMFI_VERSION,
|
||||
@@ -1604,14 +1599,13 @@ static PyMethodDef milter_methods[] = {
|
||||
};
|
||||
|
||||
static PyTypeObject milter_ContextType = {
|
||||
- PyObject_HEAD_INIT(&PyType_Type)
|
||||
- 0,
|
||||
- "milterContext",
|
||||
+ PyVarObject_HEAD_INIT(&PyType_Type,0)
|
||||
+ "milter.Context",
|
||||
sizeof(milter_ContextObject),
|
||||
0,
|
||||
milter_Context_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
- milter_Context_getattr, /* tp_getattr */
|
||||
+ 0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
0, /* tp_repr */
|
||||
@@ -1625,6 +1619,13 @@ static PyTypeObject milter_ContextType = {
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
+ NULL, /* Documentation string */
|
||||
+ 0, /* call function for all accessible objects */
|
||||
+ 0, /* delete references to contained objects */
|
||||
+ 0, /* rich comparisons */
|
||||
+ 0, /* weak reference enabler */
|
||||
+ 0, 0, /* Iterators */
|
||||
+ context_methods, /* Attribute descriptor and subclassing stuff */
|
||||
};
|
||||
|
||||
static const char milter_documentation[] =
|
||||
@@ -1634,17 +1635,31 @@ Libmilter is currently marked FFR, and needs to be explicitly installed.\n\
|
||||
See <sendmailsource>/libmilter/README for details on setting it up.\n";
|
||||
|
||||
static void setitem(PyObject *d,const char *name,long val) {
|
||||
- PyObject *v = PyInt_FromLong(val);
|
||||
+ PyObject *v = PyLong_FromLong(val);
|
||||
PyDict_SetItemString(d,name,v);
|
||||
Py_DECREF(v);
|
||||
}
|
||||
|
||||
-void
|
||||
-initmilter(void) {
|
||||
+static struct PyModuleDef moduledef = {
|
||||
+ PyModuleDef_HEAD_INIT,
|
||||
+ "milter", /* m_name */
|
||||
+ milter_documentation,/* m_doc */
|
||||
+ -1, /* m_size */
|
||||
+ milter_methods, /* m_methods */
|
||||
+ NULL, /* m_reload */
|
||||
+ NULL, /* m_traverse */
|
||||
+ NULL, /* m_clear */
|
||||
+ NULL, /* m_free */
|
||||
+};
|
||||
+
|
||||
+PyMODINIT_FUNC PyInit_milter(void) {
|
||||
PyObject *m, *d;
|
||||
|
||||
- m = Py_InitModule4("milter", milter_methods, milter_documentation,
|
||||
- (PyObject*)NULL, PYTHON_API_VERSION);
|
||||
+ if (PyType_Ready(&milter_ContextType) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ m = PyModule_Create(&moduledef);
|
||||
+ if (m == NULL) return NULL;
|
||||
d = PyModule_GetDict(m);
|
||||
MilterError = PyErr_NewException("milter.error", NULL, NULL);
|
||||
PyDict_SetItemString(d,"error", MilterError);
|
||||
@@ -1710,4 +1725,5 @@ initmilter(void) {
|
||||
setitem(d,"DISCARD", SMFIS_DISCARD);
|
||||
setitem(d,"ACCEPT", SMFIS_ACCEPT);
|
||||
setitem(d,"TEMPFAIL", SMFIS_TEMPFAIL);
|
||||
+ return m;
|
||||
}
|
||||
+5
-17
@@ -71,7 +71,7 @@ $ python setup.py help
|
||||
* published. Unfortunately I know of no good way to do this
|
||||
* other than with OS-specific tests.
|
||||
*/
|
||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__sun__)
|
||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__sun__) || defined(__GLIBC__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#define HAVE_IPV6_RFC2553
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
@@ -134,8 +134,10 @@ static struct MilterCallback {
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static struct smfiDesc description; /* forward declaration */
|
||||
static PyTypeObject milter_ContextType;
|
||||
#else
|
||||
staticforward struct smfiDesc description; /* forward declaration */
|
||||
staticforward PyTypeObject milter_ContextType;
|
||||
#endif
|
||||
|
||||
static PyObject *MilterError;
|
||||
@@ -148,12 +150,6 @@ typedef struct {
|
||||
|
||||
static milter_Diag diag;
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static PyTypeObject milter_ContextType;
|
||||
#else
|
||||
staticforward PyTypeObject milter_ContextType;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
SMFICTX *ctx; /* libmilter thread state */
|
||||
@@ -383,7 +379,7 @@ Sets the Python function invoked for each body chunk. There may\n\
|
||||
be multiple body chunks passed to the filter. End-of-lines are\n\
|
||||
represented as received from SMTP (normally Carriage-Return/Line-Feed).\n\
|
||||
Function takes args (ctx, chunk) -> int\n\
|
||||
chunk -> String - body data";
|
||||
chunk -> bytes - body data";
|
||||
|
||||
static PyObject *
|
||||
milter_set_body_callback(PyObject *self, PyObject *args) {
|
||||
@@ -772,13 +768,6 @@ milter_wrap_negotiate(SMFICTX *ctx,
|
||||
rc = _generic_wrapper(c, negotiate_callback, arglist);
|
||||
c->t = t;
|
||||
if (rc == SMFIS_CONTINUE) {
|
||||
#if 0 // PyArgs_Parse deprecated and going away
|
||||
if (!PyArgs_Parse(optlist,"[kkkk]",pf0,pf1,pf2,pf3)) {
|
||||
PyErr_Print();
|
||||
PyErr_Clear(); /* must clear since not returning to python */
|
||||
rc = SMFIS_REJECT;
|
||||
}
|
||||
#else
|
||||
unsigned long *pa[4] = { pf0,pf1,pf2,pf3 };
|
||||
unsigned long fa[4] = { f0,f1,f2,f3 };
|
||||
int len = PyList_Size(optlist);
|
||||
@@ -797,7 +786,6 @@ milter_wrap_negotiate(SMFICTX *ctx,
|
||||
PyErr_Clear();
|
||||
rc = SMFIS_REJECT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (rc != SMFIS_ALL_OPTS)
|
||||
rc = SMFIS_REJECT;
|
||||
@@ -1157,7 +1145,7 @@ Change/delete a header in the message. \n\
|
||||
It is not checked for standards compliance; the mail filter\n\
|
||||
must ensure that no protocols are violated as a result of adding this header.\n\
|
||||
field - header field name\n\
|
||||
int - the Nth occurence of this header\n\
|
||||
int - the Nth occurrence of this header\n\
|
||||
value - header field value\n\
|
||||
field and value are strings.\n\
|
||||
This function can only be called from the EOM callback.";
|
||||
|
||||
-197
@@ -1,197 +0,0 @@
|
||||
%if 0%{?rhel} == 7
|
||||
%define pythonbase python34
|
||||
%else
|
||||
%define pythonbase python3
|
||||
%endif
|
||||
%define __python python3
|
||||
|
||||
%define libdir %{_libdir}/pymilter
|
||||
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
Summary: Python interface to sendmail milter API
|
||||
Name: %{pythonbase}-pymilter
|
||||
Version: 1.0.2
|
||||
Release: 1%{dist}
|
||||
Source: https://github.com/sdgathman/pymilter/archive/pymilter-%{version}.tar.gz
|
||||
Source1: pymilter.te
|
||||
# Patch miltermodule to python3
|
||||
# FIXME: replace with reverse patch at some point (make py3 the default)
|
||||
Patch: milter.patch
|
||||
License: GPLv2+
|
||||
Group: Development/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
Url: http://www.bmsi.com/python/milter.html
|
||||
# python-2.6.4 gets RuntimeError: not holding the import lock
|
||||
Requires: %{pythonbase} >= 2.6.5, sendmail-milter >= 8.13
|
||||
%if 0%{?fedora} >= 23
|
||||
# Need python2.6 specific pydns, not the version for system python
|
||||
Recommends: %{pythonbase}-pydns
|
||||
%endif
|
||||
# Needed for callbacks, not a core function but highly useful for milters
|
||||
BuildRequires: ed, %{pythonbase}-devel, sendmail-devel >= 8.13
|
||||
|
||||
%description
|
||||
This is a python extension module to enable python scripts to
|
||||
attach to sendmail's libmilter functionality. Additional python
|
||||
modules provide for navigating and modifying MIME parts, sending
|
||||
DSNs, and doing CBV.
|
||||
|
||||
%package selinux
|
||||
Summary: SELinux policy module for pymilter
|
||||
Group: System Environment/Base
|
||||
Requires: policycoreutils, selinux-policy, %{name}
|
||||
BuildRequires: policycoreutils, checkpolicy
|
||||
%if 0%{?epel} >= 6
|
||||
BuildRequires: policycoreutils-python
|
||||
%else
|
||||
BuildRequires: policycoreutils-python-utils
|
||||
%endif
|
||||
|
||||
%description selinux
|
||||
SELinux policy module for using pymilter with sendmail with selinux enforcing
|
||||
|
||||
%prep
|
||||
%setup -q -n pymilter-%{version}
|
||||
%patch -p1 -b .py3
|
||||
cp %{SOURCE1} pymilter.te
|
||||
|
||||
%build
|
||||
env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
|
||||
checkmodule -m -M -o pymilter.mod pymilter.te
|
||||
semodule_package -o pymilter.pp -m pymilter.mod
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__python} setup.py install --root=$RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/milter
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/milter
|
||||
mkdir -p $RPM_BUILD_ROOT%{libdir}
|
||||
|
||||
# install selinux modules
|
||||
mkdir -p %{buildroot}%{_datadir}/selinux/targeted
|
||||
cp -p pymilter.pp %{buildroot}%{_datadir}/selinux/targeted
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py
|
||||
%{python_sitearch}/*
|
||||
%{libdir}
|
||||
%dir %attr(0755,mail,mail) %{_localstatedir}/run/milter
|
||||
%dir %attr(0755,mail,mail) %{_localstatedir}/log/milter
|
||||
|
||||
%files selinux
|
||||
%doc pymilter.te
|
||||
%{_datadir}/selinux/targeted/*
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post selinux
|
||||
/usr/sbin/semodule -s targeted -i %{_datadir}/selinux/targeted/pymilter.pp \
|
||||
&>/dev/null || :
|
||||
|
||||
%postun selinux
|
||||
if [ $1 -eq 0 ] ; then
|
||||
/usr/sbin/semodule -s targeted -r pymilter &> /dev/null || :
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Tue Dec 13 2016 Stuart Gathman <stuart@gathman.org> 1.0.2-1
|
||||
- Fix the last setsymlist misspelling. Support in test framework and tests.
|
||||
- Add @symlist decorator.
|
||||
- Change body callback and a few other APIs to use bytes instead of str.
|
||||
|
||||
* Tue Sep 20 2016 Stuart Gathman <stuart@gathman.org> 1.0.1-1
|
||||
- Support python3
|
||||
|
||||
* Sat Mar 1 2014 Stuart Gathman <stuart@gathman.org> 1.0-2
|
||||
- Remove start.sh to track EPEL repository, suggest daemonize as replacement
|
||||
- Selinux subpackage should not care about pymilter version
|
||||
|
||||
* Wed Jun 26 2013 Stuart Gathman <stuart@gathman.org> 1.0-1
|
||||
- Allow ACCEPT as untrapped exception policy
|
||||
- Optional dir for getaddrset and getaddrdict in Milter.config
|
||||
- Show registered milter name in untrapped exception message.
|
||||
- Include selinux subpackage
|
||||
- Provide Milter.greylist export and Milter.greylist import to migrate data
|
||||
|
||||
* Sat Mar 9 2013 Stuart Gathman <stuart@bmsi.com> 0.9.8-1
|
||||
- Add Milter.test module for unit testing milters.
|
||||
- Fix typo that prevented setsymlist from being active.
|
||||
- Change untrapped exception message to:
|
||||
- "pymilter: untrapped exception in milter app"
|
||||
|
||||
* Thu Apr 12 2012 Stuart Gathman <stuart@bmsi.com> 0.9.7-1
|
||||
- Raise RuntimeError when result != CONTINUE for @noreply and @nocallback
|
||||
- Remove redundant table in miltermodule
|
||||
- Fix CNAME chain duplicating TXT records in Milter.dns (from pyspf).
|
||||
|
||||
* Sat Feb 25 2012 Stuart Gathman <stuart@bmsi.com> 0.9.6-1
|
||||
- Raise ValueError on unescaped '%' passed to setreply
|
||||
- Grace time at end of Greylist window
|
||||
|
||||
* Fri Aug 19 2011 Stuart Gathman <stuart@bmsi.com> 0.9.5-1
|
||||
- Print milter.error for invalid callback return type.
|
||||
(Since stacktrace is empty, the TypeError exception is confusing.)
|
||||
- Fix milter-template.py
|
||||
- Tweak Milter.utils.addr2bin and Milter.dynip to handle IP6
|
||||
|
||||
* Tue Mar 02 2010 Stuart Gathman <stuart@bmsi.com> 0.9.4-1
|
||||
- Handle IP6 in Milter.utils.iniplist()
|
||||
- python-2.6
|
||||
|
||||
* Thu Jul 02 2009 Stuart Gathman <stuart@bmsi.com> 0.9.3-1
|
||||
- Handle source route in Milter.utils.parse_addr()
|
||||
- Fix default arg in chgfrom.
|
||||
- Disable negotiate callback for libmilter < 8.14.3 (1,0,1)
|
||||
|
||||
* Tue Jun 02 2009 Stuart Gathman <stuart@bmsi.com> 0.9.2-3
|
||||
- Change result of @noreply callbacks to NOREPLY when so negotiated.
|
||||
|
||||
* Tue Jun 02 2009 Stuart Gathman <stuart@bmsi.com> 0.9.2-2
|
||||
- Cache callback negotiation
|
||||
|
||||
* Thu May 28 2009 Stuart Gathman <stuart@bmsi.com> 0.9.2-1
|
||||
- Add new callback support: data,negotiate,unknown
|
||||
- Auto-negotiate protocol steps
|
||||
|
||||
* Thu Feb 05 2009 Stuart Gathman <stuart@bmsi.com> 0.9.1-1
|
||||
- Fix missing address of optional param to addrcpt
|
||||
|
||||
* Wed Jan 07 2009 Stuart Gathman <stuart@bmsi.com> 0.9.0-4
|
||||
- Stop using INSTALLED_FILES to make Fedora happy
|
||||
- Remove config flag from start.sh glue
|
||||
- Own /var/log/milter
|
||||
- Use _localstatedir
|
||||
|
||||
* Wed Jan 07 2009 Stuart Gathman <stuart@bmsi.com> 0.9.0-2
|
||||
- Changes to meet Fedora standards
|
||||
|
||||
* Mon Nov 24 2008 Stuart Gathman <stuart@bmsi.com> 0.9.0-1
|
||||
- Split pymilter into its own CVS module
|
||||
- Support chgfrom and addrcpt_par
|
||||
- Support NS records in Milter.dns
|
||||
|
||||
* Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-2
|
||||
- /var/run/milter directory must be owned by mail
|
||||
|
||||
* Mon Aug 25 2008 Stuart Gathman <stuart@bmsi.com> 0.8.10-1
|
||||
- improved parsing into email and fullname (still 2 self test failures)
|
||||
- implement no-DSN CBV, reduce full DSNs
|
||||
|
||||
* Mon Sep 24 2007 Stuart Gathman <stuart@bmsi.com> 0.8.9-1
|
||||
- Use ifarch hack to build milter and milter-spf packages as noarch
|
||||
- Remove spf dependency from dsn.py, add dns.py
|
||||
|
||||
* Fri Jan 05 2007 Stuart Gathman <stuart@bmsi.com> 0.8.8-1
|
||||
- move AddrCache, parse_addr, iniplist to Milter package
|
||||
- move parse_header to Milter.utils
|
||||
- fix plock for missing source and can't change owner/group
|
||||
- split out pymilter and pymilter-spf packages
|
||||
- move milter apps to /usr/lib/pymilter
|
||||
|
||||
* Sat Nov 04 2006 Stuart Gathman <stuart@bmsi.com> 0.8.7-1
|
||||
- SPF moved to pyspf RPM
|
||||
|
||||
* Tue May 23 2006 Stuart Gathman <stuart@bmsi.com> 0.8.6-2
|
||||
- Support CBV timeout
|
||||
+171
-66
@@ -1,46 +1,72 @@
|
||||
%define __python python2
|
||||
%if 0%{?rhel} == 6
|
||||
%define pythonbase python
|
||||
# we don't want to provide private python extension libs
|
||||
%global sum Python interface to sendmail milter API
|
||||
%global __provides_exclude_from ^(%{python2_sitearch})/.*\\.so$
|
||||
%if 0%{?epel} == 7
|
||||
%global python3 python34
|
||||
%else
|
||||
%define pythonbase python2
|
||||
%global python3 python3
|
||||
%endif
|
||||
|
||||
%define libdir %{_libdir}/pymilter
|
||||
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
Summary: Python interface to sendmail milter API
|
||||
Name: %{pythonbase}-pymilter
|
||||
Version: 1.0.2
|
||||
Release: 1%{dist}
|
||||
Summary: %{sum}
|
||||
Name: python-pymilter
|
||||
Version: 1.0.4
|
||||
Release: 1%{?dist}
|
||||
Url: http://bmsi.com/pymilter
|
||||
Source: https://github.com/sdgathman/pymilter/archive/pymilter-%{version}.tar.gz
|
||||
Source1: pymilter.te
|
||||
# Patch miltermodule to python3
|
||||
# FIXME: replace with reverse patch at some point (make py3 the default)
|
||||
Patch: milter.patch
|
||||
Source1: tmpfiles-python-pymilter.conf
|
||||
# remove unit tests that require network for check
|
||||
Patch: pymilter-check.patch
|
||||
License: GPLv2+
|
||||
Group: Development/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
Url: http://www.bmsi.com/python/milter.html
|
||||
BuildRequires: python2-devel, %{python3}-devel, sendmail-devel >= 8.13
|
||||
# python-2.6.4 gets RuntimeError: not holding the import lock
|
||||
Requires: %{pythonbase} >= 2.6.5, sendmail-milter >= 8.13
|
||||
%if 0%{?fedora} >= 23
|
||||
# Need python2.6 specific pydns, not the version for system python
|
||||
Recommends: %{pythonbase}-pydns
|
||||
%endif
|
||||
# Needed for callbacks, not a core function but highly useful for milters
|
||||
BuildRequires: ed, %{pythonbase}-devel, sendmail-devel >= 8.13
|
||||
BuildRequires: gcc
|
||||
|
||||
%description
|
||||
This is a python extension module to enable python scripts to
|
||||
attach to sendmail's libmilter functionality. Additional python
|
||||
modules provide for navigating and modifying MIME parts, sending
|
||||
%global _description\
|
||||
This is a python extension module to enable python scripts to\
|
||||
attach to sendmail's libmilter functionality. Additional python\
|
||||
modules provide for navigating and modifying MIME parts, sending\
|
||||
DSNs, and doing CBV.
|
||||
|
||||
%description %_description
|
||||
|
||||
%package -n python2-pymilter
|
||||
Summary: %{sum}
|
||||
%if 0%{?epel} >= 6
|
||||
Requires: python-pydns
|
||||
%else
|
||||
Requires: python2-pydns
|
||||
%endif
|
||||
Requires: %{name}-common = %{version}-%{release}
|
||||
%{?python_provide:%python_provide python2-pymilter}
|
||||
|
||||
%description -n python2-pymilter %_description
|
||||
|
||||
%package -n %{python3}-pymilter
|
||||
Summary: %{sum}
|
||||
%if 0%{?fedora} >= 26
|
||||
Requires: %{python3}-py3dns
|
||||
%endif
|
||||
Requires: %{name}-common = %{version}-%{release}
|
||||
%{?python_provide:%python_provide %{python3}-pymilter}
|
||||
|
||||
%description -n %{python3}-pymilter %_description
|
||||
|
||||
%package common
|
||||
Summary: Common files and directories for python milters
|
||||
BuildArch: noarch
|
||||
|
||||
%description common
|
||||
Common files and directories used for python milters
|
||||
|
||||
%package selinux
|
||||
Summary: SELinux policy module for pymilter
|
||||
Group: System Environment/Base
|
||||
Requires: policycoreutils, selinux-policy, %{name}
|
||||
BuildRequires: policycoreutils, checkpolicy
|
||||
Requires: policycoreutils, selinux-policy-targeted
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
BuildArch: noarch
|
||||
BuildRequires: policycoreutils, checkpolicy, selinux-policy-devel
|
||||
%if 0%{?epel} >= 6
|
||||
BuildRequires: policycoreutils-python
|
||||
%else
|
||||
@@ -48,71 +74,150 @@ BuildRequires: policycoreutils-python-utils
|
||||
%endif
|
||||
|
||||
%description selinux
|
||||
SELinux policy module for using pymilter with sendmail with selinux enforcing
|
||||
Give sendmail_t additional access to stream sockets used to communicate
|
||||
with milters.
|
||||
|
||||
%prep
|
||||
%setup -q -n pymilter-%{version}
|
||||
cp %{SOURCE1} pymilter.te
|
||||
%setup -q -n pymilter-pymilter-%{version}
|
||||
%patch -p1 -b .check
|
||||
|
||||
%build
|
||||
env CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
|
||||
%py2_build
|
||||
#patch -p1 -b -z .py3 <milter.patch # not needed since 1.0.3
|
||||
%py3_build
|
||||
checkmodule -m -M -o pymilter.mod pymilter.te
|
||||
semodule_package -o pymilter.pp -m pymilter.mod
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%{__python} setup.py install --root=$RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/milter
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/milter
|
||||
mkdir -p $RPM_BUILD_ROOT%{libdir}
|
||||
%py2_install
|
||||
%py3_install
|
||||
|
||||
mkdir -p %{buildroot}/run/milter
|
||||
mkdir -p %{buildroot}%{_localstatedir}/log/milter
|
||||
mkdir -p %{buildroot}%{_libexecdir}/milter
|
||||
mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
|
||||
install -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
||||
|
||||
# install selinux modules
|
||||
mkdir -p %{buildroot}%{_datadir}/selinux/targeted
|
||||
cp -p pymilter.pp %{buildroot}%{_datadir}/selinux/targeted
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%check
|
||||
py2path=$(ls -d build/lib.linux-*-2.*)
|
||||
py3path=$(ls -d build/lib.linux-*-3.*)
|
||||
PYTHONPATH=${py2path}:. python2 test.py &&
|
||||
PYTHONPATH=${py3path}:. python3 test.py
|
||||
|
||||
%files -n python2-pymilter
|
||||
%license COPYING
|
||||
%doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py
|
||||
%{python_sitearch}/*
|
||||
%{libdir}
|
||||
%dir %attr(0755,mail,mail) %{_localstatedir}/run/milter
|
||||
%{python2_sitearch}/*
|
||||
|
||||
%files -n %{python3}-pymilter
|
||||
%license COPYING
|
||||
%doc README ChangeLog NEWS TODO CREDITS sample.py milter-template.py
|
||||
%{python3_sitearch}/*
|
||||
|
||||
%files common
|
||||
%dir %{_libexecdir}/milter
|
||||
%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
||||
%dir %attr(0755,mail,mail) %{_localstatedir}/log/milter
|
||||
%dir %attr(0755,mail,mail) /run/milter
|
||||
|
||||
%files selinux
|
||||
%doc pymilter.te
|
||||
%{_datadir}/selinux/targeted/*
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post selinux
|
||||
/usr/sbin/semodule -s targeted -i %{_datadir}/selinux/targeted/pymilter.pp \
|
||||
&>/dev/null || :
|
||||
%{_sbindir}/semodule -s targeted -i %{_datadir}/selinux/targeted/pymilter.pp \
|
||||
&>/dev/null || :
|
||||
|
||||
%postun selinux
|
||||
if [ $1 -eq 0 ] ; then
|
||||
/usr/sbin/semodule -s targeted -r pymilter &> /dev/null || :
|
||||
%{_sbindir}/semodule -s targeted -r pymilter &> /dev/null || :
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Tue Dec 13 2016 Stuart Gathman <stuart@gathman.org> 1.0.2-1
|
||||
- Fix the last setsymlist misspelling. Support in test framework and tests.
|
||||
- Add @symlist decorator.
|
||||
- Change body callback and a few other APIs to use bytes instead of str.
|
||||
* Wed Apr 17 2019 Stuart Gathman <stuart@gathman.org> - 1.0.4-1
|
||||
- New upstream release: cleanup unused files, additional platform support
|
||||
- Minor doc updates
|
||||
|
||||
* Tue Sep 20 2016 Stuart Gathman <stuart@gathman.org> 1.0.1-1
|
||||
- Support python3
|
||||
* Sun Dec 23 2018 Stuart Gathman <stuart@gathman.org> - 1.0.3-1
|
||||
- New upstream release
|
||||
- patch step for python3 no longer required in build
|
||||
|
||||
* Sat Mar 1 2014 Stuart Gathman <stuart@gathman.org> 1.0-2
|
||||
- Remove start.sh to track EPEL repository, suggest daemonize as replacement
|
||||
- Selinux subpackage should not care about pymilter version
|
||||
* Sat Aug 4 2018 Stuart Gathman <stuart@gathman.org> - 1.0.2-4
|
||||
- Add unit tests to %%check
|
||||
|
||||
* Wed Jun 26 2013 Stuart Gathman <stuart@gathman.org> 1.0-1
|
||||
- Allow ACCEPT as untrapped exception policy
|
||||
- Optional dir for getaddrset and getaddrdict in Milter.config
|
||||
- Show registered milter name in untrapped exception message.
|
||||
- Include selinux subpackage
|
||||
- Provide Milter.greylist export and Milter.greylist import to migrate data
|
||||
* Sat Aug 4 2018 Stuart Gathman <stuart@gathman.org> - 1.0.2-3
|
||||
- use libexec instead of libdir
|
||||
|
||||
* Sat Aug 4 2018 Stuart Gathman <stuart@gathman.org> - 1.0.2-2
|
||||
- add python34 subpackage on el7
|
||||
|
||||
* Sat Aug 4 2018 Stuart Gathman <stuart@gathman.org> - 1.0.2-1
|
||||
- build for both python2 and python3
|
||||
- add selinux policy allowing sendmail_t access to milters
|
||||
|
||||
* Tue Jul 17 2018 Miro Hrončok <mhroncok@redhat.com> - 1.0-13
|
||||
- Update Python macros to new packaging standards
|
||||
(See https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package)
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0-11
|
||||
- Update Python 2 dependency declarations to new packaging standards
|
||||
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.0-9
|
||||
- Escape macros in %%changelog
|
||||
|
||||
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.0-8
|
||||
- Python 2 binary package renamed to python2-pymilter
|
||||
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
>>>>>>> 021796e51e5919812f1c300d1830ef9ed378db2d
|
||||
|
||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-4
|
||||
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Sat Sep 27 2014 Paul Wouters <pwouters@redhat.com> - 1.0-1
|
||||
- Updated to 1.0
|
||||
- Use tmpfiles and /run
|
||||
|
||||
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Fri Jan 10 2014 Paul Wouters <pwouters@redhat.com> - 0.9.8-4
|
||||
- Add COPYING
|
||||
- Fix buildroot macros and dist macro
|
||||
|
||||
* Fri Jan 10 2014 Paul Wouters <pwouters@redhat.com> - 0.9.8-3
|
||||
- rebuilt with proper file permission
|
||||
|
||||
* Tue Jan 07 2014 Paul Wouters <pwouters@redhat.com> - 0.9.8-2
|
||||
- Fixup for fedora release
|
||||
|
||||
* Sat Mar 9 2013 Stuart Gathman <stuart@bmsi.com> 0.9.8-1
|
||||
- Add Milter.test module for unit testing milters.
|
||||
@@ -120,13 +225,13 @@ fi
|
||||
- Change untrapped exception message to:
|
||||
- "pymilter: untrapped exception in milter app"
|
||||
|
||||
* Thu Apr 12 2012 Stuart Gathman <stuart@bmsi.com> 0.9.7-1
|
||||
* Sat Feb 25 2012 Stuart Gathman <stuart@bmsi.com> 0.9.7-1
|
||||
- Raise RuntimeError when result != CONTINUE for @noreply and @nocallback
|
||||
- Remove redundant table in miltermodule
|
||||
- Fix CNAME chain duplicating TXT records in Milter.dns (from pyspf).
|
||||
|
||||
* Sat Feb 25 2012 Stuart Gathman <stuart@bmsi.com> 0.9.6-1
|
||||
- Raise ValueError on unescaped '%' passed to setreply
|
||||
- Raise ValueError on unescaped '%%' passed to setreply
|
||||
- Grace time at end of Greylist window
|
||||
|
||||
* Fri Aug 19 2011 Stuart Gathman <stuart@bmsi.com> 0.9.5-1
|
||||
|
||||
@@ -14,7 +14,7 @@ libdirs = ["/usr/lib/libmilter"] # needed for Debian
|
||||
modules = ["mime"]
|
||||
|
||||
# NOTE: importing Milter to obtain version fails when milter.so not built
|
||||
setup(name = "pymilter", version = '1.0.3',
|
||||
setup(name = "pymilter", version = '1.0.4',
|
||||
description="Python interface to sendmail milter API",
|
||||
long_description="""\
|
||||
This is a python extension module to enable python scripts to
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
appname="$1"
|
||||
script="${2:-${appname}}"
|
||||
datadir="/var/lib/milter"
|
||||
logdir="/var/log/milter"
|
||||
piddir="/var/run/milter"
|
||||
libdir="/usr/lib/pymilter"
|
||||
python="python2.4"
|
||||
exec >>${logdir}/${appname}.log 2>&1
|
||||
if test -s ${datadir}/${script}.py; then
|
||||
cd ${datadir} # use version in data dir if it exists for debugging
|
||||
elif test -s ${logdir}/${script}.py; then
|
||||
cd ${logdir} # use version in log dir if it exists for debugging
|
||||
else
|
||||
cd ${libdir}
|
||||
fi
|
||||
|
||||
${python} ${script}.py &
|
||||
echo $! >${piddir}/${appname}.pid
|
||||
Reference in New Issue
Block a user