Merge pull request #246 from msimerson/master
check *every* regex, not just first
This commit is contained in:
commit
66e76f5796
@ -307,7 +307,9 @@ sub is_in_badhelo {
|
||||
$host = lc $host;
|
||||
foreach my $bad ($self->qp->config('badhelo')) {
|
||||
if ($bad =~ /[\{\}\[\]\(\)\^\$\|\*\+\?\\\!]/) { # it's a regexp
|
||||
return $self->is_regex_match($host, $bad);
|
||||
if ($self->is_regex_match($host, $bad)) {
|
||||
return $error, "in badhelo";
|
||||
}
|
||||
}
|
||||
if ($host eq lc $bad) {
|
||||
return $error, "in badhelo";
|
||||
|
@ -56,11 +56,11 @@ sub test_invalid_localhost {
|
||||
foreach my $ip ( undef, '', '192.0.99.5' ) {
|
||||
$self->qp->connection->remote_ip(undef);
|
||||
($err, $why) = $self->invalid_localhost('localhost' );
|
||||
ok(!$err, "host: localhost, invalid remote ip");
|
||||
ok($err, "host: localhost, remote ip ($ip)");
|
||||
|
||||
$self->qp->connection->remote_ip(undef);
|
||||
($err, $why) = $self->invalid_localhost('not-localhost');
|
||||
ok($err, "host: not-localhost, invalid remote ip");
|
||||
ok(! $err, "host: not-localhost, remote ip ($ip)");
|
||||
}
|
||||
|
||||
foreach my $ip (qw/ ::1 127.0.0.1 / ) {
|
||||
|
Loading…
Reference in New Issue
Block a user