Consolidate greylist exclusions into exclude()

This makes for an easily overridden method for excluding hosts from greylisting with custom rules
This commit is contained in:
Jared Johnson 2014-10-27 17:24:06 -05:00
parent 76c2e5b030
commit 179d6427fc

View File

@ -285,9 +285,7 @@ sub greylist {
map { $_ . '=' . $config->{$_} } sort keys %$config) map { $_ . '=' . $config->{$_} } sort keys %$config)
); );
return DECLINED if $self->is_immune(); return DECLINED if $self->exclude();
return DECLINED if !$self->p0f_match();
return DECLINED if $self->geoip_match();
my $db = $self->get_db_location(); my $db = $self->get_db_location();
my $lock = $self->get_db_lock($db) or return DECLINED; my $lock = $self->get_db_lock($db) or return DECLINED;
@ -507,6 +505,12 @@ sub prune_db {
return $self->cleanup_and_return($tied, $lock, DECLINED); return $self->cleanup_and_return($tied, $lock, DECLINED);
} }
sub exclude {
return 1 if $self->is_immune();
return 1 if !$self->p0f_match();
return 1 if $self->geoip_match();
}
sub p0f_match { sub p0f_match {
my $self = shift; my $self = shift;