From e7f9f3bf21a1a2e317d59533917958dd2bf5c252 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 23 Mar 2013 01:03:28 -0400 Subject: [PATCH] geoip: added too_far option --- plugins/ident/geoip | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/ident/geoip b/plugins/ident/geoip index 2f6b635..9964457 100644 --- a/plugins/ident/geoip +++ b/plugins/ident/geoip @@ -58,6 +58,12 @@ IP of your mail server. Default: none. (no distance calculations) +=head2 too_far + +Assign negative karma to connections further than this many km. + +Default: none + =head2 db_dir The path to the GeoIP database directory. @@ -159,7 +165,12 @@ sub connect_handler { push @msg_parts, $c_code if $c_code; #push @msg_parts, $c_name if $c_name; push @msg_parts, $city if $city; - push @msg_parts, "\t$distance km" if $distance; + if ( $distance ) { + push @msg_parts, "\t$distance km"; + if ( $self->{_args}{too_far} && $distance > $self->{_args}{too_far} ) { + $self->adjust_karma( -1 ); + }; + }; $self->log(LOGINFO, join( ", ", @msg_parts) ); return DECLINED;