mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
fix several bugs to allow sending challenges from server correctly
This commit is contained in:
parent
4136f32091
commit
800f255db6
1 changed files with 13 additions and 7 deletions
|
|
@ -116,7 +116,7 @@ class session(object):
|
|||
def challenges(self):
|
||||
n = int(sessions.hget(self.id, "challenges"))
|
||||
for i in xrange(n):
|
||||
yield r.hgetall("session:%d" % i)
|
||||
yield sessions.hgetall("%s:%d" % (self.id, i))
|
||||
|
||||
def send_cert(self, m, r):
|
||||
"""Initialize response to return issued cert to client."""
|
||||
|
|
@ -236,7 +236,7 @@ class session(object):
|
|||
if state == "makechallenge" or state == "issue":
|
||||
r.proceed.timestamp = int(time.time())
|
||||
r.proceed.polldelay = 10
|
||||
return
|
||||
return
|
||||
# If we're in testchallenge, tell the client about the challenges and their
|
||||
# current status.
|
||||
if state == "testchallenge":
|
||||
|
|
@ -267,13 +267,19 @@ class session(object):
|
|||
# TODO: This needs a more sophisticated notion of success/failure,
|
||||
# and also of the possibility of multiple data strings.
|
||||
for c in self.challenges():
|
||||
chall = r.challenges.add()
|
||||
# Currently, we can only handle challenge type 0 (dvsni)
|
||||
# TODO: unify names "succeeded" vs. "satisfied"?
|
||||
if int(c["type"]) != 0:
|
||||
self.die(r, r.BadRequest, uri="https://ca.example.com/failures/internalerror")
|
||||
return
|
||||
chall = r.challenge.add()
|
||||
chall.type = int(c["type"])
|
||||
chall.name = c["name"]
|
||||
chall.satisfied = c["satisfied"]
|
||||
chall.succeeded = c["succeeded"]
|
||||
chall.data.append(c["data"])
|
||||
|
||||
chall.succeeded = (c["satisfied"] == "True") # TODO: this contradicts comment in protocol about meaning of "succeeded"
|
||||
chall.data.append(c["dvsni:r"])
|
||||
chall.data.append(c["dvsni:nonce"])
|
||||
chall.data.append(c["dvsni:ext"])
|
||||
|
||||
def POST(self):
|
||||
web.header("Content-type", "application/x-protobuf+chocolate")
|
||||
# web.setcookie("chocolate", hmac("foo", "bar"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue