Chris Dallimore
unread,Dec 17, 2015, 12:30:06 PM12/17/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qps...@perl.org
The helo plugin fails to match any entries in badhelo, as the
is_regex_match sub returns after the first (usually unsuccessful) test.
This works for me:
--- a/plugins/helo
+++ b/plugins/helo
@@ -301,40 +301,27 @@
sub is_in_badhelo {
my ($self, $host) = @_;
-
- my $error = "I do not believe you are $host.";
+ my $error = "Your HELO hostname is not allowed";
$host = lc $host;
foreach my $bad ($self->qp->config('badhelo')) {
if ($bad =~ /[\{\}\[\]\(\)\^\$\|\*\+\?\\\!]/) { # it's a regexp
- return $self->is_regex_match($host, $bad);
+ #$self->log( LOGDEBUG, "is regex ($bad)");
+ if (substr($bad, 0, 1) eq '!') {
+ $bad = substr $bad, 1;
+ if ($host !~ /$bad/) {
+ #$self->log( LOGDEBUG, "matched negative pattern
(\!$bad)");
+ return $error, "badhelo negative pattern match
(\!$bad)";
}
- if ($host eq lc $bad) {
- return $error, "in badhelo";
}
+ elsif ($host =~ /$bad/) {
+ #$self->log( LOGDEBUG, "matched ($bad)");
+ return $error, "badhelo pattern match ($bad)";
}
- return;
}
-
-sub is_regex_match {
- my ($self, $host, $pattern) = @_;
-
- my $error = "Your HELO hostname is not allowed";
-
- #$self->log( LOGDEBUG, "is regex ($pattern)");
- if (substr($pattern, 0, 1) eq '!') {
- $pattern = substr $pattern, 1;
- if ($host !~ /$pattern/) {
-
- #$self->log( LOGDEBUG, "matched ($pattern)");
- return $error, "badhelo pattern match ($pattern)";
+ elsif ($host eq lc $bad) {
+ return $error, "($bad) in badhelo";
}
- return;
- }
- if ($host =~ /$pattern/) {
-
- #$self->log( LOGDEBUG, "matched ($pattern)");
- return $error, "badhelo pattern match ($pattern)";
}
return;
}