Bug 15006 Drop raw connection if login fails
authorColin Campbell <colin.campbell@ptfs-europe.com>
Mon, 4 Jul 2016 15:13:16 +0000 (16:13 +0100)
committerFrédéric Demians <f.demians@tamil.fr>
Mon, 1 Aug 2016 09:51:18 +0000 (11:51 +0200)
commit4c91e8777004392459371bb20db8599c8c5a2646
tree09a5886610cffeb30cdee39966f7173fbe67089a
parent008f50fccb75945f7141660c36855b7b14550f33
Bug 15006 Drop raw connection if login fails

raw_connection was not behaving correctly if an invalid string was
passed or a login failed.
It was not checking that the login succeeded ( it checked that account
existed not that it contained data and it existed even if login failed)
and so failed logins instead of aborting immediately fell through into
the sip_protocol_loop, forcing that to timeout invalid connections.
It now checks that account has id set and returns if not.

The timeout alarm is now set on the while loop, in normal running this
should not be triggered as the socket is opened and the first data
should be a login message and the while loop should only iterate once,
but lets not go into an infinite loop due to unforeseen circumstances.

I have reindented the routine as the flow was not clear (the while was
not indented at all.

Also if using Net::Server::PreFork when a new connection comes in you
may be handed the the successful login parameters from a preceding call.
Because of this you could successfully transmit transactions and Koha
would carry them out without having received a valid login ( and
possibly with the wrong account details!) We now delete any existing
account for new connections.

NB: This patch requires that the patch for bug 13807 has been applied

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4f0fd3db556652f961710c64b9806512a491a7d3)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
C4/SIP/SIPServer.pm