diff -Nur smeserver-geoip-1.2.old/root/usr/share/qpsmtpd/plugins/check_badcountries smeserver-geoip-1.2/root/usr/share/qpsmtpd/plugins/check_badcountries --- smeserver-geoip-1.2.old/root/usr/share/qpsmtpd/plugins/check_badcountries 2019-10-20 21:40:40.825000000 -0400 +++ smeserver-geoip-1.2/root/usr/share/qpsmtpd/plugins/check_badcountries 2019-10-20 21:43:24.353000000 -0400 @@ -276,17 +276,14 @@ else { $self->log(LOGNOTICE, "GeoIP City: $city"); } - # Should have a country and or city here + + my $country = $self->qp->connection->notes('geoip_country'); + # Returns DECLINED if there are no countries found above + return DECLINED unless $country; + $self->log(LOGNOTICE, "GeoIP Country: $country"); if ( $self->qp->config("badcountries") ) { my @badcountries = $self->qp->config("badcountries"); - - my $country = $self->qp->connection->notes('geoip_country'); - # Returns DECLINED if there are no countries found above - return DECLINED unless $country; - - $self->log(LOGNOTICE, "GeoIP Country: $country"); - for (@badcountries) { my ($pattern, $response) = split /\s+/, $_, 2; #my $whitelisthost = $connection->notes('whitelisthost'); @@ -346,15 +343,13 @@ } $self->log(LOGINFO, join(", ", @msg_parts)); + my $country = $self->qp->connection->notes('geoip_country'); + # Returns DECLINED if there are no countries found above + return DECLINED unless $country; + $self->log(LOGNOTICE, "GeoIP Country: $country"); + if ( $self->qp->config("badcountries") ) { my @badcountries = $self->qp->config("badcountries"); - - my $country = $self->qp->connection->notes('geoip_country'); - # Returns DECLINED if there are no countries found above - return DECLINED unless $country; - - $self->log(LOGNOTICE, "GeoIP Country: $country"); - for (@badcountries) { my ($pattern, $response) = split /\s+/, $_, 2; #my $whitelisthost = $connection->notes('whitelisthost');