fix(persistent_sessions): protect against looking up stale data

This commit is contained in:
Tobias Lindahl 2021-11-01 13:50:16 +01:00
parent 329dd4d780
commit ce49a281ed
1 changed files with 11 additions and 6 deletions

View File

@ -179,12 +179,17 @@ timestamp_from_conninfo(ConnInfo) ->
end. end.
lookup(ClientID) when is_binary(ClientID) -> lookup(ClientID) when is_binary(ClientID) ->
case lookup_session_store(ClientID) of case is_store_enabled() of
none -> none; false ->
{value, #session_store{session = S} = SS} -> none;
case persistent_session_status(SS) of true ->
expired -> {expired, S}; case lookup_session_store(ClientID) of
persistent -> {persistent, S} none -> none;
{value, #session_store{session = S} = SS} ->
case persistent_session_status(SS) of
expired -> {expired, S};
persistent -> {persistent, S}
end
end end
end. end.