summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-09-12 20:44:18 +1000
committerGitHub <noreply@github.com>2018-09-12 20:44:18 +1000
commit546aee7e52e2dfef0ccd9d5592a162c2c23279d5 (patch)
tree25deaaea120e35ca8bec288258f61c1628695b91
parentMerge pull request #3826 from matrix-org/rav/logging_for_keyring (diff)
parentadd changelog (diff)
downloadsynapse-546aee7e52e2dfef0ccd9d5592a162c2c23279d5.tar.xz
Merge pull request #3835 from krombel/fix_3821
fix VOIP crashes under Python 3
-rw-r--r--changelog.d/3835.bugfix1
-rw-r--r--synapse/rest/client/v1/voip.py6
2 files changed, 6 insertions, 1 deletions
diff --git a/changelog.d/3835.bugfix b/changelog.d/3835.bugfix
new file mode 100644
index 0000000000..00dbcbc8dc
--- /dev/null
+++ b/changelog.d/3835.bugfix
@@ -0,0 +1 @@
+fix VOIP crashes under Python 3 (#3821)
diff --git a/synapse/rest/client/v1/voip.py b/synapse/rest/client/v1/voip.py
index 62f4c3d93e..53da905eea 100644
--- a/synapse/rest/client/v1/voip.py
+++ b/synapse/rest/client/v1/voip.py
@@ -42,7 +42,11 @@ class VoipRestServlet(ClientV1RestServlet):
             expiry = (self.hs.get_clock().time_msec() + userLifetime) / 1000
             username = "%d:%s" % (expiry, requester.user.to_string())
 
-            mac = hmac.new(turnSecret, msg=username, digestmod=hashlib.sha1)
+            mac = hmac.new(
+                turnSecret.encode(),
+                msg=username.encode(),
+                digestmod=hashlib.sha1
+            )
             # We need to use standard padded base64 encoding here
             # encode_base64 because we need to add the standard padding to get the
             # same result as the TURN server.