Hey Chris, See https://github.com/smtpd/qpsmtpd/pull/246
Matt > On Dec 17, 2015, at 9:17 AM, Chris Dallimore <pa...@pigstrough.co.uk> wrote: > > 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; > }