Merge pull request #246 from msimerson/master

check *every* regex, not just first
This commit is contained in:
Matt Simerson 2015-12-20 08:53:25 -08:00
commit 66e76f5796
2 changed files with 5 additions and 3 deletions

View File

@ -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";

View File

@ -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 / ) {