UnboundLocalError: local variable 'now' referenced before assignment

Bug #1739637 reported by Cyril N. on 2017-12-21
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Scott Kitterman

Bug Description

Running the dkim.verify() code, I got the following exception on some cases:

  File "/var/www/venv/local/lib/python2.7/site-packages/dkim/__init__.py", line 1037, in verify │
    return d.verify(dnsfunc=dnsfunc) │
  File "/var/www/venv/local/lib/python2.7/site-packages/dkim/__init__.py", line 704, in verify │
    validate_signature_fields(sig) │
  File "/var/www/venv/local/lib/python2.7/site-packages/dkim/__init__.py", line 252, in validate_signature_fields │
    if x_sign < now - slop: │
UnboundLocalError: local variable 'now' referenced before assignment

Changed in dkimpy:
importance: Undecided → High
status: New → Triaged
assignee: nobody → Scott Kitterman (kitterman)
milestone: none → 0.7.0
Scott Kitterman (kitterman) wrote :

Thanks. I see the problem.

'now' is set when the t= Signature Timestamp signature tag is parsed and then used when the x= Signature Expiration tag is parsed and evaluated as well.

Changed in dkimpy:
status: Triaged → Fix Committed
Cyril N. (cnicodeme) wrote :

Wow that was fast! Nice job! Thank you :)

Scott Kitterman (kitterman) wrote :

Fixed in 0.7.0.

Changed in dkimpy:
milestone: 0.7.0 → none
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers