From 6f75a1a967acb7baf4df60dd5d89df81f013b61c Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Fri, 9 Aug 2019 11:28:53 -0400 Subject: [PATCH] - Fix verify processing so missing (optional) i= tag doesn't cause the milter to fail --- CHANGES | 2 ++ dkimpy_milter/__init__.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4ad402b..9210699 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,8 @@ - Add support for passing PID file name on command line to make it easier to keep system init and daemon configuration in sync - Fix startup logging so it provides information at a useful time + - Fix verify processing so missing (optional) i= tag doesn't cause the milter + to fail 1.1.0 2019-04-12 - Add SubDomains option to enable signing for sub-domains (LP: #1811535) diff --git a/dkimpy_milter/__init__.py b/dkimpy_milter/__init__.py index 0440967..6052b85 100644 --- a/dkimpy_milter/__init__.py +++ b/dkimpy_milter/__init__.py @@ -289,7 +289,11 @@ class dkimMilter(Milter.Base): self.dkim_comment = str(x) if milterconfig.get('Syslog'): syslog.syslog("check_dkim: {0}".format(x)) - self.header_i = codecs.decode(d.signature_fields.get(b'i'), 'ascii') + try: + # i= is optional and dkimpy is fine if it's not provided + self.header_i = codecs.decode(d.signature_fields.get(b'i'), 'ascii') + except TypeError as x: + pass self.header_d = codecs.decode(d.signature_fields.get(b'd'), 'ascii') self.header_a = codecs.decode(d.signature_fields.get(b'a'), 'ascii') if res: