Fix to check all MX hosts, not just the first

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@945 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2008-09-26 17:39:42 +00:00 committed by Ask Bjørn Hansen
parent 03c2bf7608
commit 858fdbc11c

View File

@ -53,8 +53,14 @@ sub check_dns {
$res->udp_timeout(30); $res->udp_timeout(30);
my @mx = mx($res, $host); my @mx = mx($res, $host);
foreach my $mx (@mx) { foreach my $mx (@mx) {
return mx_valid($self, $mx->exchange, $host); # if any MX is valid, then we consider the domain
# resolvable
return 1 if mx_valid($self, $mx->exchange, $host);
} }
# if there are MX records, and we got here,
# then none of them are valid
return 0 if (@mx > 0);
my $query = $res->search($host); my $query = $res->search($host);
if ($query) { if ($query) {
foreach my $rrA ($query->answer) { foreach my $rrA ($query->answer) {