Heh, I was going through this code a week or so ago and thought this 
looked odd...

I'll apply the patch.

On Thu, 12 Jun 2008 14:53:22 +0200, Jose Luis Martinez wrote:
> Hi,
> 
> We're using the require_resolvable_fromhost plugin, and have seen 
> that there is  a bug in it. MAIL FROM commands with legitimate 
> domains where getting rejected as not resolvable.
> 
> The bug has been tracked down to domains that have zone files with 
> unresolvable MX records.
> 
> example.com. 3600 IN MX 10 fakeserver.example.com.
> example.com. 3600 IN MX 20 mail.example.com.
> example.com. 3600 IN MX 30 anotherfakeserver.example.com.
> 
> The plugin tries to resolve every MX record in the list (to see if it 
> has an A record), but gives up on the first unresolvable one, 
> considering the whole domain unresolvable.
> 
> I consider this a bug, as leaving fake MX records is a known antispam 
> technique, and after all, the domain is resolvable if you have at 
> least one resolvable MX record.
> 
> Patch attached:
> 
> Index: plugins/require_resolvable_fromhost
> ===================================================================
> --- plugins/require_resolvable_fromhost       (revision 1)
> +++ plugins/require_resolvable_fromhost       (working copy)
> @@ -53,8 +53,14 @@
>    $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) {
> 
> 
> Jose Luis Martinez
> [EMAIL PROTECTED]
> CAPSiDE
> 

Reply via email to