diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-01-07 15:16:31 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-01-07 15:21:48 +0000 |
commit | 9cb4f75d53d99634e79e791de22cb7de718248d6 (patch) | |
tree | ddaec5717f7348800bbc641b6ab421ec1aa8a8ad /synapse/api/auth.py | |
parent | *cough* (diff) | |
download | synapse-9cb4f75d53d99634e79e791de22cb7de718248d6.tar.xz |
SYN-154: Better error messages when joining an unknown room by ID.
The simple fix doesn't work here because room creation also involves unknown room IDs. The check relies on the presence of m.room.create for rooms being created, whereas bogus room IDs have no state events at all.
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r-- | synapse/api/auth.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index e31482cfaa..8a3455ec54 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -98,7 +98,16 @@ class Auth(object): defer.returnValue(member) @defer.inlineCallbacks - def check_host_in_room(self, room_id, host): + def check_host_in_room(self, room_id, host, context=None): + if context: + # XXX: check_host_in_room should really return True for a new + # room created by this home server. There are no m.room.member + # join events yet so we need to check for the m.room.create event + # instead. + if (u"m.room.create", u"") in context.auth_events: + defer.returnValue(True) + return + curr_state = yield self.state.get_current_state(room_id) for event in curr_state: |