From 7c3ff1905af6c556e8da67eef1e05dbea1f462d8 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 f6d0c8e..1f9112d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 1.1.1 UNRELEASED + - Fix verify processing so missing (optional) i= tag doesn't cause the milter + to fail - Fix message extraction so that signing in the same pass through the milter as verifying works correctly diff --git a/dkimpy_milter/__init__.py b/dkimpy_milter/__init__.py index 0da066b..e21fa17 100644 --- a/dkimpy_milter/__init__.py +++ b/dkimpy_milter/__init__.py @@ -288,7 +288,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: