Bug 13779: sessionID declared twice in C4::Auth::checkauth()
authorDavid Cook <dcook@prosentient.com.au>
Thu, 19 Jul 2018 06:57:22 +0000 (16:57 +1000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 24 Sep 2018 09:38:48 +0000 (11:38 +0200)
commit157bc44132814d9387d76a97b97748e4b29e810c
tree0dd08dbef9da1c65805bc69fed4c94be15f68675
parentf180314f58c57ce0c6c1094fa19da88502085144
Bug 13779: sessionID declared twice in C4::Auth::checkauth()

The bug is that $sessionID is declared twice in C4::Auth::checkauth().
At the moment, this doesn't actually create a problem, because no
one seems to be using the $sessionID which is returned by checkauth(),
except in the case of opac/external/overdrive/auth.pl which skips
the second declartion as it doesn't require auth.

This patch removes the redefining of the $sessionID variable.

In terms of testing, try logging in with a username and password
and see if it works. The only risk this patch would pose is breaking
auth I would think, since nothing is actually using the return value
from checkauth() for $sessionID.

NOTE:
It was initially defined near the top of the function (~line 791).
I believe the scoping would mean the correct version of $sessionID
would be used in the latter lines for the unset'ing.
I have skimmed code to see if the sessionID return value is used.
I did not test overdrive, as I do not know how. However, this is
the only area, I think this could possibly break. This change makes
sense to me.

QA: Please test overdrive.
opac/external/overdrive/auth.pl only checks if the value is set, so
   this patch might fix/break something there?
opac/svc/overdrive same kind of check.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This is a (tiny) code improvement. Now we consistently return the session
id that is also stored in the returned cookie. (Which can be an 'anon'
session.)
Fact is that Koha almost everywhere ignores the returned session id and
sometimes gets the session from the cookie (obviously). The session id is
also passed to the template by get_template_and_user but never used in
templates.
As mentioned, the two overdrive scripts are the exception. But since both
test on both $user && $sessionID, they will not choke on an anynonomous
session id without userid. So theoretically fine, but not tested.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 331af8521b5fba4b5553c182888a4017b2ce9c3a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 89f6aacecc787affd07856d6c092f21bacab7993)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Auth.pm