Bugzilla – Attachment 99284 Details for
Bug 24538
REMOTE_USER set to undef if koha_trusted_proxies contains invalid value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24538: Handle Net::Netmask parser errors
Bug-24538-Handle-NetNetmask-parser-errors.patch (text/plain), 1.54 KB, created by
Martin Renvoize (ashimema)
on 2020-02-19 21:45:51 UTC
(
hide
)
Description:
Bug 24538: Handle Net::Netmask parser errors
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-19 21:45:51 UTC
Size:
1.54 KB
patch
obsolete
>From 23fb83c41635c3d89fad17d2e74dbcada86fe0e2 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 19 Feb 2020 02:07:30 +0000 >Subject: [PATCH] Bug 24538: Handle Net::Netmask parser errors > >This patch switches from the new() to new2() constructor, >which will return an undef value when it fails to parse a value. > >This patch warns on parser failures, but otherwise silently drops >the invalid value, and returns objects for any valid input it can parse. >This way one mistake won't disable the whole feature. > >To test: >1. Run the unit test t/Koha/Middlware/RealIP.t > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Middleware/RealIP.pm | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > >diff --git a/Koha/Middleware/RealIP.pm b/Koha/Middleware/RealIP.pm >index 22f40dbff4..88a843dbcf 100644 >--- a/Koha/Middleware/RealIP.pm >+++ b/Koha/Middleware/RealIP.pm >@@ -106,7 +106,16 @@ sub get_trusted_proxies { > my $proxies_conf = C4::Context->config('koha_trusted_proxies'); > return unless $proxies_conf; > my @trusted_proxies_ip = split( / /, $proxies_conf ); >- my @trusted_proxies = map { Net::Netmask->new($_) } @trusted_proxies_ip; >+ my @trusted_proxies = (); >+ foreach my $ip (@trusted_proxies_ip){ >+ my $mask = Net::Netmask->new2($ip); >+ if ($mask){ >+ push(@trusted_proxies,$mask); >+ } >+ else { >+ warn "$Net::Netmask::error"; >+ } >+ } > return \@trusted_proxies; > } > >-- >2.20.1
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 24538
:
99232
|
99233
|
99243
|
99244
|
99245
|
99283
| 99284