From 858fdbc11c8c04b2343cd099a202e121c64e1794 Mon Sep 17 00:00:00 2001 From: Matt Sergeant Date: Fri, 26 Sep 2008 17:39:42 +0000 Subject: [PATCH] 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 --- plugins/require_resolvable_fromhost | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/require_resolvable_fromhost b/plugins/require_resolvable_fromhost index 7f489e3..7c7db9b 100644 --- a/plugins/require_resolvable_fromhost +++ b/plugins/require_resolvable_fromhost @@ -53,8 +53,14 @@ sub check_dns { $res->udp_timeout(30); my @mx = mx($res, $host); 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); if ($query) { foreach my $rrA ($query->answer) {