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.
lookup(ClientID) when is_binary(ClientID) ->
case lookup_session_store(ClientID) of
none -> none;
{value, #session_store{session = S} = SS} ->
case persistent_session_status(SS) of
expired -> {expired, S};
persistent -> {persistent, S}
case is_store_enabled() of
false ->
none;
true ->
case lookup_session_store(ClientID) of
none -> none;
{value, #session_store{session = S} = SS} ->
case persistent_session_status(SS) of
expired -> {expired, S};
persistent -> {persistent, S}
end
end
end.