WIP for invalid UTF-8 resilience

This commit is contained in:
Scott Kitterman
2020-08-09 13:50:40 -04:00
parent 88c17516d9
commit 44d8924060
4 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
1.2.2
1.3.0 WARNING LAST COMMIT IS WIP
- Improve resilience to malformed email addresses
- Improve README.md formating for markdown display on pypi
- Improve documentation in dkimpy-milter.conf (5) and README.md for signing
+4 -2
View File
@@ -107,9 +107,11 @@ class dkimMilter(Milter.Base):
# envfrom (MAIL FROM in the SMTP protocol) seems to mark the start
# of each message.
@Milter.noreply
def envfrom(self, f, *str):
def envfrom(self, f, *moredata):
f = str(codecs.encode(f, 'UTF-8', 'replace'), 'UTF-8', 'ignore')
moredata = str(codecs.encode(str(moredata), 'UTF-8', 'replace'), 'UTF-8', 'ignore')
if self.conf.get('Syslog') and self.conf.get('debugLevel') >= 2:
syslog.syslog("mail from: {0} {1}".format(f, str))
syslog.syslog("mail from: {0} {1}".format(f, moredata))
self.fp = io.BytesIO()
self.mailfrom = f
t = parse_addr(f)
+1 -1
View File
@@ -89,7 +89,7 @@ except ImportError: # If PyDNS is not installed, prefer dnspython
setup(
name='dkimpy-milter',
version='1.2.1',
version='1.3.0',
author='Scott Kitterman',
author_email='scott@kitterman.com',
url='https://launchpad.net/dkimpy-milter',
+1 -1
View File
@@ -26,7 +26,7 @@ function connect_and_send (sockname, headers, body)
end
-- mt.macro(conn, SMFIC_MAIL, "i", "simple-message")
if mt.mailfrom(conn, "<alice@example.net>") ~= nil then
if mt.mailfrom(conn, "<alicüe@example.net> (Alicþþÿÿe)") ~= nil then
error "mt.mailfrom() failed"
end
if mt.getreply(conn) ~= SMFIR_CONTINUE then