From f9483fea8cbdd4126cdc5f2e965cd338abfbf22c Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Thu, 15 Mar 2018 20:42:49 -0400 Subject: [PATCH] - Added protection for malformed From addresses. If the From does not at least have an '@' in the address, then the signing domain is not extracted and the message will not be signed --- CHANGES | 5 ++++- dkimpy_milter/__init__.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 83693a6..071223b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,11 @@ -0.9.6 UNRELEASED +0.9.6 2018-03-13 - Fixed typo in package installation section of README - Added more to README about first run with systemd - Fixed typo in path for fallback location of the config file if one is not provided + - Added protection for malformed From addresses. If the From does not at + least have an '@' in the address, then the signing domain is not extracted + and the message will not be signed 0.9.5.1 2018-03-10 - Add conf file location to systemd unit file diff --git a/dkimpy_milter/__init__.py b/dkimpy_milter/__init__.py index 44060c8..41921c9 100644 --- a/dkimpy_milter/__init__.py +++ b/dkimpy_milter/__init__.py @@ -130,7 +130,10 @@ class dkimMilter(Milter.Base): self.has_dkim += 1 if lname == 'from': fname, self.author = parseaddr(val) - self.fdomain = self.author.split('@')[1] + try: + self.fdomain = self.author.split('@')[1] + except IndexError as er: + self.fdomain = '' # self.author was not a proper email address if (milterconfig.get('Syslog') and milterconfig.get('debugLevel') >= 1): syslog.syslog("{0}: {1}".format(name, val))