Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

helo plugin fails to match badhelo

2 views
Skip to first unread message

Chris Dallimore

unread,
Dec 17, 2015, 12:30:06 PM12/17/15
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;
}

Matt Simerson via qpsmtpd

unread,
Dec 17, 2015, 1:45:02 PM12/17/15
to Chris Dallimore, qps...@perl.org
0 new messages