From bc024d02c5dbf183ba0a78361802451e4b06d3ed Mon Sep 17 00:00:00 2001 From: James Kasten Date: Fri, 16 Nov 2012 16:34:34 -0500 Subject: [PATCH] minor payment challenge protocol fixes --- trustify/client/client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trustify/client/client.py b/trustify/client/client.py index 40ec0bb71..f646c99c2 100644 --- a/trustify/client/client.py +++ b/trustify/client/client.py @@ -409,8 +409,10 @@ def renew(config): # Wait for response, act accordingly gen_req_from_cert() -def all_payment_challenge(challenges): - for chall in challenges: +def all_payment_challenge(r): + if not r.challenge: + return False + for chall in r.challenge: if chall.type != r.Payment: return False @@ -514,7 +516,7 @@ def authenticate(): logger.debug(r) delay = 5 #while r.challenge or r.proceed.IsInitialized(): - while r.proceed.IsInitialized() or (r.challenge and not all_payment_challenge(r.challenge)): + while r.proceed.IsInitialized() or (r.challenge and not all_payment_challenge(r)): if r.proceed.IsInitialized(): delay = min(r.proceed.polldelay, 60) logger.debug("waiting %d" % delay) @@ -526,10 +528,10 @@ def authenticate(): # This should be invoked if a payment in necessary # This is being tested and will have to be cleaned and organized # once the protocol is finalized. - if r.challenge and all_payment_challenge(r.challenge): + if r.challenge and all_payment_challenge(r): challenges, dn = challenge_factory(r, os.path.abspath(req_file), os.path.abspath(key_file), config) for chall in challenges: - chall.perform(quiet) + chall.perform(quiet=curses) logger.info("User has continued Trustify after submitting payment") proceed_msg = chocolatemessage()