summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-05 11:07:54 +0000
committerErik Johnston <erik@matrix.org>2014-11-05 11:07:54 +0000
commit96c001e6688617cc365f548a3152a32c647ebc59 (patch)
tree678b86f68ca706a34dd4b73591f549e7f7ca9469 /synapse/handlers
parentPEP8 (diff)
downloadsynapse-96c001e6688617cc365f548a3152a32c647ebc59.tar.xz
Fix auth checks to all use the given old_event_state
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/_base.py19
-rw-r--r--synapse/handlers/federation.py6
2 files changed, 17 insertions, 8 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index 28b64565ae..509f7b550c 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -20,6 +20,12 @@ from synapse.util.async import run_on_reactor
 
 from synapse.crypto.event_signing import add_hashes_and_signatures
 
+import logging
+
+
+logger = logging.getLogger(__name__)
+
+
 class BaseHandler(object):
 
     def __init__(self, hs):
@@ -58,15 +64,18 @@ class BaseHandler(object):
 
         yield self.state_handler.annotate_state_groups(event)
 
-        yield add_hashes_and_signatures(
+        logger.debug("Signing event...")
+
+        add_hashes_and_signatures(
             event, self.server_name, self.signing_key
         )
 
-        if not suppress_auth:
-            yield self.auth.check(event, snapshot, raises=True)
+        logger.debug("Signed event.")
 
-        if hasattr(event, "state_key"):
-            yield self.state_handler.handle_new_event(event, snapshot)
+        if not suppress_auth:
+            logger.debug("Authing...")
+            self.auth.check(event, raises=True)
+            logger.debug("Authed")
 
         yield self.store.persist_event(event)
 
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 06a2dabae2..1464a60937 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -118,7 +118,7 @@ class FederationHandler(BaseHandler):
         logger.debug("Event: %s", event)
 
         try:
-            yield self.auth.check(event, None, raises=True)
+            self.auth.check(event, raises=True)
         except AuthError as e:
             raise FederationError(
                 "ERROR",
@@ -319,7 +319,7 @@ class FederationHandler(BaseHandler):
         snapshot.fill_out_prev_events(event)
 
         yield self.state_handler.annotate_state_groups(event)
-        yield self.auth.check(event, None, raises=True)
+        self.auth.check(event, raises=True)
 
         pdu = self.pdu_codec.pdu_from_event(event)
 
@@ -333,7 +333,7 @@ class FederationHandler(BaseHandler):
         event.outlier = False
 
         is_new_state = yield self.state_handler.annotate_state_groups(event)
-        yield self.auth.check(event, None, raises=True)
+        self.auth.check(event, raises=True)
 
         # FIXME (erikj):  All this is duplicated above :(