Le lundi 2 mai 2011 17:22, Wietse Venema a écrit : > fakessh: > > hello list > > hello gurus > > hello ? Wietse Venema
> a) Free crystal balls.
yes I possess crystal balls some nice numbers thank you
>
> b) Free telepathic services.
yes I possess powers parapsychic I discuss with a large Indian matemathiciens
I show you his page and I think we have succeeded in inventing a prototype
language based on orthogonal curvilinear representations of image that allows
us to accurately answer questions
>
> c) Concrete information about this problem.
no problem
the problem is solved by a plugin amavis
i cote
package Amavis::Custom;
use strict;
use re 'taint';
use warnings;
use warnings FATAL => qw(utf8 void);
no warnings qw(uninitialized redefine);
BEGIN {
import Amavis::Conf qw(:platform :confvars c cr ca);
import Amavis::Util qw(do_log untaint min max);
}
sub new {
my($class,$conn,$msginfo) = @_;
my($self) = bless {}, $class;
checks_geo($self,$conn,$msginfo);
$self;
}
use Geo::IP;
sub checks_geo {
my($self,$conn,$msginfo) = @_;
if (!exists $self->{geoip}) { # first time only in a child process
my $geo_file = "/usr/local/share/GeoIP/GeoLiteCity.dat";
$self->{geoip} = Geo::IP->open($geo_file, GEOIP_STANDARD);
if (!$self->{geoip}) {
do_log(0, "GeoIP: failed to open %s", $geo_file);
} else {
$self->{geoip}->set_charset(GEOIP_CHARSET_UTF8);
}
}
if ($self->{geoip}) {
my $last_received_ip =
Amavis::UnmangleSender::parse_ip_address_from_received($msginfo);
if (defined $last_received_ip && $last_received_ip ne '') {
my($country_name,$region_name,$city);
my $record = $self->{geoip}->record_by_addr($last_received_ip);
if (!$record) {
do_log(2, "GeoIP: no record for %s", $last_received_ip);
} else {
$country_name = $record->country_name;
$region_name = $record->region_name;
$city = $record->city;
}
do_log(2, "GeoIP: %-15s %s %s, %s, %s", $last_received_ip,
$msginfo->is_in_contents_category(CC_SPAM) ? 'SPAM' : ' ',
map(defined $_ && $_ ne '' ? $_ : "-",
$country_name, $region_name, $city));
my $hdr_edits = $msginfo->header_edits;
$hdr_edits->add_header('X-Amavis-GeoIP', "$country_name $city");
}
}
}
1;
thanks
>
> Wietse
--
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
gpg --keyserver pgp.mit.edu --recv-key 092164A7
pgpLgn32PMFk0.pgp
Description: PGP signature
