summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-10 10:06:12 +0000
committerErik Johnston <erik@matrix.org>2014-12-10 11:37:47 +0000
commit95aa903ffa77effcbca2a510744c3c3fa9b46ed3 (patch)
treeda5d6eeec5da95549d19e97a072ce575c0fadf41 /synapse/handlers/federation.py
parentThis is to test jenkins (diff)
downloadsynapse-95aa903ffa77effcbca2a510744c3c3fa9b46ed3.tar.xz
Try and figure out how and why signatures are being changed.
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r--synapse/handlers/federation.py54
1 files changed, 51 insertions, 3 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 827c86c9da..9ae3e5eca4 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -459,10 +459,22 @@ class FederationHandler(BaseHandler):
         """
         event = pdu
 
+        logger.debug(
+            "on_send_join_request: Got event: %s, signatures: %s",
+            event.event_id,
+            event.signatures,
+        )
+
         event.internal_metadata.outlier = False
 
         context = yield self._handle_new_event(event)
 
+        logger.debug(
+            "on_send_join_request: After _handle_new_event: %s, sigs: %s",
+            event.event_id,
+            event.signatures,
+        )
+
         extra_users = []
         if event.type == RoomMemberEvent.TYPE:
             target_user_id = event.state_key
@@ -496,6 +508,12 @@ class FederationHandler(BaseHandler):
                     "Failed to get destination from event %s", s.event_id
                 )
 
+        logger.debug(
+            "on_send_join_request: Sending event: %s, signatures: %s",
+            event.event_id,
+            event.signatures,
+        )
+
         yield self.replication_layer.send_pdu(new_pdu, destinations)
 
         auth_chain = yield self.store.get_auth_chain(event.event_id)
@@ -652,12 +670,23 @@ class FederationHandler(BaseHandler):
     def _handle_new_event(self, event, state=None, backfilled=False,
                           current_state=None, fetch_missing=True):
         context = EventContext()
+
+        logger.debug(
+            "_handle_new_event: Before annotate: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         yield self.state_handler.annotate_context_with_state(
             event,
             context,
             old_state=state
         )
 
+        logger.debug(
+            "_handle_new_event: Before auth fetch: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         is_new_state = not event.internal_metadata.outlier
 
         known_ids = set(
@@ -666,29 +695,43 @@ class FederationHandler(BaseHandler):
         for e_id, _ in event.auth_events:
             if e_id not in known_ids:
                 e = yield self.store.get_event(
-                    e_id,
-                    allow_none=True,
+                    e_id, allow_none=True,
                 )
 
                 if not e:
                     # TODO: Do some conflict res to make sure that we're
                     # not the ones who are wrong.
                     logger.info(
-                        "Rejecting %s as %s not in %s",
+                        "Rejecting %s as %s not in db or %s",
                         event.event_id, e_id, known_ids,
                     )
                     raise AuthError(403, "Auth events are stale")
 
                 context.auth_events[(e.type, e.state_key)] = e
 
+        logger.debug(
+            "_handle_new_event: Before hack: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         if event.type == RoomMemberEvent.TYPE and not event.auth_events:
             if len(event.prev_events) == 1:
                 c = yield self.store.get_event(event.prev_events[0][0])
                 if c.type == RoomCreateEvent.TYPE:
                     context.auth_events[(c.type, c.state_key)] = c
 
+        logger.debug(
+            "_handle_new_event: Before auth check: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         self.auth.check(event, auth_events=context.auth_events)
 
+        logger.debug(
+            "_handle_new_event: Before persist_event: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         yield self.store.persist_event(
             event,
             context=context,
@@ -697,4 +740,9 @@ class FederationHandler(BaseHandler):
             current_state=current_state,
         )
 
+        logger.debug(
+            "_handle_new_event: After persist_event: %s, sigs: %s",
+            event.event_id, event.signatures,
+        )
+
         defer.returnValue(context)