Fix crash when unregistering unauthenticated connection
This commit is contained in:
parent
98ab862d5e
commit
fd00a29667
@ -58,7 +58,7 @@ module Rex
|
||||
@connection_message_counter.delete(connection_id)
|
||||
@user_connection_associations[
|
||||
@connection_user_associations[connection_id]
|
||||
].delete(connection_id)
|
||||
]&.delete(connection_id)
|
||||
@connection_user_associations.delete(connection_id)
|
||||
end
|
||||
|
||||
|
@ -101,4 +101,14 @@ RSpec.describe Rex::Server::MessageBroker do
|
||||
it { is_expected.to be_nil }
|
||||
end
|
||||
end
|
||||
|
||||
describe "#unregister" do
|
||||
context 'when connection was never associated with a user' do
|
||||
it 'does not crash' do
|
||||
expect do
|
||||
instance.unregister(connection_id_a)
|
||||
end.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user