From b78ccf5a4b774afb2940e9cd78b2b972736885c6 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Sun, 19 Feb 2017 13:54:22 -0800 Subject: [PATCH] Handle _find_candidate_keys None return case. [Issue #236] --- dns/dnssec.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dns/dnssec.py b/dns/dnssec.py index 6e9d4103..f316636a 100644 --- a/dns/dnssec.py +++ b/dns/dnssec.py @@ -294,10 +294,11 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None): if isinstance(origin, string_types): origin = dns.name.from_text(origin, dns.name.root) - for candidate_key in _find_candidate_keys(keys, rrsig): - if not candidate_key: - raise ValidationFailure('unknown key') + candidate_keys = _find_candidate_keys(keys, rrsig) + if candidate_keys is None: + raise ValidationFailure('unknown key') + for candidate_key in candidate_keys: # For convenience, allow the rrset to be specified as a (name, # rdataset) tuple as well as a proper rrset if isinstance(rrset, tuple): -- 2.47.3