From 095f68d94356f7b9b9b74c8a9f795788202756ba Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Mon, 6 Apr 2020 00:27:04 -0400 Subject: [PATCH] - Correct dkim.verify processing to avoid errors when verifying messages with no DKIM signatures --- ChangeLog | 2 ++ dkim/__init__.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea2903a..a7d3e2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Version 1.1 - Correct signature indexing error introduced in 1.0.0 that prevents verification of multiple signatures in a single message + - Correct dkim.verify processing to avoid errors when verifying messages + with no DKIM signatures 2019-12-31 Version 1.0.2 - dknewkey: On posix operating systems set file permissions to 600 for diff --git a/dkim/__init__.py b/dkim/__init__.py index 4100f97..51ceab0 100644 --- a/dkim/__init__.py +++ b/dkim/__init__.py @@ -934,8 +934,11 @@ class DKIM(DomainSigner): #: @return: True if signature verifies or False otherwise #: @raise DKIMException: when the message, signature, or key are badly formed def verify(self,idx=0,dnsfunc=get_txt): - sig, include_headers, sigheaders = self.verify_headerprep(idx) - return self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc) + prep = self.verify_headerprep(idx) + if prep: + sig, include_headers, sigheaders = prep + return self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc) + return False # No signature #: Hold messages and options during ARC signing and verification.