#3 bad domain returns OK

open
nobody
None
5
2004-12-05
2004-12-05
Alex K
No

when checking postmaster@angeltek.net :

Checking angeltek.net ...

check_email: checking "postmaster@angeltek.net"
check_hostname_syntax: checking "angeltek.net"
check_hostname_syntax: check result is ok: [0] correct
hostname syntax
check_username_syntax: checking "postmaster"
check_username_syntax: check result is ok: [0] correct
username syntax
check_network: checking "postmaster" on "angeltek.net"
_calc_timeout: start - 1102253101, now - 1102253101
_calc_timeout: timeout - 60, passed - 0
_calc_timeout: start - 1102253101, now - 1102253101
_calc_timeout: timeout - 60, passed - 0
check_network: "10.0.0.2" Wildcard gTLD check
_calc_timeout: start - 1102253101, now - 1102253101
_calc_timeout: timeout - 60, passed - 0
_calc_timeout: start - 1102253101, now - 1102253101
_calc_timeout: timeout - 60, passed - 0
check_network: "10.0.0.2" sending SYN...
check_network: "10.0.0.2" SYN packet sent.
_calc_timeout: start - 1102253101, now - 1102253101
_calc_timeout: timeout - 60, passed - 0
check_network: "10.0.0.2" waiting for ACK
check_network: "10.0.0.2" no ACK received: [No route to
host]
check_network: check result is ok: [6] Cannot connect
SMTP servers: 10.0.0.2
OK (1)

the error "no route to host" is processed as can't
connect, and it's not cought by Treat_Timeout_As_Fail
as well. here is my code :

#!/usr/bin/perl
use Mail::CheckUser qw(check_email last_check);

#$Mail::CheckUser::Skip_SMTP_Checks=1;
$Mail::CheckUser::Debug=1;
$Mail::CheckUser::Treat_Timeout_As_Fail=1;

select((select(STDOUT), $| = 1)[0]);

while ($domain=<STDIN>) {
$domain =~ s/(.*)\t(.*)//g;
$domain=$2;
$number=$1;
$number =~ s/\s+//;
chomp $domain;
print STDOUT "Checking $domain ... ";
if(check_email('postmaster@'.$domain)) {
print "OK ($number)\n";
} else {
print "NOT VALID ($number) : ",
last_check()->{reason}, "\n";
}
}

the input is a list of [number]\t[domain]\n

the module should really include a switch to drop all
private ip classes 10\8, 196.168/16, 172/x

Discussion