Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 651ca986ffcf58d503b944c5e9e6a1c16e06cc5e 1 parent 005c4d9
@msimerson msimerson authored committed
Showing with 8 additions and 7 deletions.
  1. +8 −7 plugins/ident/geoip
View
15 plugins/ident/geoip
@@ -16,14 +16,15 @@ or greylist.
use Geo::IP;
sub hook_connect {
- my ($self) = @_;
+ my ($self) = @_;
- my $geoip = Geo::IP->new(GEOIP_STANDARD);
- my $country =
- $geoip->country_code_by_addr( $self->qp->connection->remote_ip );
+ my $geoip = Geo::IP->new(GEOIP_STANDARD);
+ my $country =
+ $geoip->country_code_by_addr( $self->qp->connection->remote_ip )
+ or return (DECLINED);
- $self->qp->connection->notes('geoip_country', $country);
- $self->log(LOGNOTICE, "GeoIP Country: $country");
+ $self->qp->connection->notes('geoip_country', $country);
+ $self->log(LOGNOTICE, "GeoIP Country: $country");
- return DECLINED;
+ return DECLINED;
}
Please sign in to comment.
Something went wrong with that request. Please try again.