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)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 15 Jul 2016 14:11:04 +0000 (14:11 +0000)
commit4f0fd3db556652f961710c64b9806512a491a7d3
tree83469fb8e43307d53902eb802c4051b794d60d0c
parente75d9befca13c2f74706e5eb7874a27bdc1928f1
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>
C4/SIP/SIPServer.pm