From bf8dc171a3792d11e59a19302d45b687be15fd0c Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Mon, 22 Dec 2014 16:09:41 -0600 Subject: [PATCH] Don't disable greylist in absence of p0f argument --- plugins/greylisting | 2 +- t/plugin_tests/greylisting | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/greylisting b/plugins/greylisting index efd5792..e7b3a02 100644 --- a/plugins/greylisting +++ b/plugins/greylisting @@ -474,7 +474,7 @@ sub prune_db { sub exclude { my ( $self ) = @_; return 1 if $self->is_immune(); - return 1 if !$self->p0f_match(); + return 1 if $self->{_args}{p0f} and ! $self->p0f_match(); return 1 if $self->geoip_match(); return 1 if $self->exclude_file_match(); return; diff --git a/t/plugin_tests/greylisting b/t/plugin_tests/greylisting index 83a2be6..4576ecb 100644 --- a/t/plugin_tests/greylisting +++ b/t/plugin_tests/greylisting @@ -136,6 +136,16 @@ sub test_exclude { ok( $self->exclude(), "Relay client results in exclude() hit" ); $self->connection->relay_client(0); ok( ! $self->exclude(), "Non-relay client results in exclude() miss" ); + + my $old_p0f = $self->connection->notes('p0f'); + $self->connection->notes('p0f'=> { genre => 'windows' } ); + delete $self->{_args}{p0f}; + ok( ! $self->exclude(), 'no p0f args = no exclusion' ); + $self->{_args}{'p0f'} = 'genre,Lindows'; + ok( $self->exclude(), 'p0f miss = exclusion' ); + $self->{_args}{'p0f'} = 'genre,Windows'; + ok( ! $self->exclude(), 'p0f hit = no exclusion' ); + $self->connection->notes( p0f => $old_p0f ); } sub test_greylist_geoip {