Lines 2319-2326
sub in_iprange {
Link Here
|
2319 |
my @allowedipranges = $iprange ? split(' ', $iprange) : (); |
2319 |
my @allowedipranges = $iprange ? split(' ', $iprange) : (); |
2320 |
if (scalar @allowedipranges > 0) { |
2320 |
if (scalar @allowedipranges > 0) { |
2321 |
my @rangelist; |
2321 |
my @rangelist; |
2322 |
eval { @rangelist = Net::CIDR::range2cidr(@allowedipranges); }; return 0 if $@; |
2322 |
eval { @rangelist = Net::CIDR::range2cidr(@allowedipranges); }; return 0 if $@; |
2323 |
eval { $result = Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . join(' ',@rangelist) ); |
2323 |
|
|
|
2324 |
if (defined $ENV{'HTTP_CF_CONNECTING_IP'}) { |
2325 |
eval { $result = Net::CIDR::cidrlookup($ENV{'HTTP_CF_CONNECTING_IP'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . $ENV{'HTTP_CF_CONNECTING_IP'}. ' in '. join(' ',@rangelist) ); |
2326 |
} else { |
2327 |
eval { $result = Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, @rangelist) } || Koha::Logger->get->warn('cidrlookup failed for ' . $ENV{'REMOTE_ADDR'} . ' in '. join(' ',@rangelist) ); |
2328 |
} |
2324 |
} |
2329 |
} |
2325 |
return $result ? 1 : 0; |
2330 |
return $result ? 1 : 0; |
2326 |
} |
2331 |
} |
2327 |
- |
|
|