Lines 164-182
unless ( C4::Context->preference('ILS-DI') ) {
Link Here
|
164 |
} |
164 |
} |
165 |
|
165 |
|
166 |
# If the remote address is not allowed, redirect to 403 |
166 |
# If the remote address is not allowed, redirect to 403 |
167 |
my @AuthorizedIPs = split(/,/, C4::Context->preference('ILS-DI:AuthorizedIPs')); |
167 |
my @AuthorizedIPs = split( /,/, C4::Context->preference('ILS-DI:AuthorizedIPs') ); |
168 |
if ( @AuthorizedIPs ){ # If no filter set, allow access to everybody |
168 |
if (@AuthorizedIPs) { # If no filter set, allow access to everybody |
169 |
my $authorized = 0; |
169 |
my $authorized = 0; |
170 |
foreach my $ip (@AuthorizedIPs){ |
170 |
foreach my $ip (@AuthorizedIPs) { |
171 |
my $netmask = Net::Netmask->new2($ip); |
171 |
my $netmask = Net::Netmask->new2($ip); |
172 |
if ( $netmask && $netmask->match($ENV{'REMOTE_ADDR'}) ){ |
172 |
if ( $netmask && $netmask->match( $ENV{REMOTE_ADDR} ) ) { |
173 |
$authorized = 1; |
173 |
$authorized = 1; |
174 |
last; |
174 |
last; |
175 |
} |
175 |
} |
176 |
} |
176 |
} |
177 |
unless ($authorized){ |
177 |
unless ($authorized) { |
178 |
$out->{'code'} = "NotAllowed"; |
178 |
$out->{'code'} = "NotAllowed"; |
179 |
$out->{'message'} = "Unauthorized IP address: ".$ENV{'REMOTE_ADDR'}."."; |
179 |
$out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}."; |
180 |
} |
180 |
} |
181 |
} |
181 |
} |
182 |
|
182 |
|
183 |
- |
|
|