minor amendments to previous commit

This commit is contained in:
Oliver Gorwits
2019-04-30 06:55:38 +01:00
parent ee9f79c95c
commit e3648cda37

View File

@@ -102,9 +102,9 @@ sub check_acl {
$config = [$config] if ref [] ne ref $config; $config = [$config] if ref [] ne ref $config;
my $all = (scalar grep {$_ eq 'op:and'} @$config); my $all = (scalar grep {$_ eq 'op:and'} @$config);
my $find = (scalar grep {not reftype $_ and $_ eq $real_ip} @$config);
# common case of using plain IP in ACL, so string compare for speed # common case of using plain IP in ACL, so string compare for speed
my $find = (scalar grep {not reftype $_ and $_ eq $real_ip} @$config);
return 1 if $find and not $all; return 1 if $find and not $all;
my $addr = NetAddr::IP::Lite->new($real_ip) or return 0; my $addr = NetAddr::IP::Lite->new($real_ip) or return 0;
@@ -115,7 +115,6 @@ sub check_acl {
INLIST: foreach (@$config) { INLIST: foreach (@$config) {
my $item = $_; # must copy so that we can modify safely my $item = $_; # must copy so that we can modify safely
next INLIST if !defined $item or $item eq 'op:and'; next INLIST if !defined $item or $item eq 'op:and';
my $neg = ($item =~ s/^!//);
if ($qref eq ref $item) { if ($qref eq ref $item) {
$name = ($name || hostname_from_ip($addr->addr, $ropt) || '!!none!!'); $name = ($name || hostname_from_ip($addr->addr, $ropt) || '!!none!!');
@@ -128,6 +127,8 @@ sub check_acl {
next INLIST; next INLIST;
} }
my $neg = ($item =~ s/^!//);
if ($item =~ m/^group:(.+)$/) { if ($item =~ m/^group:(.+)$/) {
my $group = $1; my $group = $1;
setting('host_groups')->{$group} ||= []; setting('host_groups')->{$group} ||= [];