From dd6bbd4c88ed5ca767fc3d734c9574133b615366 Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Tue, 28 Feb 2023 00:02:07 -0500 Subject: [PATCH] - Fix traceback when attempting to verify an unsigned message using async verify (Thanks to Nikita Sychev for the report and a suggested fix) (LP: #2008723) --- ChangeLog | 3 +++ dkim/asyncsupport.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2bc9fd..0fceee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ Version 1.1.1 - Document dropping of Python 2 support (dropped as of 1.1.0) (LP: #20086738) + - Fix traceback when attempting to verify an unsigned message using + async verify (Thanks to Nikita Sychev for the report and a suggested + fix) (LP: #2008723) 2023-02-25 Version 1.1.0 - Add domain validity check for ascii domains (no specials) diff --git a/dkim/asyncsupport.py b/dkim/asyncsupport.py index 226cc42..141c2cc 100644 --- a/dkim/asyncsupport.py +++ b/dkim/asyncsupport.py @@ -94,8 +94,11 @@ class DKIM(dkim.DKIM): async def verify(self,idx=0,dnsfunc=get_txt_async): - sig, include_headers, sigheaders = self.verify_headerprep(idx=0) - return await self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc) + prep = self.verify_headerprep(idx) + if prep: + sig, include_headers, sigheaders = prep + return await self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc) + return False # No signature async def verify_async(message, logger=None, dnsfunc=None, minkey=1024,