summary refs log tree commit diff
path: root/synapse/handlers/e2e_keys.py
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2019-09-05 17:03:31 -0400
committerHubert Chathi <hubert@uhoreg.ca>2019-09-05 17:03:31 -0400
commit369462da7488772ea6d2fdd076ff355bc09db28c (patch)
treee89355b57d5882696942623e63c50bfbf736b181 /synapse/handlers/e2e_keys.py
parentfix test (diff)
downloadsynapse-369462da7488772ea6d2fdd076ff355bc09db28c.tar.xz
avoid modifying input parameter
Diffstat (limited to 'synapse/handlers/e2e_keys.py')
-rw-r--r--synapse/handlers/e2e_keys.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/synapse/handlers/e2e_keys.py b/synapse/handlers/e2e_keys.py
index d5d6e6e027..2c21cb9828 100644
--- a/synapse/handlers/e2e_keys.py
+++ b/synapse/handlers/e2e_keys.py
@@ -629,9 +629,9 @@ class E2eKeysHandler(object):
 
         # split between checking signatures for own user and signatures for
         # other users, since we verify them with different keys
-        if user_id in signatures:
-            self_signatures = signatures[user_id]
-            del signatures[user_id]
+        self_signatures = signatures.get(user_id, {})
+        other_signatures = {k: v for k, v in signatures.items() if k != user_id}
+        if self_signatures:
             self_device_ids = list(self_signatures.keys())
             try:
                 # get our self-signing key to verify the signatures
@@ -766,9 +766,9 @@ class E2eKeysHandler(object):
                 }
 
         signed_users = []  # what user have been signed, for notifying
-        if len(signatures):
-            # if signatures isn't empty, then we have signatures for other
-            # users.  These signatures will be signed by the user signing key
+        if other_signatures:
+            # now check non-self signatures.  These signatures will be signed
+            # by the user-signing key
 
             try:
                 # get our user-signing key to verify the signatures
@@ -776,7 +776,7 @@ class E2eKeysHandler(object):
                     user_id, "user_signing"
                 )
 
-                for user, devicemap in signatures.items():
+                for user, devicemap in other_signatures.items():
                     device_id = None
                     try:
                         # get the user's master key, to make sure it matches