diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2023-05-05 15:06:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-05 15:06:22 +0100 |
commit | e46d5f3586025a491d11a31ce2be4c540c38d404 (patch) | |
tree | 1a0d9a7b99cf0d7a0e19143c588f4b077f559fad /synapse/federation/federation_server.py | |
parent | Allow running Complement integration tests via podman (#15543) (diff) | |
download | synapse-e46d5f3586025a491d11a31ce2be4c540c38d404.tar.xz |
Factor out an `is_mine_server_name` method (#15542)
Add an `is_mine_server_name` method, similar to `is_mine_id`. Ideally we would use this consistently, instead of sometimes comparing against `hs.hostname` and other times reaching into `hs.config.server.server_name`. Also fix a bug in the tests where `hs.hostname` would sometimes differ from `hs.config.server.server_name`. Signed-off-by: Sean Quah <seanq@matrix.org>
Diffstat (limited to 'synapse/federation/federation_server.py')
-rw-r--r-- | synapse/federation/federation_server.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index ca43c7bfc0..c590d8f96f 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -129,6 +129,7 @@ class FederationServer(FederationBase): def __init__(self, hs: "HomeServer"): super().__init__(hs) + self.server_name = hs.hostname self.handler = hs.get_federation_handler() self._spam_checker_module_callbacks = hs.get_module_api_callbacks().spam_checker self._federation_event_handler = hs.get_federation_event_handler() @@ -942,7 +943,7 @@ class FederationServer(FederationBase): authorising_server = get_domain_from_id( event.content[EventContentFields.AUTHORISING_USER] ) - if authorising_server != self.server_name: + if not self._is_mine_server_name(authorising_server): raise SynapseError( 400, f"Cannot authorise request from resident server: {authorising_server}", |