Bugzilla – Attachment 181678 Details for
Bug 36867
ILS-DI AuthorizedIPs should deny explicitly except those listed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36867: (follow-up) Don't check IP if ILS-DI disabled
Bug-36867-follow-up-Dont-check-IP-if-ILS-DI-disabl.patch (text/plain), 2.84 KB, created by
Nick Clemens (kidclamp)
on 2025-04-29 16:33:18 UTC
(
hide
)
Description:
Bug 36867: (follow-up) Don't check IP if ILS-DI disabled
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-04-29 16:33:18 UTC
Size:
2.84 KB
patch
obsolete
>From 479ad8698ef629549da1240b7496858db0ca0cc0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 29 Apr 2025 16:26:39 +0000 >Subject: [PATCH] Bug 36867: (follow-up) Don't check IP if ILS-DI disabled > >When ILS-DI is disabled we still expect to return the correct service name/section in the >xml, but just indicate that it is disabled. > >We should skip the check for authorized IPs in this case, as the IP only matters when service is enabled >--- > opac/ilsdi.pl | 52 ++++++++++++++++++++++++++------------------------- > 1 file changed, 27 insertions(+), 25 deletions(-) > >diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl >index 47eb56d920e..0d6a1067157 100755 >--- a/opac/ilsdi.pl >+++ b/opac/ilsdi.pl >@@ -161,36 +161,38 @@ my $out; > unless ( C4::Context->preference('ILS-DI') ) { > $out->{'code'} = "NotAllowed"; > $out->{'message'} = "ILS-DI is disabled."; >-} >+} else { > >-# If the remote address is not allowed, redirect to 403 >-my @AuthorizedIPs = split( /,/, C4::Context->preference('ILS-DI:AuthorizedIPs') ); >-if (@AuthorizedIPs) { # If no filter set, allow access to everybody >- my $authorized = 0; >- foreach my $ip (@AuthorizedIPs) { >- my $netmask = Net::Netmask->new2($ip); >- if ( $netmask && $netmask->match( $ENV{REMOTE_ADDR} ) ) { >- $authorized = 1; >- last; >+ # If the remote address is not allowed, redirect to 403 >+ my @AuthorizedIPs = split( /,/, C4::Context->preference('ILS-DI:AuthorizedIPs') ); >+ if (@AuthorizedIPs) { # If no filter set, allow access to everybody >+ my $authorized = 0; >+ foreach my $ip (@AuthorizedIPs) { >+ my $netmask = Net::Netmask->new2($ip); >+ if ( $netmask && $netmask->match( $ENV{REMOTE_ADDR} ) ) { >+ $authorized = 1; >+ last; >+ } > } >- } >- unless ($authorized) { >+ unless ($authorized) { >+ $out->{'code'} = "NotAllowed"; >+ $out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}."; >+ } >+ } else { > $out->{'code'} = "NotAllowed"; > $out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}."; >+ >+ print XMLout( >+ $out, >+ noattr => 1, >+ nosort => 1, >+ xmldecl => '<?xml version="1.0" encoding="UTF-8" ?>', >+ RootName => "ilsdi", >+ SuppressEmpty => 1 >+ ); >+ exit 0; > } >-} else { >- $out->{'code'} = "NotAllowed"; >- $out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}."; >- >- print XMLout( >- $out, >- noattr => 1, >- nosort => 1, >- xmldecl => '<?xml version="1.0" encoding="UTF-8" ?>', >- RootName => "ilsdi", >- SuppressEmpty => 1 >- ); >- exit 0; >+ > } > > my $service = $cgi->param('service') || "ilsdi"; >-- >2.39.5
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 36867
:
166786
|
166787
|
166818
|
166819
|
170526
|
170527
|
179905
|
179908
|
179909
| 181678