Modify WebGUI IP fields to use CIDR format instead of a regular expression.
Multiple IPs are separated by commas, whitespace is ignored. In groups, that affects the ipFilter field, User::isInGroup. In settings, that affects Settings::debugIp and Session::ErrorHandler::canShowDebug. Fixed a bug in WebGUI::Utility::isInSubnet where Net::Subnets->check needs a scalar. Modified t/User.t to use addresses in CIDR format.
This commit is contained in:
parent
c6bc09f79c
commit
cd6759f311
7 changed files with 55 additions and 26 deletions
|
|
@ -87,14 +87,10 @@ sub canShowDebug {
|
|||
return 0 unless ($self->session->setting->get("showDebug"));
|
||||
return 0 unless ($self->session->http->getMimeType eq "text/html");
|
||||
return 1 if ($self->session->setting->get("debugIp") eq "");
|
||||
my @ips = split(" ",$self->session->setting->get("debugIp"));
|
||||
my $ok = 0;
|
||||
foreach my $ip (@ips) {
|
||||
if ($self->session->env->get("REMOTE_ADDR") =~ /^$ip/) {
|
||||
$ok = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $ips = $self->session->setting->get("debugIp");
|
||||
$ips =~ s/\s+//g;
|
||||
my @ips = split(",", $ips);
|
||||
my $ok = WebGUI::Utility::isInSubnet($self->session->env->get("REMOTE_ADDR"), [ @ips] );
|
||||
return $ok;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue