mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 09:39:27 -05:00
Shuffle things around to make unit tests work
This commit is contained in:
parent
1168cbd54d
commit
a61e4522b5
@ -91,6 +91,7 @@ class Auth(object):
|
|||||||
if not hasattr(event, "room_id"):
|
if not hasattr(event, "room_id"):
|
||||||
raise AuthError(500, "Event has no room_id: %s" % event)
|
raise AuthError(500, "Event has no room_id: %s" % event)
|
||||||
|
|
||||||
|
if do_sig_check:
|
||||||
sender_domain = get_domain_from_id(event.sender)
|
sender_domain = get_domain_from_id(event.sender)
|
||||||
event_id_domain = get_domain_from_id(event.event_id)
|
event_id_domain = get_domain_from_id(event.event_id)
|
||||||
|
|
||||||
@ -101,12 +102,12 @@ class Auth(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check the sender's domain has signed the event
|
# Check the sender's domain has signed the event
|
||||||
if do_sig_check and not event.signatures.get(sender_domain):
|
if not event.signatures.get(sender_domain):
|
||||||
if not is_invite_via_3pid:
|
if not is_invite_via_3pid:
|
||||||
raise AuthError(403, "Event not signed by sender's server")
|
raise AuthError(403, "Event not signed by sender's server")
|
||||||
|
|
||||||
# Check the event_id's domain has signed the event
|
# Check the event_id's domain has signed the event
|
||||||
if do_sig_check and not event.signatures.get(event_id_domain):
|
if not event.signatures.get(event_id_domain):
|
||||||
raise AuthError(403, "Event not signed by sending server")
|
raise AuthError(403, "Event not signed by sending server")
|
||||||
|
|
||||||
if auth_events is None:
|
if auth_events is None:
|
||||||
|
@ -56,7 +56,7 @@ def get_domain_from_id(string):
|
|||||||
try:
|
try:
|
||||||
return string.split(":", 1)[1]
|
return string.split(":", 1)[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise SynapseError(400, "Invalid ID: %r", string)
|
raise SynapseError(400, "Invalid ID: %r" % (string,))
|
||||||
|
|
||||||
|
|
||||||
class DomainSpecificString(
|
class DomainSpecificString(
|
||||||
|
Loading…
Reference in New Issue
Block a user