Only fail individular deferred for invalid signature

This commit is contained in:
Erik Johnston 2015-06-24 13:04:37 +01:00
parent f4964e666a
commit ec6ceadeeb
1 changed files with 11 additions and 10 deletions

View File

@ -64,21 +64,22 @@ class Keyring(object):
group_ids = [] group_ids = []
next_group_id = 0 next_group_id = 0
deferreds = {}
for server_name, json_object in server_and_json: for server_name, json_object in server_and_json:
logger.debug("Verifying for %s", server_name) logger.debug("Verifying for %s", server_name)
key_ids = signature_ids(json_object, server_name)
if not key_ids:
raise SynapseError(
400,
"Not signed with a supported algorithm",
Codes.UNAUTHORIZED,
)
group_id = next_group_id group_id = next_group_id
next_group_id += 1 next_group_id += 1
group_ids.append(group_id) group_ids.append(group_id)
key_ids = signature_ids(json_object, server_name)
if not key_ids:
deferreds[group_id] = defer.fail(SynapseError(
400,
"Not signed with a supported algorithm",
Codes.UNAUTHORIZED,
))
group = KeyGroup(server_name, group_id, key_ids) group = KeyGroup(server_name, group_id, key_ids)
group_id_to_group[group_id] = group group_id_to_group[group_id] = group
@ -124,9 +125,9 @@ class Keyring(object):
Codes.UNAUTHORIZED, Codes.UNAUTHORIZED,
) )
deferreds = self.get_server_verify_keys( deferreds.update(self.get_server_verify_keys(
group_id_to_group group_id_to_group
) ))
logger.info( logger.info(
"Deferred count: %d vs. %d", "Deferred count: %d vs. %d",