Bug 28383 - Log in via the itemsearch URL leads to Internal Server Error
Summary: Log in via the itemsearch URL leads to Internal Server Error
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-19 08:35 UTC by Christian Stelzenmüller
Modified: 2021-06-22 01:07 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
When trying to access the item search form in the staff interface (/cgi-bin/koha/catalogue/itemsearch.pl) when not logged in, an internal server error (error code 500) is received after entering your login details. This fixes the problem so that the item search form is displayed as expected.
Version(s) released in:
21.11.00,21.05.01,20.11.07


Attachments
Bug 28383: Fix itemsearch when accessed from the login form (1.03 KB, patch)
2021-06-11 11:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28383: Fix itemsearch when accessed from the login form (1.07 KB, patch)
2021-06-12 22:34 UTC, David Nind
Details | Diff | Splinter Review
Bug 28383: Fix itemsearch when accessed from the login form (1.13 KB, patch)
2021-06-14 19:33 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Stelzenmüller 2021-05-19 08:35:43 UTC
- Try to access the itemsearch-URL for the staff without beeing logged in
... cgi-bin/koha/catalogue/itemsearch.pl

- Log in 

- Internal Server Error
Comment 1 Fridolin Somers 2021-06-11 10:24:50 UTC
Oh crap indeed.

I think it comes from :

my $cgi = CGI->new;
my %params = $cgi->Vars;
 ...
if (scalar keys %params > 0) {
    # Parameters given, it's a search

In case of authentication, user and password are params.

Maybe we can test if $format param is defined.
Comment 2 Jonathan Druart 2021-06-11 11:27:50 UTC
Created attachment 121819 [details] [review]
Bug 28383: Fix itemsearch when accessed from the login form

There are params here (credentials), we need to test for the existence of $format.

Test plan:
logout
access /cgi-bin/koha/catalogue/itemsearch.pl
Login
=> Without this patch you get a 500 (because we hit the exit statement)
=> With this patch you see the items search form.
Comment 3 David Nind 2021-06-12 22:34:56 UTC
Created attachment 121893 [details] [review]
Bug 28383: Fix itemsearch when accessed from the login form

There are params here (credentials), we need to test for the existence of $format.

Test plan:
logout
access /cgi-bin/koha/catalogue/itemsearch.pl
Login
=> Without this patch you get a 500 (because we hit the exit statement)
=> With this patch you see the items search form.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Katrin Fischer 2021-06-14 19:33:26 UTC
Created attachment 121932 [details] [review]
Bug 28383: Fix itemsearch when accessed from the login form

There are params here (credentials), we need to test for the existence of $format.

Test plan:
logout
access /cgi-bin/koha/catalogue/itemsearch.pl
Login
=> Without this patch you get a 500 (because we hit the exit statement)
=> With this patch you see the items search form.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 David Cook 2021-06-14 23:51:23 UTC
(As a side note, this makes me think about how it would be good if we had 1 login point like "/cgi-bin/koha/login" which then redirected you back to your entrypoint after successful login)
Comment 6 Jonathan Druart 2021-06-15 14:28:46 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 7 Kyle M Hall 2021-06-18 14:51:42 UTC
Pushed to 21.05.x for 21.05.01
Comment 8 Fridolin Somers 2021-06-21 13:27:37 UTC
Pushed to 20.11.x for 20.11.07
Comment 9 Victor Grousset/tuxayo 2021-06-22 01:07:58 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.