Bugzilla – Attachment 188124 Details for
Bug 41011
SelfCheckAllowByIPRanges doesn't work with localhost connections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41011: Add test
Bug-41011-Add-test.patch (text/plain), 1.53 KB, created by
Lari Taskula
on 2025-10-19 08:09:03 UTC
(
hide
)
Description:
Bug 41011: Add test
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2025-10-19 08:09:03 UTC
Size:
1.53 KB
patch
obsolete
>From 6b50b6908b37ad039a3635c2c97ad2ada5fd7422 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Sun, 19 Oct 2025 11:03:27 +0300 >Subject: [PATCH] Bug 41011: Add test > >--- > t/Auth.t | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/t/Auth.t b/t/Auth.t >index ff1201329c6..622227e4e51 100755 >--- a/t/Auth.t >+++ b/t/Auth.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > use Test::NoWarnings; >-use Test::More tests => 13; >+use Test::More tests => 14; > use Test::Warn; > > use C4::Auth qw( in_iprange ); >@@ -42,3 +42,23 @@ ok( > ok( in_iprange(""), "blank list given, no preference set - implies everything goes through." ); > ok( in_iprange(), "no list given, no preference set - implies everything goes through." ); > ok( in_iprange("192.168.1.1/36"), 'simple invalid ip range/36 with remote ip in it' ); >+ >+subtest 'test localhost' => sub { >+ plan tests => 2; >+ >+ sub _localhost_test { >+ my $REMOTE_ADDR = shift; >+ subtest "test REMOTE_ADDR = $REMOTE_ADDR" => sub { >+ plan tests => 3; >+ $ENV{REMOTE_ADDR} = $REMOTE_ADDR; >+ >+ ok(in_iprange('::1 127.0.0.1'), 'REMOTE_ADDR is in_iprange(::1 127.0.0.1)'); >+ ok(in_iprange($REMOTE_ADDR), 'REMOTE_ADDR is in_iprange('.$REMOTE_ADDR.')'); >+ my $opposite = $REMOTE_ADDR eq '127.0.0.1' ? '::1' : '127.0.0.1'; >+ ok(!in_iprange($opposite), 'REMOTE_ADDR is not in_iprange('.$opposite.')'); >+ }; >+ } >+ >+ _localhost_test('127.0.0.1'); >+ _localhost_test('::1'); >+}; >-- >2.34.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 41011
: 188124