Bugzilla – Attachment 69511 Details for
Bug 19752
Improve authentication response in offline_circ/service.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
offline_circ/service.pl return HTTP status 401 when authentication failed and add option nocookie.
offlinecircservicepl-return-HTTP-status-401-when-a.patch (text/plain), 1.78 KB, created by
Alex Arnaud
on 2017-12-05 15:41:47 UTC
(
hide
)
Description:
offline_circ/service.pl return HTTP status 401 when authentication failed and add option nocookie.
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2017-12-05 15:41:47 UTC
Size:
1.78 KB
patch
obsolete
>From d35743a1e6239c4dbac97aae3c7b1f4c40333842 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 5 Dec 2017 10:43:05 +0000 >Subject: [PATCH] offline_circ/service.pl return HTTP status 401 when > authentication failed and add option nocookie. > >test plan: > >- Apply this patch, >- log in to Koha, >- go to cgi-bin/koha/offline_circ/service.pl with no valid user > and password as parameters and nocookie set to 1. i.e: > cgi-bin/koha/offline_circ/service.pl?user=alex&password=wrongpass&nocookie=1, >- auth should fail >- check that the response code is 401 > >https://bugs.koha-community.org/show_bug.cgi?id=19752 >--- > offline_circ/service.pl | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > >diff --git a/offline_circ/service.pl b/offline_circ/service.pl >index a23e2b8..c03f623 100755 >--- a/offline_circ/service.pl >+++ b/offline_circ/service.pl >@@ -28,10 +28,11 @@ use Koha::DateUtils; > use DateTime::TimeZone; > > my $cgi = CGI->new; >+my $nocookie = $cgi->param('nocookie') || 0; > > # get the status of the user, this will check his credentials and rights > my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef); >-($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok'); >+($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok' && !$nocookie); > > my $result; > >@@ -77,9 +78,11 @@ if ($status eq 'ok') { # if authentication is ok > } > ); > } >-} else { >- $result = "Authentication failed." >+ >+ print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); >+ print $result; >+ exit; > } > >-print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8'); >+print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8', '-status' => '401 Unauthorized'); > print $result; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19752
:
69511
|
73799
|
74712
|
74776
|
74814