Compare commits

..

2 Commits

3 changed files with 19 additions and 9 deletions
+5
View File
@@ -1,3 +1,8 @@
1.2.3
- Logging fixups: Don't traceback for non-UTF-8 data in mail headers and
don't put byte string markers in logs (some remain, but are from dkimpy
and should be fixed there), related to LP: #1980821.
1.2.2 2020-08-09 1.2.2 2020-08-09
- Improve README.md formating for markdown display on pypi - Improve README.md formating for markdown display on pypi
- Improve documentation in dkimpy-milter.conf (5) and README.md for signing - Improve documentation in dkimpy-milter.conf (5) and README.md for signing
+13 -8
View File
@@ -107,9 +107,10 @@ class dkimMilter(Milter.Base):
# envfrom (MAIL FROM in the SMTP protocol) seems to mark the start # envfrom (MAIL FROM in the SMTP protocol) seems to mark the start
# of each message. # of each message.
@Milter.noreply @Milter.noreply
def envfrom(self, f, *str): def envfrom(self, f, *stri):
if self.conf.get('Syslog') and self.conf.get('debugLevel') >= 2: if self.conf.get('Syslog') and self.conf.get('debugLevel') >= 2:
syslog.syslog("mail from: {0} {1}".format(f, str)) f = str(bytes(f, encoding='utf-8', errors='replace'))[2:-1]
syslog.syslog("mail from: {0} {1}".format(f, stri))
self.fp = io.BytesIO() self.fp = io.BytesIO()
self.mailfrom = f self.mailfrom = f
t = parse_addr(f) t = parse_addr(f)
@@ -133,7 +134,8 @@ class dkimMilter(Milter.Base):
if lname == 'dkim-signature': if lname == 'dkim-signature':
if (self.conf.get('Syslog') and if (self.conf.get('Syslog') and
self.conf.get('debugLevel') >= 1): self.conf.get('debugLevel') >= 1):
syslog.syslog("{0}: {1}".format(name, val)) val2 = str(bytes(val, encoding='utf-8', errors='replace'))[2:-1]
syslog.syslog("{0}: {1}".format(name, val2))
self.has_dkim += 1 self.has_dkim += 1
if lname == 'from': if lname == 'from':
fname, self.author = parseaddr(val) fname, self.author = parseaddr(val)
@@ -143,7 +145,8 @@ class dkimMilter(Milter.Base):
pass # self.author was not a proper email address pass # self.author was not a proper email address
if (self.conf.get('Syslog') and if (self.conf.get('Syslog') and
self.conf.get('debugLevel') >= 1): self.conf.get('debugLevel') >= 1):
syslog.syslog("{0}: {1}".format(name, val)) val2 = str(bytes(val, encoding='utf-8', errors='replace'))[2:-1]
syslog.syslog("{0}: {1}".format(name, val2))
elif lname == 'authentication-results': elif lname == 'authentication-results':
self.arheaders.append(val) self.arheaders.append(val)
if self.fp: if self.fp:
@@ -181,7 +184,8 @@ class dkimMilter(Milter.Base):
self.chgheader('authentication-results', i, '') self.chgheader('authentication-results', i, '')
if (self.conf.get('Syslog') and if (self.conf.get('Syslog') and
self.conf.get('debugLevel') >= 1): self.conf.get('debugLevel') >= 1):
syslog.syslog('REMOVE: {0}'.format(val)) val2 = str(bytes(val, encoding='utf-8', errors='replace'))[2:-1]
syslog.syslog('REMOVE: {0}'.format(val2))
except: except:
# Don't error out on unparseable AR header fiels # Don't error out on unparseable AR header fiels
pass pass
@@ -428,7 +432,8 @@ class dkimMilter(Milter.Base):
if self.conf.get('Syslog'): if self.conf.get('Syslog'):
if d.domain: if d.domain:
syslog.syslog('DKIM: Fail ({0})' syslog.syslog('DKIM: Fail ({0})'
.format(d.domain.lower())) .format(str(d.domain.lower(), 'UTF-8',
errors='replace')))
else: else:
syslog.syslog('DKIM: Fail, unextractable domain') syslog.syslog('DKIM: Fail, unextractable domain')
if res: if res:
@@ -438,13 +443,13 @@ class dkimMilter(Milter.Base):
res = False res = False
if self.header_d: if self.header_d:
self.arresults.append( self.arresults.append(
authres.DKIMAuthenticationResult(result=result, authres.DKIMAuthenticationResult(result=result[2:-1],
header_i=self.header_i, header_i=self.header_i,
header_d=self.header_d, header_d=self.header_d,
header_a=self.header_a, header_a=self.header_a,
result_comment= result_comment=
self.dkim_comment) self.dkim_comment)
) )
self.header_a = None self.header_a = None
return return
+1 -1
View File
@@ -89,7 +89,7 @@ except ImportError: # If PyDNS is not installed, prefer dnspython
setup( setup(
name='dkimpy-milter', name='dkimpy-milter',
version='1.2.2', version='1.2.1',
author='Scott Kitterman', author='Scott Kitterman',
author_email='scott@kitterman.com', author_email='scott@kitterman.com',
url='https://launchpad.net/dkimpy-milter', url='https://launchpad.net/dkimpy-milter',