From 10e12c60d8904ddd1a96d3a62bbc8025f186ff50 Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Thu, 21 Dec 2017 16:35:42 -0500 Subject: [PATCH] - Fix unbound local variable error when processing signatures with an x tag, but no t tag (LP: #1739637) --- ChangeLog | 2 ++ dkim/__init__.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 59c06cb..34df70d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ UNRELEASED Version 0.7.0 correct when the optional k= tag is not present in the DKIM public key record - Fix -v verbose reporting in dkimverify.py + - Fix unbound local variable error when processing signatures with an x + tag, but no t tag (LP: #1739637) 2017-05-30 Version 0.6.2 - Fixed problem with header folding that caused the first line to be diff --git a/dkim/__init__.py b/dkim/__init__.py index aa3cfbe..fc4d369 100644 --- a/dkim/__init__.py +++ b/dkim/__init__.py @@ -260,6 +260,8 @@ def validate_signature_fields(sig, mandatory_fields=[b'v', b'a', b'b', b'bh', b' raise ValidationError( "x= value is not a decimal integer (%s)" % sig[b'x']) x_sign = int(sig[b'x']) + now = int(time.time()) + slop = 36000 # 10H leeway for mailers with inaccurate clocks if x_sign < now - slop: raise ValidationError( "x= value is past (%s)" % sig[b'x'])