Skip to content

Commit

Permalink
Noise in Apache error_log (again) (#1325)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedas committed May 6, 2024
1 parent ea8592c commit feffbe0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib/Sympa/Scenario.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,9 @@ sub do_verify_netmask {
return 0 unless defined $ENV{'REMOTE_ADDR'};

my @cidr;
if ($args[0] eq 'default' or $args[0] eq 'any') {
unless (length($args[0] // '')) {
;
} elsif ($args[0] eq 'default' or $args[0] eq 'any') {
# Compatibility with Net::Netmask, adding IPv6 feature.
@cidr = ('0.0.0.0/0', '::/0');
} else {
Expand All @@ -1038,7 +1040,7 @@ sub do_verify_netmask {
}
unless (@cidr) {
$log->syslog('err', 'Error rule syntax: failed to parse netmask "%s"',
$args[0]);
$args[0] // '');
die {};
}

Expand Down Expand Up @@ -1074,6 +1076,7 @@ sub do_is_owner {
my $condition_key = shift;
my @args = @_;

return 0 unless defined $args[0] and defined $args[1];
return 0 if $args[1] eq 'nobody';

# The list is local or in another local robot
Expand Down Expand Up @@ -1146,22 +1149,22 @@ sub do_match {
my @args = @_;

# Nothing can match an empty regexp.
return 0 unless length $args[1];
return 0 unless length($args[1] // '');

# wrap matches with eval{} to avoid crash by malformed regexp.
my $r = 0;
if (ref $args[0] eq 'ARRAY') {
eval {
foreach my $arg (@{$args[0]}) {
if ($arg =~ /$args[1]/i) {
if (($arg // '') =~ /$args[1]/i) {
$r = 1;
last;
}
}
};
} else {
eval {
if ($args[0] =~ /$args[1]/i) {
if (($args[0] // '') =~ /$args[1]/i) {
$r = 1;
}
};
Expand Down

0 comments on commit feffbe0

Please sign in to comment.