From 745316930b9daa1ad72c8da02fa702531179b01f Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Fri, 17 Apr 2020 14:53:19 -0400 Subject: [PATCH] Fix postgresql issues. --- synapse/handlers/auth.py | 8 ++++++-- .../data_stores/main/schema/delta/58/persist_ui_auth.sql | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index b06dc43e0224..f591a7ebb4f4 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -289,10 +289,14 @@ async def check_auth( if "session" in authdict: sid = authdict["session"] + # Convert the URI and method to strings. + uri = request.uri.decode("utf-8") + method = request.uri.decode("utf-8") + # If there's no session ID, create a new session. if not sid: session_id = await self.store.create_session( - clientdict, request.uri, request.method, description + clientdict, uri, method, description ) else: @@ -316,7 +320,7 @@ async def check_auth( # comparator based on the URI, method, and body (minus the auth dict) # and storing it during the initial query. Subsequent queries ensure # that this comparator has not changed. - comparator = (request.uri, request.method, clientdict) + comparator = (uri, method, clientdict) if (session["uri"], session["method"], session["clientdict"]) != comparator: raise SynapseError( 403, diff --git a/synapse/storage/data_stores/main/schema/delta/58/persist_ui_auth.sql b/synapse/storage/data_stores/main/schema/delta/58/persist_ui_auth.sql index f9384096b643..d4cf015107f0 100644 --- a/synapse/storage/data_stores/main/schema/delta/58/persist_ui_auth.sql +++ b/synapse/storage/data_stores/main/schema/delta/58/persist_ui_auth.sql @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS ui_auth_sessions( session_id TEXT NOT NULL, -- The session ID passed to the client. - last_used BIGINT UNSIGNED NOT NULL, -- The last time this session was seen. + last_used BIGINT NOT NULL, -- The last time this session was seen. serverdict TEXT NOT NULL, -- A JSON dictionary of arbitrary data added by Synapse. clientdict TEXT NOT NULL, -- A JSON dictionary of arbitrary data from the client. uri TEXT NOT NULL, -- The URI the UI authentication session is using.