don't print GeoIP country if not defined
If we don't get a result from the lookup, all we know is that we didn't get a result. Maybe an error, maybe the IP not in the database.
This commit is contained in:
parent
005c4d9105
commit
651ca986ff
@ -16,14 +16,15 @@ or greylist.
|
|||||||
use Geo::IP;
|
use Geo::IP;
|
||||||
|
|
||||||
sub hook_connect {
|
sub hook_connect {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $geoip = Geo::IP->new(GEOIP_STANDARD);
|
my $geoip = Geo::IP->new(GEOIP_STANDARD);
|
||||||
my $country =
|
my $country =
|
||||||
$geoip->country_code_by_addr( $self->qp->connection->remote_ip );
|
$geoip->country_code_by_addr( $self->qp->connection->remote_ip )
|
||||||
|
or return (DECLINED);
|
||||||
|
|
||||||
$self->qp->connection->notes('geoip_country', $country);
|
$self->qp->connection->notes('geoip_country', $country);
|
||||||
$self->log(LOGNOTICE, "GeoIP Country: $country");
|
$self->log(LOGNOTICE, "GeoIP Country: $country");
|
||||||
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user